GuideAdvanced
Custom Agents
Register and run custom agents in cua-bench
Custom Agents
Adding an agent to the source
- Create
cua_bench/agents/your_agent.py— extendBaseAgent, decorate with@register_agent("your-agent") - Add the import to
cua_bench/agents/__init__.py - Run with
cb run task <path> --agent your-agent
See the Build a Custom Agent example for full code.
Local registry (without modifying source)
Register an agent via .cua/agents.yaml in your project root:
agents:
- name: my-agent
import_path: my_package.agents:MyAgent
defaults:
model: claude-sonnet-4-20250514
max_steps: 50The import_path format is module.path:ClassName. The module must be importable from the Python environment.
Docker image agents
For production or CI, package your agent as a Docker image:
agents:
- name: my-agent
image: myregistry/my-agent:latest
command: ['python', '-m', 'my_agent.main']
defaults:
model: gpt-4oThe agent container receives these environment variables:
| Variable | Description |
|---|---|
CUA_ENV_API_URL | API endpoint for the environment container |
CUA_ENV_VNC_URL | VNC endpoint for debugging |
CUA_ENV_TYPE | OS type (linux, windows, android) |
CUA_TASK_PATH | Mounted task config path (/app/env) |
CUA_TASK_INDEX | Task index to run |
CUA_MODEL | Model override (if specified) |
ANTHROPIC_API_KEY | Passed through from host |
OPENAI_API_KEY | Passed through from host |
GOOGLE_API_KEY | Passed through from host |
Development with --with
Mount and pip install local packages into the agent container without rebuilding:
cb run task tasks/my-task --agent my-agent --with ./path/to/local/packageCan be repeated for multiple packages:
cb run task tasks/my-task --agent my-agent --with ../cua-bench --with ../my-utilsAgent lookup order
When you pass --agent <name>:
.cua/agents.yaml(local registry) — checked first- Built-in registry (
@register_agentdecorators) — fallback
CLI options
cb run task <path> --agent <name> # Use a registered agent
cb run task <path> --agent-kwarg key=value # Pass kwargs to agent __init__
cb run task <path> --model <model> # Override model
cb run task <path> --with <path> # Mount local package (repeatable)Was this page helpful?