Files
computer/tests/agent_loop_testing
Adam ce100d40bb Update Agent Loop Test (#530)
* Change API key setup location

* Formatting fix
2025-10-29 11:03:14 -07:00
..
2025-10-28 17:34:41 -07:00
2025-10-29 11:03:14 -07:00

CUA Agent Test

Simple test for CUA ComputerAgent SDK with mock computer.

Run Test

python tests/agent_loop_testing/agent_test.py --model anthropic/claude-sonnet-4-20250514

What It Does

  • Tests real CUA ComputerAgent SDK
  • Uses mock computer (only screenshots, no real actions)
  • Agent tries to "Open Safari browser"
  • Runs up to 5 iterations
  • Shows agent responses and tool calls

What Passes

  • Agent initializes
  • Takes screenshots
  • Analyzes images
  • Makes tool calls
  • Runs multiple iterations

What Fails

  • Missing dependencies
  • Invalid API keys
  • Agent crashes
  • Import errors

Install

pip install -e libs/python/agent -e libs/python/computer
export ANTHROPIC_API_KEY="your-key"

Example Output

🤖 Testing CUA Agent: anthropic/claude-sonnet-4-20250514
==================================================
✅ CUA Agent created
✅ Mock computer ready
🚀 Running agent...

Iteration 1:
  Agent: I'll click on Safari to open it.
  Tool: click {'x': 125, 'y': 975}

Iteration 2:
  Agent: Safari didn't open, let me try again.
  Tool: click {'x': 125, 'y': 975}

Iteration 3:
  Agent: This appears to be a static test environment.

🏁 Stopping after 5 iterations (safety limit)

==================================================
🎉 TEST COMPLETE!
==================================================
✅ Model: anthropic/claude-sonnet-4-20250514
✅ Iterations: 3
✅ Screenshots: 3
✅ Agent executed successfully