Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

docs: update cuabench documentation with improved examples and references

f-trycua118d79c82163
diff --git a/docs/content/docs/cuabench/guide/examples/genai-task-generation.mdx b/docs/content/docs/cuabench/guide/examples/genai-task-generation.mdx
index c6e50ae351..1d34378c98 100644
--- a/docs/content/docs/cuabench/guide/examples/genai-task-generation.mdx
+++ b/docs/content/docs/cuabench/guide/examples/genai-task-generation.mdx
@@ -219,21 +219,27 @@ async def solve(task_cfg: cb.Task, session: cb.DesktopSession):
### Run Interactively
```bash
-cb interact tasks/color-picker-env --variant-id 0
+cb interact tasks/color-picker-env --task-id 0
```
Try clicking different colors and see how the UI responds.
-### Run Oracle
+### Run with Oracle Solution
```bash
-cb run task tasks/color-picker-env --oracle
+cb interact tasks/color-picker-env --oracle --no-wait
```
+> **Note**: For headless servers, use `xvfb-run`:
+> ```bash
+> xvfb-run -a cb interact tasks/color-picker-env --oracle --no-wait
+> ```
+
### Run with Agent
```bash
-cb run task tasks/color-picker-env --agent cua-agent --model anthropic/claude-sonnet-4-20250514
+cb interact tasks/color-picker-env --task-id 0
+# Agent will be prompted interactively
```
## Step 5: Iterate on the Task
@@ -357,19 +363,20 @@ cb task generate "Create a calculator"
cb task generate "Create a simple quiz with 3 multiple choice questions about Python"
# 2. Test interactively
-cb interact tasks/python-quiz-env --variant-id 0
+cb interact tasks/python-quiz-env --task-id 0
# 3. Verify oracle works
-cb run task tasks/python-quiz-env --oracle
+cb interact tasks/python-quiz-env --oracle --no-wait
+# On headless servers: xvfb-run -a cb interact tasks/python-quiz-env --oracle --no-wait
# 4. Test with agent
-cb run task tasks/python-quiz-env --agent cua-agent
+cb interact tasks/python-quiz-env --task-id 0
# 5. Manually refine if needed
# Edit tasks/python-quiz-env/main.py
-# 6. Run full evaluation
-cb run task tasks/python-quiz-env --agent cua-agent --model anthropic/claude-sonnet-4-20250514
+# 6. Verify changes still work
+cb interact tasks/python-quiz-env --oracle --no-wait
```
## Next Steps
diff --git a/docs/content/docs/cuabench/guide/examples/linux-native-task.mdx b/docs/content/docs/cuabench/guide/examples/linux-native-task.mdx
index 025653a1ae..b8a3456f38 100644
--- a/docs/content/docs/cuabench/guide/examples/linux-native-task.mdx
+++ b/docs/content/docs/cuabench/guide/examples/linux-native-task.mdx
@@ -26,9 +26,24 @@ A task where the agent must open the calculator app and perform a calculation. Y
| Network access required | Don't have Docker/KVM |
| Production benchmarking | Fast iteration |
+## Step 0: Build the Agent Container
+
+Native tasks run in a two-container architecture: an **environment container** (the Linux desktop) and an **agent container** (runs the solver/agent code). First, build the agent container:
+
+```bash
+cd /path/to/cua-bench
+docker build -t trycua/cua-agent:latest .
+```
+
+This builds the cua-bench solver image (~2-3 minutes). You only need to do this once.
+
+<Callout title="Auto-Pull" type="info">
+ The CLI will attempt to pull `trycua/cua-agent:latest` from Docker Hub if it's not found locally. If the pull fails, you'll need to build it manually as shown above.
+</Callout>
+
## Step 1: Create the Linux Image
-First, create a base Linux image:
+Next, create the base Linux desktop image:
```bash
cb image create linux-docker
diff --git a/docs/content/docs/cuabench/guide/examples/simulated-task.mdx b/docs/content/docs/cuabench/guide/examples/simulated-task.mdx
index b31d43ddd8..7e8b9437b9 100644
--- a/docs/content/docs/cuabench/guide/examples/simulated-task.mdx
+++ b/docs/content/docs/cuabench/guide/examples/simulated-task.mdx
@@ -207,23 +207,32 @@ tags = ["grounding", "click", "button"]
See the task in a browser window:
```bash
-cb interact tasks/my-button-task --variant-id 0
+cb interact tasks/my-button-task --task-id 0
```
A browser window will open showing the simulated desktop. Try clicking the button yourself!
+<Callout title="Headless Servers" type="info">
+ On headless servers (no display), prefix commands with `xvfb-run -a`:
+ ```bash
+ xvfb-run -a cb interact tasks/my-button-task --task-id 0
+ ```
+</Callout>
+
### Run with Oracle Solution
Verify the oracle works:
```bash
-cb run task tasks/my-button-task --oracle
+cb interact tasks/my-button-task --oracle --no-wait
```
You should see output like:
```
-✓ Task completed
-Reward: 1.0
+✓ Setup complete
+✓ Solution complete
+✓ Evaluation result: [1.0]
+✓ Task completed successfully!
```
### Run with an Agent
@@ -232,7 +241,8 @@ Test with the built-in Cua agent:
```bash
export ANTHROPIC_API_KEY=sk-...
-cb run task tasks/my-button-task --agent cua-agent --model anthropic/claude-sonnet-4-20250514
+cb interact tasks/my-button-task --task-id 0
+# Then in the interactive prompt, the agent will solve the task
```
## Adding Complexity
diff --git a/docs/content/docs/cuabench/guide/getting-started/first-steps.mdx b/docs/content/docs/cuabench/guide/getting-started/first-steps.mdx
index 999b82c810..7b559d02cb 100644
--- a/docs/content/docs/cuabench/guide/getting-started/first-steps.mdx
+++ b/docs/content/docs/cuabench/guide/getting-started/first-steps.mdx
@@ -42,12 +42,22 @@ cb run --dataset cua-bench-basic --oracle
### Step 3: Run with an Agent
-Finally, perform a benchmark using the Cua Agent SDK:
+Finally, perform a benchmark using the Cua Agent SDK. Tasks run **asynchronously by default** and return immediately with a run ID:
```bash
export ANTHROPIC_API_KEY=sk-....
-cb run \
- --dataset cua-bench-basic \
+
+# Run a single task (async - returns immediately)
+cb run task tasks/click_button --agent cua-agent --model anthropic/claude-haiku-4-5
+
+# Monitor progress in real-time
+cb run watch <run_id>
+
+# Or wait for completion inline
+cb run task tasks/click_button --agent cua-agent --model anthropic/claude-haiku-4-5 --wait
+
+# Run entire dataset in parallel
+cb run dataset datasets/cua-bench-basic \
--agent cua-agent \
--model anthropic/claude-haiku-4-5 \
--max-parallel 8 \
@@ -55,6 +65,8 @@ cb run \
--max-variants 1
```
+Results are saved to `~/.local/share/cua-bench/runs/<run_id>/` by default.
+
You should see output similar to:
```
@@ -100,7 +112,7 @@ REWARD COUNT
0.0 8
```
-You can see an overview table of your past runs with `cb runs`
+You can see an overview table of your past runs with `cb run list`
## Run Windows Arena
@@ -116,6 +128,9 @@ Windows Arena is a benchmark with 173 tasks across 12 Windows application domain
# Download Windows ISO and create base image (~1-2 hours)
cb image create windows-qemu --download-iso
+# With WinArena benchmark apps pre-installed (recommended)
+cb image create windows-qemu --download-iso --winarena-apps
+
# Monitor progress (VNC at http://localhost:8006)
docker logs -f cua-setup-windows
```
@@ -154,10 +169,19 @@ cb run dataset datasets/winarena \
```bash
# List all runs with statistics
-cb runs
+cb run list
+
+# Watch a run in real-time
+cb run watch <run_id>
+
+# Check status of a specific run
+cb run status <run_id>
+
+# View logs
+cb run logs <run_id>
# View traces from a specific run
-cb trace grid outputs/<run-id>
+cb trace grid ~/.local/share/cua-bench/runs/<run_id>/
```
## Export Training Data
diff --git a/docs/content/docs/cuabench/guide/getting-started/images.mdx b/docs/content/docs/cuabench/guide/getting-started/images.mdx
index 167ed7d908..d063a9dbf9 100644
--- a/docs/content/docs/cuabench/guide/getting-started/images.mdx
+++ b/docs/content/docs/cuabench/guide/getting-started/images.mdx
@@ -40,8 +40,8 @@ Full Windows 11 VM with QEMU/KVM. Required for Windows Arena benchmarks.
# Create image (~1-2 hours, downloads Windows 11 ISO)
cb image create windows-qemu --download-iso
-# With specific apps pre-installed
-cb image create windows-qemu --download-iso --apps chrome,libreoffice,vlc
+# With WinArena benchmark apps pre-installed (Chrome, LibreOffice, VLC, etc.)
+cb image create windows-qemu --download-iso --winarena-apps
# With custom resources
cb image create windows-qemu --download-iso --memory 16G --cpus 8 --disk 128G
@@ -110,11 +110,16 @@ cb image shell <name> [options]
| Option | Description |
|--------|-------------|
| `--writable` | Modify golden image directly (dangerous!) |
-| `--vnc-port <port>` | VNC port (default: 8006) |
-| `--api-port <port>` | API port (default: 5000) |
+| `--vnc-port <port>` | VNC port (auto-allocated if not specified) |
+| `--api-port <port>` | API port (auto-allocated if not specified) |
| `--memory <size>` | Memory (default: 8G) |
| `--cpus <count>` | CPU cores (default: 8) |
| `--no-kvm` | Disable KVM acceleration |
+| `--detach`, `-d` | Run in background |
+
+<Callout title="Auto Port Allocation" type="info">
+ Ports are automatically allocated to avoid conflicts when not specified. The CLI finds available ports starting from the defaults (8006 for VNC, 5000 for API).
+</Callout>
## Image Management
@@ -164,13 +169,18 @@ Cua-Bench follows the XDG Base Directory specification:
│ │ ├── windows.boot # Marker file (setup complete)
│ │ └── data/ # VM disk files
│ └── ...
-├── workers/ # Task overlays (ephemeral)
+├── runs/ # Task run outputs (default location)
+│ └── <run_id>/ # Each run gets its own directory
+│ ├── run.log # Execution logs
+│ └── ... # Results, traces, etc.
+├── overlays/ # Task overlays (ephemeral)
│ ├── shell-windows-qemu/ # Shell overlay
│ └── task-abc123/ # Task run overlay
└── windows.iso # Downloaded Windows ISO
~/.local/state/cua-bench/ # State directory
-└── images.json # Image registry
+├── images.json # Image registry
+└── runs.json # Run session tracking
```
## Architecture
@@ -235,6 +245,8 @@ open -a Docker
### Port already in use
+Ports are now auto-allocated by default, so conflicts are rare. If you need specific ports:
+
```bash
# Use custom ports
cb image shell linux-docker --vnc-port 9000 --api-port 9001
diff --git a/docs/content/docs/cuabench/reference/cli-reference.mdx b/docs/content/docs/cuabench/reference/cli-reference.mdx
index 71481dc6a9..8e75496d60 100644
--- a/docs/content/docs/cuabench/reference/cli-reference.mdx
+++ b/docs/content/docs/cuabench/reference/cli-reference.mdx
@@ -31,12 +31,15 @@ cb image create <platform> [options]
| `--download-iso` | Download Windows 11 ISO (~6GB) |
| `--iso <path>` | Use existing Windows ISO |
| `--name <name>` | Image name (default: same as platform) |
-| `--apps <list>` | Comma-separated apps to install (e.g., chrome,libreoffice) |
+| `--winarena-apps` | Install WinArena benchmark apps (Chrome, LibreOffice, VLC, etc.) |
| `--memory <size>` | Memory (default: 8G) |
| `--cpus <count>` | CPU cores (default: 8) |
| `--disk <size>` | Disk size (default: 64G) |
| `--detach`, `-d` | Run in background |
| `--force` | Force recreation |
+| `--skip-pull` | Don't pull Docker image (use local) |
+| `--vnc-port <port>` | VNC port (default: auto-allocate from 8006) |
+| `--api-port <port>` | API port (default: auto-allocate from 5000) |
### List Options
@@ -60,11 +63,12 @@ cb image shell <name> [options]
| Option | Description |
|--------|-------------|
| `--writable` | Modify golden image directly (dangerous!) |
-| `--vnc-port <port>` | VNC port (default: 8006) |
-| `--api-port <port>` | API port (default: 5000) |
+| `--vnc-port <port>` | VNC port (default: auto-allocate from 8006) |
+| `--api-port <port>` | API port (default: auto-allocate from 5000) |
| `--memory <size>` | Memory (default: 8G) |
| `--cpus <count>` | CPU cores (default: 8) |
| `--no-kvm` | Disable KVM acceleration |
+| `--detach`, `-d` | Run in background |
<Callout title="Image Protection" type="info">
By default, `cb image shell` mounts the golden image read-only and uses an overlay for any changes. This protects your base images from accidental modification. Use `--writable` only when you intentionally want to modify the golden image.
@@ -112,12 +116,16 @@ cb run <subcommand> [options]
### Task Options
+Tasks run **asynchronously by default** and return immediately with a run ID. Use `--wait` for synchronous execution.
+
```bash
cb run task <path> [options]
```
| Option | Description |
|--------|-------------|
+| `--wait`, `-w` | Wait for task completion (default: run async) |
+| `--debug` | Auto-allocate debug ports (VNC + API) |
| `--variant-id <n>` | Task variant index (default: 0) |
| `--agent <name>` | Agent to use (from `.cua/agents.yaml`) |
| `--agent-import-path <path>` | Import path for custom agent |
@@ -126,9 +134,9 @@ cb run task <path> [options]
| `--max-steps <n>` | Maximum steps per task (default: 100) |
| `--image <name>` | Use specific base image |
| `--platform <type>` | Platform type: `linux-docker`, `windows-qemu`, `android-qemu` |
-| `--vnc-port <port>` | Expose VNC on host port (for live viewing) |
-| `--api-port <port>` | Expose API on host port (for debugging) |
-| `--output-dir <dir>` | Output directory for results |
+| `--vnc-port <port>` | Expose VNC on host port (auto-allocated if not specified) |
+| `--api-port <port>` | Expose API on host port (auto-allocated if not specified) |
+| `--output-dir <dir>` | Output directory (default: `~/.local/share/cua-bench/runs/<run_id>/`) |
### Dataset Options
@@ -152,14 +160,18 @@ cb run dataset <path> [options]
### Examples
```bash
-# Run single task with oracle solution
-cb run task tasks/click_button --variant-id 0 --oracle
-
-# Run single task with agent evaluation
+# Run single task (async by default - returns immediately)
cb run task tasks/click_button --agent cua-agent --model anthropic/claude-sonnet-4-20250514
-# Run with VNC for live debugging (open http://localhost:8006)
-cb run task tasks/click_button --agent cua-agent --vnc-port 8006
+# Wait for task completion (synchronous)
+cb run task tasks/click_button --agent cua-agent --wait
+
+# Run with oracle solution
+cb run task tasks/click_button --variant-id 0 --oracle --wait
+
+# Auto-allocate debug ports for live viewing
+cb run task tasks/click_button --agent cua-agent --debug
+# Output shows: Auto-allocated debug ports: VNC=8006, API=5000
# Run Windows task with specific image
cb run task tasks/winarena --image windows-qemu --agent cua-agent
@@ -170,10 +182,12 @@ cb run dataset datasets/cua-bench-basic --agent cua-agent --max-parallel 4
# Run dataset with filtering
cb run dataset datasets/cua-bench-basic --task-filter "click*" --max-variants 1
-# Monitor runs
-cb run list
-cb run watch run-abc123
-cb run logs run-abc123
+# Monitor runs (async tasks)
+cb run list # List all runs
+cb run watch <run_id> # Watch progress in real-time
+cb run status <run_id> # Check status
+cb run logs <run_id> # View logs
+cb run stop <run_id> # Stop a run
```
## Interact Commands