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: fix broken links in new cuabench docs and rename CUA to Cua

f-trycuaa8c5a1221f3b
diff --git a/docs/content/docs/cua/guide/index.mdx b/docs/content/docs/cua/guide/index.mdx
index 5b8fc88992..c3a39ce0a6 100644
--- a/docs/content/docs/cua/guide/index.mdx
+++ b/docs/content/docs/cua/guide/index.mdx
@@ -39,21 +39,21 @@ With **Cua Agent Framework**, you can:
## Get Started
-Follow the [Quickstart guide](/get-started/quickstart) for step-by-step setup with Python or TypeScript.
+Follow the [Get Started guide](/cua/guide/get-started/what-is-cua) for step-by-step setup with Python or TypeScript.
Check out our [tutorials](https://cua.ai/blog), [examples](https://github.com/trycua/cua/tree/main/examples), and [notebooks](https://github.com/trycua/cua/tree/main/notebooks) to start building with Cua today.
<div className="grid grid-cols-2 md:grid-cols-4 gap-2 mt-4 text-sm">
- <Card icon={<Rocket className="w-4 h-4" />} href="/get-started/quickstart" title="Quickstart" />
- <Card icon={<Zap className="w-4 h-4" />} href="/docs/cua/guide/fundamentals/agent-loops" title="Agent Loops" />
+ <Card icon={<Rocket className="w-4 h-4" />} href="/cua/guide/get-started/what-is-cua" title="Get Started" />
+ <Card icon={<Zap className="w-4 h-4" />} href="/cua/guide/fundamentals/agent-loops" title="Agent Loops" />
<Card
icon={<BookOpen className="w-4 h-4" />}
- href="/docs/cua/reference/computer-sdk"
+ href="/cua/reference/computer-sdk"
title="Cua Computer"
/>
<Card
icon={<Monitor className="w-4 h-4" />}
- href="/example-usecases/form-filling"
+ href="/cua/examples/automation/form-filling"
title="Examples"
/>
</div>
diff --git a/docs/content/docs/cua/reference/cli-playbook/index.mdx b/docs/content/docs/cua/reference/cli-playbook/index.mdx
index f600cdce27..6e4d5c3777 100644
--- a/docs/content/docs/cua/reference/cli-playbook/index.mdx
+++ b/docs/content/docs/cua/reference/cli-playbook/index.mdx
@@ -60,4 +60,4 @@ cua stop my-sandbox
## Next Steps
-- [Command Reference](/cli-playbook/commands) - Full list of available commands
+- [Command Reference](/cua/reference/cli-playbook/commands) - Full list of available commands
diff --git a/docs/content/docs/cua/reference/mcp-server/client-integrations.mdx b/docs/content/docs/cua/reference/mcp-server/client-integrations.mdx
index a6d083b08e..e39287951e 100644
--- a/docs/content/docs/cua/reference/mcp-server/client-integrations.mdx
+++ b/docs/content/docs/cua/reference/mcp-server/client-integrations.mdx
@@ -120,4 +120,4 @@ All MCP clients can configure the server using environment variables:
- `CUA_MAX_IMAGES` - Maximum images to keep in context
- `CUA_USE_HOST_COMPUTER_SERVER` - Use host system instead of VM
-See the [Configuration](/docs/libraries/mcp-server/configuration) page for detailed configuration options.
+See the [Configuration](/cua/reference/mcp-server/configuration) page for detailed configuration options.
diff --git a/docs/content/docs/cua/reference/mcp-server/usage.mdx b/docs/content/docs/cua/reference/mcp-server/usage.mdx
index aba930ba9c..b329d2b645 100644
--- a/docs/content/docs/cua/reference/mcp-server/usage.mdx
+++ b/docs/content/docs/cua/reference/mcp-server/usage.mdx
@@ -82,7 +82,7 @@ Add the `CUA_USE_HOST_COMPUTER_SERVER` environment variable to your MCP client c
<Tabs items={['Claude Desktop', 'Other MCP Clients']}>
<Tab value="Claude Desktop">
- Update your Claude Desktop config (see [Installation](/docs/libraries/mcp-server/installation)) to include the environment variable:
+ Update your Claude Desktop config (see [Installation](/cua/reference/mcp-server/installation)) to include the environment variable:
```json
{
diff --git a/docs/content/docs/cuabench/guide/advanced/creating-private-tasks.mdx b/docs/content/docs/cuabench/guide/advanced/creating-private-tasks.mdx
index 926797ba8b..2218f39926 100644
--- a/docs/content/docs/cuabench/guide/advanced/creating-private-tasks.mdx
+++ b/docs/content/docs/cuabench/guide/advanced/creating-private-tasks.mdx
@@ -12,7 +12,7 @@ However, many agents are designed for more narrow use cases. The harness can sti
### Using the Wizard
```bash
-cb create-task tasks/my_custom_task
+cb task create tasks/my_custom_task
```
This starts an interactive wizard that guides you through the task creation process.
@@ -22,7 +22,7 @@ This starts an interactive wizard that guides you through the task creation proc
Use Claude Code to scaffold your starter environment:
```bash
-cb generate-task "discord clone with channels and messages" --output tasks/discord_clone
+cb task generate "discord clone with channels and messages" --output tasks/discord_clone
```
### Manual Creation
@@ -146,7 +146,7 @@ cb run --dataset-path tasks/my_custom_task,tasks/another_task --agent cua-agent
## Task Development Workflow
-1. **Create task structure** with `cb create-task` or `cb generate-task`
+1. **Create task structure** with `cb task create` or `cb task generate`
2. **Implement task logic** in `main.py` with async functions
3. **Test interactively** with `cb interact tasks/my_task`
4. **Validate oracle** with `cb interact tasks/my_task --oracle`
diff --git a/docs/content/docs/cuabench/guide/examples/custom-agent.mdx b/docs/content/docs/cuabench/guide/examples/custom-agent.mdx
new file mode 100644
index 0000000000..13dbe40000
--- /dev/null
+++ b/docs/content/docs/cuabench/guide/examples/custom-agent.mdx
@@ -0,0 +1,575 @@
+---
+title: Build a Custom Agent
+description: Create your own agent to solve computer-use tasks
+---
+
+In this tutorial, you'll build a custom agent that can interact with desktop environments. You'll start with a simple rule-based agent and progressively add intelligence.
+
+**Time:** ~20 minutes
+**Prerequisites:** cua-bench installed, basic Python knowledge
+
+## What You'll Build
+
+A custom agent that can:
+1. Take screenshots of the desktop
+2. Analyze what it sees
+3. Decide on actions (click, type, etc.)
+4. Execute those actions
+
+## Agent Architecture
+
+Every agent in cua-bench extends the `BaseAgent` class and implements the `perform_task()` method:
+
+```python
+from cua_bench.agents import BaseAgent, AgentResult
+
+class MyAgent(BaseAgent):
+ @staticmethod
+ def name() -> str:
+ return "my-agent"
+
+ async def perform_task(
+ self,
+ task_description: str,
+ session: DesktopSession,
+ logging_dir: Path | None = None,
+ ) -> AgentResult:
+ # Your agent logic here
+ pass
+```
+
+## Step 1: Scaffold the Agent
+
+Use the CLI to create the agent structure:
+
+```bash
+cb agent init my-agent --output-dir ./agents
+```
+
+This creates:
+```
+agents/
+├── __init__.py
+├── agent.py
+└── requirements.txt
+```
+
+## Step 2: Implement a Basic Agent
+
+Edit `agents/agent.py`:
+
+```python
+import cua_bench as cb
+from cua_bench.agents import BaseAgent, AgentResult, FailureMode
+from pathlib import Path
+
+
+class MyAgent(BaseAgent):
+ """A simple rule-based agent."""
+
+ @staticmethod
+ def name() -> str:
+ return "my-agent"
+
+ async def perform_task(
+ self,
+ task_description: str,
+ session: cb.DesktopSession,
+ logging_dir: Path | None = None,
+ ) -> AgentResult:
+ """Perform the task by taking screenshots and clicking."""
+
+ # Step 1: Take a screenshot
+ screenshot = await session.screenshot()
+
+ # Step 2: Simple strategy - click the center of the screen
+ # (We'll make this smarter later)
+ center_x = 256
+ center_y = 256
+
+ await session.execute_action(cb.ClickAction(x=center_x, y=center_y))
+
+ # Return result with token counts (for cost tracking)
+ return AgentResult(
+ total_input_tokens=0,
+ total_output_tokens=0,
+ failure_mode=FailureMode.NONE
+ )
+```
+
+This basic agent just clicks the center of the screen—not very smart, but it's a starting point!
+
+## Step 3: Register the Agent
+
+Create or edit `.cua/agents.yaml` in your project root:
+
+```yaml
+agents:
+ - name: my-agent
+ import_path: agents.agent:MyAgent
+ defaults:
+ max_steps: 20
+```
+
+## Step 4: Test the Agent
+
+Run the agent against a simple task:
+
+```bash
+# First, create a simple button task (from previous example)
+# Then run your agent against it
+
+cb run task tasks/my-button-task --agent my-agent
+```
+
+The agent will click the center—which probably won't hit the button. Let's make it smarter.
+
+## Step 5: Add Screenshot Analysis
+
+Now let's add actual intelligence. We'll use a simple approach: look for elements and click them.
+
+```python
+import cua_bench as cb
+from cua_bench.agents import BaseAgent, AgentResult, FailureMode
+from pathlib import Path
+import base64
+
+
+class MyAgent(BaseAgent):
+ """An agent that analyzes screenshots to find targets."""
+
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+ self.max_steps = kwargs.get("max_steps", 20)
+
+ @staticmethod
+ def name() -> str:
+ return "my-agent"
+
+ async def perform_task(
+ self,
+ task_description: str,
+ session: cb.DesktopSession,
+ logging_dir: Path | None = None,
+ ) -> AgentResult:
+ """Perform task with screenshot analysis."""
+
+ total_input_tokens = 0
+ total_output_tokens = 0
+
+ for step in range(self.max_steps):
+ # Take screenshot
+ screenshot_bytes = await session.screenshot()
+
+ # Save screenshot for debugging
+ if logging_dir:
+ screenshot_path = logging_dir / f"step_{step}.png"
+ screenshot_path.write_bytes(screenshot_bytes)
+
+ # Analyze and decide action
+ action = await self._decide_action(
+ task_description,
+ screenshot_bytes,
+ step
+ )
+
+ if action is None:
+ # Agent thinks task is complete
+ break
+
+ # Execute the action
+ await session.execute_action(action)
+
+ return AgentResult(
+ total_input_tokens=total_input_tokens,
+ total_output_tokens=total_output_tokens,
+ failure_mode=FailureMode.NONE
+ )
+
+ async def _decide_action(
+ self,
+ task_description: str,
+ screenshot: bytes,
+ step: int
+ ) -> cb.Action | None:
+ """Decide what action to take based on the screenshot."""
+
+ # For now, use a simple heuristic:
+ # Click slightly below center where buttons often are
+ if step == 0:
+ return cb.ClickAction(x=256, y=300)
+
+ # After first click, assume done
+ return None
+```
+
+## Step 6: Integrate with an LLM
+
+For real intelligence, integrate with a language model. Here's an example using Anthropic's Claude:
+
+```python
+import anthropic
+import cua_bench as cb
+from cua_bench.agents import BaseAgent, AgentResult, FailureMode
+from pathlib import Path
+import base64
+
+
+class MyAgent(BaseAgent):
+ """An LLM-powered agent."""
+
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+ self.model = kwargs.get("model", "claude-sonnet-4-20250514")
+ self.max_steps = kwargs.get("max_steps", 20)
+ self.client = anthropic.Anthropic()
+
+ @staticmethod
+ def name() -> str:
+ return "my-agent"
+
+ async def perform_task(
+ self,
+ task_description: str,
+ session: cb.DesktopSession,
+ logging_dir: Path | None = None,
+ ) -> AgentResult:
+ """Perform task using LLM for decisions."""
+
+ total_input_tokens = 0
+ total_output_tokens = 0
+
+ for step in range(self.max_steps):
+ # Take screenshot
+ screenshot_bytes = await session.screenshot()
+
+ # Ask LLM what to do
+ action, input_tokens, output_tokens = await self._ask_llm(
+ task_description,
+ screenshot_bytes
+ )
+
+ total_input_tokens += input_tokens
+ total_output_tokens += output_tokens
+
+ if action is None:
+ break
+
+ await session.execute_action(action)
+
+ return AgentResult(
+ total_input_tokens=total_input_tokens,
+ total_output_tokens=total_output_tokens,
+ failure_mode=FailureMode.NONE
+ )
+
+ async def _ask_llm(
+ self,
+ task_description: str,
+ screenshot: bytes
+ ) -> tuple[cb.Action | None, int, int]:
+ """Ask the LLM what action to take."""
+
+ # Encode screenshot as base64
+ screenshot_b64 = base64.standard_b64encode(screenshot).decode()
+
+ response = self.client.messages.create(
+ model=self.model,
+ max_tokens=1024,
+ messages=[{
+ "role": "user",
+ "content": [
+ {
+ "type": "image",
+ "source": {
+ "type": "base64",
+ "media_type": "image/png",
+ "data": screenshot_b64,
+ }
+ },
+ {
+ "type": "text",
+ "text": f"""Task: {task_description}
+
+Look at this screenshot and decide what action to take.
+
+Respond with ONE of:
+- CLICK x y (to click at coordinates)
+- TYPE text (to type text)
+- DONE (if task is complete)
+
+Example: CLICK 150 200"""
+ }
+ ]
+ }]
+ )
+
+ # Parse response
+ response_text = response.content[0].text.strip()
+ action = self._parse_action(response_text)
+
+ return (
+ action,
+ response.usage.input_tokens,
+ response.usage.output_tokens
+ )
+
+ def _parse_action(self, response: str) -> cb.Action | None:
+ """Parse LLM response into an action."""
+
+ if response.startswith("DONE"):
+ return None
+
+ if response.startswith("CLICK"):
+ parts = response.split()
+ if len(parts) >= 3:
+ x, y = int(parts[1]), int(parts[2])
+ return cb.ClickAction(x=x, y=y)
+
+ if response.startswith("TYPE"):
+ text = response[5:].strip()
+ return cb.TypeAction(text=text)
+
+ # Default: no action
+ return None
+```
+
+## Step 7: Run with Custom Model
+
+Update your agent registration to accept model configuration:
+
+```yaml
+agents:
+ - name: my-agent
+ import_path: agents.agent:MyAgent
+ defaults:
+ model: claude-sonnet-4-20250514
+ max_steps: 20
+```
+
+Then run:
+
+```bash
+export ANTHROPIC_API_KEY=sk-...
+cb run task tasks/my-button-task --agent my-agent
+```
+
+## Advanced: Build a Docker Image
+
+For production use, package your agent as a Docker image:
+
+### Create Dockerfile
+
+```dockerfile
+FROM python:3.11-slim
+
+WORKDIR /app
+
+# Install dependencies
+COPY requirements.txt .
+RUN pip install --no-cache-dir -r requirements.txt
+
+# Copy agent code
+COPY agents/ ./agents/
+
+# Set entrypoint
+ENTRYPOINT ["python", "-m", "agents.agent"]
+```
+
+### Build and Push
+
+```bash
+# Build
+docker build -t myregistry/my-agent:latest .
+
+# Push to registry
+cb agent push myregistry/my-agent:latest
+```
+
+### Register Docker Agent
+
+```yaml
+agents:
+ - name: my-agent-docker
+ image: myregistry/my-agent:latest
+ defaults:
+ model: claude-sonnet-4-20250514
+ max_steps: 50
+```
+
+## Available Actions
+
+Your agent can execute these actions via `session.execute_action()`:
+
+| Action | Description |
+|--------|-------------|
+| `ClickAction(x, y)` | Single click at coordinates |
+| `RightClickAction(x, y)` | Right-click |
+| `DoubleClickAction(x, y)` | Double-click |
+| `DragAction(from_x, from_y, to_x, to_y)` | Drag from one point to another |
+| `TypeAction(text)` | Type text |
+| `KeyAction(key)` | Press a single key (e.g., "return", "escape") |
+| `HotkeyAction(keys)` | Press key combination (e.g., ["ctrl", "c"]) |
+| `ScrollAction(direction, amount)` | Scroll up/down |
+| `WaitAction(seconds)` | Wait for a duration |
+
+## Complete Code
+
+<details>
+<summary>agents/agent.py (LLM-powered)</summary>
+
+```python
+import anthropic
+import cua_bench as cb
+from cua_bench.agents import BaseAgent, AgentResult, FailureMode
+from pathlib import Path
+import base64
+
+
+class MyAgent(BaseAgent):
+ """An LLM-powered computer-use agent."""
+
+ def __init__(self, **kwargs):
+ super().__init__(**kwargs)
+ self.model = kwargs.get("model", "claude-sonnet-4-20250514")
+ self.max_steps = kwargs.get("max_steps", 20)
+ self.client = anthropic.Anthropic()
+
+ @staticmethod
+ def name() -> str:
+ return "my-agent"
+
+ async def perform_task(
+ self,
+ task_description: str,
+ session: cb.DesktopSession,
+ logging_dir: Path | None = None,
+ ) -> AgentResult:
+ """Perform task using LLM for decisions."""
+
+ total_input_tokens = 0
+ total_output_tokens = 0
+
+ for step in range(self.max_steps):
+ screenshot_bytes = await session.screenshot()
+
+ if logging_dir:
+ (logging_dir / f"step_{step}.png").write_bytes(screenshot_bytes)
+
+ action, in_tokens, out_tokens = await self._ask_llm(
+ task_description, screenshot_bytes
+ )
+
+ total_input_tokens += in_tokens
+ total_output_tokens += out_tokens
+
+ if action is None:
+ break
+
+ await session.execute_action(action)
+
+ return AgentResult(
+ total_input_tokens=total_input_tokens,
+ total_output_tokens=total_output_tokens,
+ failure_mode=FailureMode.NONE
+ )
+
+ async def _ask_llm(
+ self, task_description: str, screenshot: bytes
+ ) -> tuple[cb.Action | None, int, int]:
+ """Ask the LLM what action to take."""
+
+ screenshot_b64 = base64.standard_b64encode(screenshot).decode()
+
+ response = self.client.messages.create(
+ model=self.model,
+ max_tokens=1024,
+ messages=[{
+ "role": "user",
+ "content": [
+ {
+ "type": "image",
+ "source": {
+ "type": "base64",
+ "media_type": "image/png",
+ "data": screenshot_b64,
+ }
+ },
+ {
+ "type": "text",
+ "text": f"""Task: {task_description}
+
+Look at this screenshot and decide what action to take.
+
+Respond with ONE of:
+- CLICK x y (to click at coordinates)
+- TYPE text (to type text)
+- KEY key (to press a key like "return")
+- DONE (if task is complete)
+
+Example: CLICK 150 200"""
+ }
+ ]
+ }]
+ )
+
+ response_text = response.content[0].text.strip()
+ action = self._parse_action(response_text)
+
+ return (action, response.usage.input_tokens, response.usage.output_tokens)
+
+ def _parse_action(self, response: str) -> cb.Action | None:
+ """Parse LLM response into an action."""
+
+ response = response.upper().strip()
+
+ if response.startswith("DONE"):
+ return None
+
+ if response.startswith("CLICK"):
+ parts = response.split()
+ if len(parts) >= 3:
+ return cb.ClickAction(x=int(parts[1]), y=int(parts[2]))
+
+ if response.startswith("TYPE"):
+ text = response[5:].strip()
+ return cb.TypeAction(text=text)
+
+ if response.startswith("KEY"):
+ key = response[4:].strip().lower()
+ return cb.KeyAction(key=key)
+
+ return None
+```
+
+</details>
+
+<details>
+<summary>.cua/agents.yaml</summary>
+
+```yaml
+agents:
+ - name: my-agent
+ import_path: agents.agent:MyAgent
+ defaults:
+ model: claude-sonnet-4-20250514
+ max_steps: 20
+```
+
+</details>
+
+<details>
+<summary>agents/requirements.txt</summary>
+
+```
+cua-bench
+anthropic>=0.20.0
+```
+
+</details>
+
+## Next Steps
+
+- Test your agent on [Native Linux Tasks](/cuabench/guide/examples/linux-native-task)
+- Learn about [Windows Native Tasks](/cuabench/guide/examples/windows-native-task)
+- See the [Custom Agents Guide](/cuabench/guide/advanced/custom-agents) for more details
diff --git a/docs/content/docs/cuabench/guide/examples/genai-task-generation.mdx b/docs/content/docs/cuabench/guide/examples/genai-task-generation.mdx
new file mode 100644
index 0000000000..c6e50ae351
--- /dev/null
+++ b/docs/content/docs/cuabench/guide/examples/genai-task-generation.mdx
@@ -0,0 +1,379 @@
+---
+title: Generate Tasks with AI
+description: Use Claude to create tasks from natural language descriptions
+---
+
+In this tutorial, you'll use AI to generate complete task environments from natural language descriptions. This is the fastest way to create new tasks.
+
+**Time:** ~10 minutes
+**Prerequisites:** Claude Code OAuth token
+
+## What You'll Build
+
+An AI-generated color picker task where the agent must select a specific color. You'll learn:
+
+- Using `cb task generate` to create tasks
+- Reviewing and understanding generated code
+- Iterating on AI-generated tasks
+- Manual refinement techniques
+
+## How It Works
+
+The `cb task generate` command:
+
+1. Creates a starter task template
+2. Launches Claude Code in interactive mode
+3. Claude modifies the template based on your description
+4. You review, test, and refine the result
+
+```
+┌──────────────────────────────────────────────────────────────┐
+│ cb task generate "Create a color picker..." │
+│ │ │
+│ ▼ │
+│ ┌────────────────────────────────────────────────────────┐ │
+│ │ Starter Template │ │
+│ │ ├── main.py (decorators) │ │
+│ │ ├── gui/index.html │ │
+│ │ └── pyproject.toml │ │
+│ └────────────────────────────────────────────────────────┘ │
+│ │ │
+│ ▼ │
+│ ┌────────────────────────────────────────────────────────┐ │
+│ │ Claude Code │ │
+│ │ Modifies template based on your prompt │ │
+│ └────────────────────────────────────────────────────────┘ │
+│ │ │
+│ ▼ │
+│ ┌────────────────────────────────────────────────────────┐ │
+│ │ Generated Task │ │
+│ │ ├── main.py (customized) │ │
+│ │ ├── gui/index.html (customized) │ │
+│ │ └── pyproject.toml (metadata) │ │
+│ └────────────────────────────────────────────────────────┘ │
+└──────────────────────────────────────────────────────────────┘
+```
+
+## Step 1: Set Up Authentication
+
+Get your Claude Code OAuth token and set it as an environment variable:
+
+```bash
+export CLAUDE_CODE_OAUTH_TOKEN=your-token-here
+```
+
+<Callout title="Getting a Token" type="info">
+ Contact your administrator or visit the Claude Code documentation to obtain an OAuth token.
+</Callout>
+
+## Step 2: Generate a Task
+
+Run the generate command with a description:
+
+```bash
+cb task generate "Create a color picker task where the user must select the color red from a palette of 6 colors"
+```
+
+Claude Code will start an interactive session. You'll see it:
+
+1. Read the starter template
+2. Modify `main.py` with task logic
+3. Create `gui/index.html` with the color picker UI
+4. Update `pyproject.toml` with metadata
+
+## Step 3: Review Generated Files
+
+After generation, examine the created files:
+
+```bash
+ls tasks/color-picker-env/
+# main.py gui/ pyproject.toml
+```
+
+### Generated main.py
+
+The generated `main.py` should look something like:
+
+```python
+import cua_bench as cb
+from pathlib import Path
+
+pid = None
+
[email protected]_config(split="train")
+def load():
+ return [
+ cb.Task(
+ description="Select the red color from the color palette.",
+ metadata={"target_color": "red"},
+ computer={
+ "provider": "simulated",
+ "setup_config": {
+ "os_type": "macos",
+ "width": 512,
+ "height": 512,
+ }
+ }
+ )
+ ]
+
+
[email protected]_task(split="train")
+async def start(task_cfg: cb.Task, session: cb.DesktopSession):
+ global pid
+ html_content = (Path(__file__).parent / "gui/index.html").read_text()
+ pid = await session.launch_window(
+ html=html_content,
+ title="Color Picker",
+ width=400,
+ height=300,
+ )
+
+
[email protected]_task(split="train")
+async def evaluate(task_cfg: cb.Task, session: cb.DesktopSession) -> list[float]:
+ global pid
+ if pid is None:
+ return [0.0]
+
+ selected = await session.execute_javascript(pid, "window.__selectedColor")
+ target = task_cfg.metadata.get("target_color", "red")
+
+ return [1.0] if selected == target else [0.0]
+
+
[email protected]_task(split="train")
+async def solve(task_cfg: cb.Task, session: cb.DesktopSession):
+ global pid
+ if pid is None:
+ return
+
+ await session.click_element(pid, '[data-color="red"]')
+```
+
+### Generated gui/index.html
+
+```html
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body {
+ font-family: system-ui;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 20px;
+ }
+
+ h2 { margin-bottom: 20px; }
+
+ .palette {
+ display: grid;
+ grid-template-columns: repeat(3, 1fr);
+ gap: 10px;
+ }
+
+ .color-box {
+ width: 80px;
+ height: 80px;
+ border: 3px solid #ccc;
+ border-radius: 8px;
+ cursor: pointer;
+ }
+
+ .color-box:hover { transform: scale(1.05); }
+ .color-box.selected { border-color: #000; }
+ </style>
+</head>
+<body>
+ <h2>Select the red color</h2>
+ <div class="palette">
+ <div class="color-box" data-color="red" style="background: #e74c3c;"></div>
+ <div class="color-box" data-color="blue" style="background: #3498db;"></div>
+ <div class="color-box" data-color="green" style="background: #2ecc71;"></div>
+ <div class="color-box" data-color="yellow" style="background: #f1c40f;"></div>
+ <div class="color-box" data-color="purple" style="background: #9b59b6;"></div>
+ <div class="color-box" data-color="orange" style="background: #e67e22;"></div>
+ </div>
+
+ <script>
+ window.__selectedColor = null;
+
+ document.querySelectorAll('.color-box').forEach(box => {
+ box.addEventListener('click', function() {
+ document.querySelectorAll('.color-box').forEach(b =>
+ b.classList.remove('selected')
+ );
+ this.classList.add('selected');
+ window.__selectedColor = this.dataset.color;
+ });
+ });
+ </script>
+</body>
+</html>
+```
+
+## Step 4: Test the Generated Task
+
+### Run Interactively
+
+```bash
+cb interact tasks/color-picker-env --variant-id 0
+```
+
+Try clicking different colors and see how the UI responds.
+
+### Run Oracle
+
+```bash
+cb run task tasks/color-picker-env --oracle
+```
+
+### Run with Agent
+
+```bash
+cb run task tasks/color-picker-env --agent cua-agent --model anthropic/claude-sonnet-4-20250514
+```
+
+## Step 5: Iterate on the Task
+
+If the generated task isn't quite right, you can:
+
+### Option A: Regenerate with Better Prompt
+
+```bash
+cb task generate "Create a color picker with 9 colors in a 3x3 grid. The target color should be randomly selected from the palette. Show the target color name prominently above the grid."
+```
+
+### Option B: Continue in Claude Code
+
+Run the generate command again and ask Claude to modify:
+
+```bash
+cb task generate "Modify the existing color picker to add a timer that gives bonus points for fast selections"
+```
+
+### Option C: Manual Refinement
+
+Edit the generated files directly:
+
+```python
+# Add more task variants
[email protected]_config(split="train")
+def load():
+ colors = ["red", "blue", "green", "yellow", "purple", "orange"]
+
+ return [
+ cb.Task(
+ description=f"Select the {color} color from the palette.",
+ metadata={"target_color": color},
+ computer={...}
+ )
+ for color in colors
+ ]
+```
+
+## Step 6: Generate More Complex Tasks
+
+### Multi-Step Task
+
+```bash
+cb task generate "Create a todo list app where the user must:
+1. Add a task called 'Buy groceries'
+2. Mark it as complete
+3. Delete the task
+Track which steps are completed for partial rewards."
+```
+
+### Form-Based Task
+
+```bash
+cb task generate "Create a registration form with fields for name, email, and password.
+The agent must fill in the form with valid data and submit it.
+Validate that email contains @ and password is at least 8 characters."
+```
+
+### Game Task
+
+```bash
+cb task generate "Create a simple memory card matching game with 8 cards (4 pairs).
+The agent must match all pairs. Give partial reward based on number of pairs found."
+```
+
+## Tips for Good Prompts
+
+### Be Specific
+
+```bash
+# Good
+cb task generate "Create a dropdown menu with 5 options (Apple, Banana, Cherry, Date, Elderberry). The agent must select 'Cherry'."
+
+# Too vague
+cb task generate "Create a dropdown task"
+```
+
+### Include Success Criteria
+
+```bash
+# Good
+cb task generate "Create a slider that goes from 0 to 100. The agent must set it to exactly 75. Give reward of 1.0 for exact match, 0.5 for within 5 points."
+
+# Missing criteria
+cb task generate "Create a slider task"
+```
+
+### Specify Visual Requirements
+
+```bash
+# Good
+cb task generate "Create a dark-themed calculator with large buttons (at least 50x50 pixels) and clear labels."
+
+# No visual guidance
+cb task generate "Create a calculator"
+```
+
+## What Claude Can and Can't Do
+
+### Claude CAN:
+
+- Create HTML/CSS/JavaScript UIs
+- Implement game logic
+- Write evaluation functions
+- Create multiple task variants
+- Add partial reward calculations
+
+### Claude CANNOT:
+
+- Access external APIs at generation time
+- Create native application tasks (use templates for those)
+- Generate images (use placeholder colors/text)
+- Test the task (you need to do this)
+
+## Complete Workflow Example
+
+```bash
+# 1. Generate initial task
+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
+
+# 3. Verify oracle works
+cb run task tasks/python-quiz-env --oracle
+
+# 4. Test with agent
+cb run task tasks/python-quiz-env --agent cua-agent
+
+# 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
+```
+
+## Next Steps
+
+- Learn about [Task Structure](/cuabench/guide/fundamentals/tasks) in depth
+- Explore [OS Themes](/cuabench/guide/fundamentals/os-themes) for visual variants
+- See [Creating Private Tasks](/cuabench/guide/advanced/creating-private-tasks) for advanced patterns
diff --git a/docs/content/docs/cuabench/guide/examples/linux-native-task.mdx b/docs/content/docs/cuabench/guide/examples/linux-native-task.mdx
new file mode 100644
index 0000000000..025653a1ae
--- /dev/null
+++ b/docs/content/docs/cuabench/guide/examples/linux-native-task.mdx
@@ -0,0 +1,396 @@
+---
+title: Native Linux Task
+description: Create a task that runs in a real Linux desktop environment
+---
+
+In this tutorial, you'll create a task that runs in a real Linux desktop (XFCE) inside a Docker container. Native tasks let you test agents against real applications, file systems, and network access.
+
+**Time:** ~15 minutes
+**Prerequisites:** Docker running
+
+## What You'll Build
+
+A task where the agent must open the calculator app and perform a calculation. You'll learn:
+
+- When to use native vs simulated tasks
+- Creating and managing Linux images
+- Writing tasks that use screen coordinates
+- Working with real desktop applications
+
+## When to Use Native Tasks
+
+| Use Native Tasks When... | Use Simulated Tasks When... |
+|--------------------------|----------------------------|
+| Testing real applications | Rapid prototyping |
+| File system operations needed | Web-app testing |
+| Network access required | Don't have Docker/KVM |
+| Production benchmarking | Fast iteration |
+
+## Step 1: Create the Linux Image
+
+First, create a base Linux image:
+
+```bash
+cb image create linux-docker
+```
+
+This pulls the `trycua/cua-xfce` Docker image (~1 minute).
+
+## Step 2: Explore the Environment
+
+Start an interactive shell to explore:
+
+```bash
+cb image shell linux-docker
+```
+
+Open `http://localhost:8006` in your browser. You'll see an XFCE desktop with:
+- File manager
+- Terminal
+- Calculator (galculator)
+- Text editor
+- Web browser
+
+Press `Ctrl+C` to stop when done exploring.
+
+## Step 3: Create Task Directory
+
+```bash
+mkdir -p tasks/linux-calc
+cd tasks/linux-calc
+```
+
+## Step 4: Create the Task Configuration
+
+Create `main.py`:
+
+```python
+import cua_bench as cb
+from pathlib import Path
+
[email protected]_config(split="train")
+def load():
+ """Define calculator task variants."""
+ return [
+ cb.Task(
+ description="Open the calculator app and compute 7 + 5. The result should show 12.",
+ metadata={
+ "operation": "7 + 5",
+ "expected_result": "12"
+ },
+ computer={
+ "provider": "native",
+ "setup_config": {
+ "os_type": "linux",
+ "width": 1024,
+ "height": 768,
+ }
+ }
+ )
+ ]
+
+
[email protected]_task(split="train")
+async def start(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Initialize the desktop environment."""
+ # For native tasks, the desktop is already running
+ # We just need to ensure a clean state
+
+ # Wait for desktop to be ready
+ await session.execute_action(cb.WaitAction(seconds=2.0))
+
+
[email protected]_task(split="train")
+async def evaluate(task_cfg: cb.Task, session: cb.DesktopSession) -> list[float]:
+ """Check if the calculation was performed correctly."""
+
+ # Take a screenshot and check for the result
+ # In production, you'd use OCR or other methods
+ # For now, we'll use a simple heuristic
+
+ screenshot = await session.screenshot()
+
+ # Save for debugging
+ Path("debug_screenshot.png").write_bytes(screenshot)
+
+ # For a real implementation, you'd analyze the screenshot
+ # to verify the calculator shows "12"
+
+ # Placeholder: assume success if we got this far
+ return [1.0]
+
+
[email protected]_task(split="train")
+async def solve(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Demonstrate the solution using screen coordinates."""
+
+ # Step 1: Open the applications menu
+ # Click on the applications menu (top-left corner in XFCE)
+ await session.execute_action(cb.ClickAction(x=50, y=30))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+
+ # Step 2: Navigate to Accessories > Calculator
+ # These coordinates depend on the menu layout
+ await session.execute_action(cb.ClickAction(x=100, y=150)) # Accessories
+ await session.execute_action(cb.WaitAction(seconds=0.3))
+ await session.execute_action(cb.ClickAction(x=250, y=200)) # Calculator
+ await session.execute_action(cb.WaitAction(seconds=1.0))
+
+ # Step 3: Click calculator buttons
+ # Note: Coordinates depend on where the calculator window opens
+ # You'll need to adjust these for your setup
+
+ # Click "7"
+ await session.execute_action(cb.ClickAction(x=520, y=450))
+ await session.execute_action(cb.WaitAction(seconds=0.2))
+
+ # Click "+"
+ await session.execute_action(cb.ClickAction(x=620, y=450))
+ await session.execute_action(cb.WaitAction(seconds=0.2))
+
+ # Click "5"
+ await session.execute_action(cb.ClickAction(x=520, y=500))
+ await session.execute_action(cb.WaitAction(seconds=0.2))
+
+ # Click "="
+ await session.execute_action(cb.ClickAction(x=620, y=550))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+```
+
+## Step 5: Add Task Metadata
+
+Create `pyproject.toml`:
+
+```toml
+[project]
+name = "linux-calc"
+version = "0.1.0"
+
+[tool.cua-bench]
+description = "Use calculator app in Linux desktop"
+difficulty = "medium"
+category = "desktop"
+tags = ["linux", "native", "calculator", "app"]
+```
+
+## Step 6: Find Accurate Coordinates
+
+The coordinates above are approximations. To find accurate coordinates:
+
+1. Start an interactive session:
+ ```bash
+ cb image shell linux-docker
+ ```
+
+2. Open the calculator manually and note the window position
+
+3. Use browser developer tools or a screenshot tool to find exact pixel coordinates
+
+4. Update your `solve()` function with the correct coordinates
+
+<Callout title="Tip" type="info">
+ For more robust solutions, consider using keyboard shortcuts instead of clicking menus. For example, many Linux desktops support `Alt+F2` to open a run dialog.
+</Callout>
+
+## Step 7: Alternative Approach Using Keyboard
+
+A more reliable approach uses keyboard shortcuts:
+
+```python
[email protected]_task(split="train")
+async def solve(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Use keyboard shortcuts for more reliable automation."""
+
+ # Open run dialog with Alt+F2
+ await session.execute_action(cb.HotkeyAction(keys=["alt", "F2"]))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+
+ # Type calculator command
+ await session.execute_action(cb.TypeAction(text="galculator"))
+ await session.execute_action(cb.WaitAction(seconds=0.3))
+
+ # Press Enter to launch
+ await session.execute_action(cb.KeyAction(key="Return"))
+ await session.execute_action(cb.WaitAction(seconds=1.0))
+
+ # Type the calculation (calculator accepts keyboard input)
+ await session.execute_action(cb.TypeAction(text="7+5"))
+ await session.execute_action(cb.WaitAction(seconds=0.2))
+
+ # Press Enter for result
+ await session.execute_action(cb.KeyAction(key="Return"))
+```
+
+## Step 8: Run the Task
+
+### Run Interactively
+
+```bash
+cb interact tasks/linux-calc --platform linux-docker --variant-id 0
+```
+
+Watch the desktop in your browser while the oracle runs.
+
+### Run with Oracle
+
+```bash
+cb run task tasks/linux-calc --platform linux-docker --oracle
+```
+
+### Run with Agent
+
+```bash
+cb run task tasks/linux-calc --platform linux-docker --agent cua-agent --model anthropic/claude-sonnet-4-20250514
+```
+
+## Adding Complexity
+
+### Multiple Operations
+
+```python
[email protected]_config(split="train")
+def load():
+ operations = [
+ ("7 + 5", "12"),
+ ("10 - 3", "7"),
+ ("6 * 4", "24"),
+ ("15 / 3", "5"),
+ ]
+
+ return [
+ cb.Task(
+ description=f"Open calculator and compute {op}. Result should be {result}.",
+ metadata={"operation": op, "expected_result": result},
+ computer={
+ "provider": "native",
+ "setup_config": {"os_type": "linux", "width": 1024, "height": 768}
+ }
+ )
+ for op, result in operations
+ ]
+```
+
+### Multi-Step Workflow
+
+Create a more complex task involving multiple apps:
+
+```python
[email protected]_config(split="train")
+def load():
+ return [
+ cb.Task(
+ description="""
+ 1. Open the text editor
+ 2. Type "Hello, World!"
+ 3. Save the file as "greeting.txt" on the Desktop
+ """,
+ metadata={"filename": "greeting.txt", "content": "Hello, World!"},
+ computer={
+ "provider": "native",
+ "setup_config": {"os_type": "linux", "width": 1024, "height": 768}
+ }
+ )
+ ]
+```
+
+## Key Differences from Simulated Tasks
+
+| Aspect | Simulated | Native |
+|--------|-----------|--------|
+| **Startup time** | ~2 seconds | ~60 seconds |
+| **Element selection** | CSS selectors | Screen coordinates |
+| **JavaScript access** | Yes (`execute_javascript`) | No |
+| **Real applications** | No | Yes |
+| **File system** | No | Yes |
+| **Network** | Limited | Full |
+
+## Complete Code
+
+<details>
+<summary>main.py (complete)</summary>
+
+```python
+import cua_bench as cb
+from pathlib import Path
+
+
[email protected]_config(split="train")
+def load():
+ """Define calculator task variants."""
+ return [
+ cb.Task(
+ description="Open the calculator app and compute 7 + 5. The result should show 12.",
+ metadata={
+ "operation": "7 + 5",
+ "expected_result": "12"
+ },
+ computer={
+ "provider": "native",
+ "setup_config": {
+ "os_type": "linux",
+ "width": 1024,
+ "height": 768,
+ }
+ }
+ )
+ ]
+
+
[email protected]_task(split="train")
+async def start(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Initialize the desktop environment."""
+ await session.execute_action(cb.WaitAction(seconds=2.0))
+
+
[email protected]_task(split="train")
+async def evaluate(task_cfg: cb.Task, session: cb.DesktopSession) -> list[float]:
+ """Check if the calculation was performed correctly."""
+ screenshot = await session.screenshot()
+ Path("debug_screenshot.png").write_bytes(screenshot)
+
+ # In production, use OCR to verify the result
+ return [1.0]
+
+
[email protected]_task(split="train")
+async def solve(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Demonstrate the solution using keyboard shortcuts."""
+
+ # Open run dialog
+ await session.execute_action(cb.HotkeyAction(keys=["alt", "F2"]))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+
+ # Launch calculator
+ await session.execute_action(cb.TypeAction(text="galculator"))
+ await session.execute_action(cb.KeyAction(key="Return"))
+ await session.execute_action(cb.WaitAction(seconds=1.0))
+
+ # Type calculation
+ await session.execute_action(cb.TypeAction(text="7+5"))
+ await session.execute_action(cb.KeyAction(key="Return"))
+```
+
+</details>
+
+<details>
+<summary>pyproject.toml</summary>
+
+```toml
+[project]
+name = "linux-calc"
+version = "0.1.0"
+
+[tool.cua-bench]
+description = "Use calculator app in Linux desktop"
+difficulty = "medium"
+category = "desktop"
+tags = ["linux", "native", "calculator", "app"]
+```
+
+</details>
+
+## Next Steps
+
+- [Create a Windows Native Task](/cuabench/guide/examples/windows-native-task) for Windows 11
+- Learn about [Native Tasks](/cuabench/guide/fundamentals/native-tasks) in depth
+- See the [CLI Reference](/cuabench/reference/cli-reference) for all run options
diff --git a/docs/content/docs/cuabench/guide/examples/meta.json b/docs/content/docs/cuabench/guide/examples/meta.json
new file mode 100644
index 0000000000..656d75dd47
--- /dev/null
+++ b/docs/content/docs/cuabench/guide/examples/meta.json
@@ -0,0 +1,12 @@
+{
+ "title": "Examples",
+ "description": "Step-by-step tutorials for common workflows",
+ "icon": "Blocks",
+ "pages": [
+ "simulated-task",
+ "genai-task-generation",
+ "custom-agent",
+ "linux-native-task",
+ "windows-native-task"
+ ]
+}
diff --git a/docs/content/docs/cuabench/guide/examples/simulated-task.mdx b/docs/content/docs/cuabench/guide/examples/simulated-task.mdx
new file mode 100644
index 0000000000..b31d43ddd8
--- /dev/null
+++ b/docs/content/docs/cuabench/guide/examples/simulated-task.mdx
@@ -0,0 +1,480 @@
+---
+title: Create a Simulated Task
+description: Build a button-click task from scratch in an HTML/CSS virtual desktop
+---
+
+In this tutorial, you'll create a complete simulated task that tests an agent's ability to click a button. Simulated tasks run in a lightweight HTML/CSS virtual desktop—no Docker or KVM required.
+
+**Time:** ~10 minutes
+**Prerequisites:** cua-bench installed
+
+## What You'll Build
+
+A task where the agent must click a "Submit" button on a simulated desktop. You'll learn:
+
+- Task configuration with `@cb.tasks_config`
+- Environment setup with `@cb.setup_task`
+- Reward evaluation with `@cb.evaluate_task`
+- Oracle solutions with `@cb.solve_task`
+
+## Step 1: Create Task Directory
+
+```bash
+mkdir -p tasks/my-button-task/gui
+cd tasks/my-button-task
+```
+
+## Step 2: Create the Task Configuration
+
+Create `main.py` with the task configuration:
+
+```python
+import cua_bench as cb
+from pathlib import Path
+
+# Global variable to track the window
+pid = None
+
[email protected]_config(split="train")
+def load():
+ """Define task variants."""
+ return [
+ cb.Task(
+ description='Click the "Submit" button on the page.',
+ metadata={"button_text": "Submit"},
+ computer={
+ "provider": "simulated",
+ "setup_config": {
+ "os_type": "macos",
+ "width": 512,
+ "height": 512,
+ "background": "#c0c0c0"
+ }
+ }
+ )
+ ]
+```
+
+This creates a single task variant with:
+- A clear description for the agent
+- Metadata to customize the button text
+- A simulated macOS-style desktop (512x512 pixels)
+
+## Step 3: Add Environment Setup
+
+Add the setup function to initialize the task:
+
+```python
[email protected]_task(split="train")
+async def start(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Initialize the task environment."""
+ global pid
+
+ # Load HTML content
+ html_content = (Path(__file__).parent / "gui/index.html").read_text()
+
+ # Launch window with the task UI
+ pid = await session.launch_window(
+ html=html_content,
+ title="Button Task",
+ x=100,
+ y=100,
+ width=300,
+ height=200,
+ )
+```
+
+## Step 4: Add Reward Evaluation
+
+Add the evaluation function to check if the agent succeeded:
+
+```python
[email protected]_task(split="train")
+async def evaluate(task_cfg: cb.Task, session: cb.DesktopSession) -> list[float]:
+ """Return reward based on task completion."""
+ global pid
+
+ if pid is None:
+ return [0.0]
+
+ # Check if button was clicked via JavaScript state
+ clicked = await session.execute_javascript(pid, "window.__clicked")
+
+ return [1.0] if clicked is True else [0.0]
+```
+
+## Step 5: Add Oracle Solution
+
+Add the oracle (baseline solution) that demonstrates how to solve the task:
+
+```python
[email protected]_task(split="train")
+async def solve(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Demonstrate the solution."""
+ global pid
+
+ if pid is None:
+ return
+
+ # Click the button by CSS selector (simulated environments only)
+ await session.click_element(pid, "#submit-btn")
+```
+
+## Step 6: Create the HTML Interface
+
+Create `gui/index.html`:
+
+```html
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body {
+ font-family: -apple-system, BlinkMacSystemFont, sans-serif;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ height: 100vh;
+ margin: 0;
+ background: #f5f5f5;
+ }
+
+ h1 {
+ font-size: 18px;
+ color: #333;
+ margin-bottom: 20px;
+ }
+
+ #submit-btn {
+ padding: 12px 32px;
+ font-size: 16px;
+ background: #007AFF;
+ color: white;
+ border: none;
+ border-radius: 8px;
+ cursor: pointer;
+ transition: background 0.2s;
+ }
+
+ #submit-btn:hover {
+ background: #0056b3;
+ }
+
+ #submit-btn.clicked {
+ background: #28a745;
+ }
+ </style>
+</head>
+<body>
+ <h1>Click the button below</h1>
+ <button id="submit-btn">Submit</button>
+
+ <script>
+ // Track whether button was clicked
+ window.__clicked = false;
+
+ document.getElementById('submit-btn').addEventListener('click', function() {
+ window.__clicked = true;
+ this.textContent = 'Clicked!';
+ this.classList.add('clicked');
+ });
+ </script>
+</body>
+</html>
+```
+
+## Step 7: Add Task Metadata
+
+Create `pyproject.toml`:
+
+```toml
+[project]
+name = "my-button-task"
+version = "0.1.0"
+
+[tool.cua-bench]
+description = "Click a submit button"
+difficulty = "easy"
+category = "grounding"
+tags = ["grounding", "click", "button"]
+```
+
+## Step 8: Run the Task
+
+### Run Interactively
+
+See the task in a browser window:
+
+```bash
+cb interact tasks/my-button-task --variant-id 0
+```
+
+A browser window will open showing the simulated desktop. Try clicking the button yourself!
+
+### Run with Oracle Solution
+
+Verify the oracle works:
+
+```bash
+cb run task tasks/my-button-task --oracle
+```
+
+You should see output like:
+```
+✓ Task completed
+Reward: 1.0
+```
+
+### Run with an Agent
+
+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
+```
+
+## Adding Complexity
+
+### Multiple Button Variants
+
+Modify `load()` to generate multiple variants:
+
+```python
[email protected]_config(split="train")
+def load():
+ """Generate multiple task variants."""
+ buttons = ["Submit", "OK", "Continue", "Next"]
+
+ return [
+ cb.Task(
+ description=f'Click the "{btn}" button on the page.',
+ metadata={"button_text": btn},
+ computer={
+ "provider": "simulated",
+ "setup_config": {
+ "os_type": "macos",
+ "width": 512,
+ "height": 512,
+ }
+ }
+ )
+ for btn in buttons
+ ]
+```
+
+Then update your HTML to use the metadata:
+
+```python
[email protected]_task(split="train")
+async def start(task_cfg: cb.Task, session: cb.DesktopSession):
+ global pid
+
+ button_text = task_cfg.metadata.get("button_text", "Submit")
+
+ html_content = f"""
+ <!DOCTYPE html>
+ <html>
+ <head>...</head>
+ <body>
+ <h1>Click the button below</h1>
+ <button id="submit-btn">{button_text}</button>
+ <script>
+ window.__clicked = false;
+ document.getElementById('submit-btn').addEventListener('click', function() {{
+ window.__clicked = true;
+ }});
+ </script>
+ </body>
+ </html>
+ """
+
+ pid = await session.launch_window(html=html_content, ...)
+```
+
+### Different Themes
+
+Use the `os_type` setting for different visual styles:
+
+```python
[email protected]_config(split="train")
+def load():
+ themes = ["macos", "win11", "linux"]
+
+ return [
+ cb.Task(
+ description='Click the "Submit" button.',
+ metadata={"theme": theme},
+ computer={
+ "provider": "simulated",
+ "setup_config": {
+ "os_type": theme,
+ "width": 512,
+ "height": 512,
+ }
+ }
+ )
+ for theme in themes
+ ]
+```
+
+## Complete Code
+
+<details>
+<summary>main.py (complete)</summary>
+
+```python
+import cua_bench as cb
+from pathlib import Path
+
+pid = None
+
[email protected]_config(split="train")
+def load():
+ """Define task variants."""
+ return [
+ cb.Task(
+ description='Click the "Submit" button on the page.',
+ metadata={"button_text": "Submit"},
+ computer={
+ "provider": "simulated",
+ "setup_config": {
+ "os_type": "macos",
+ "width": 512,
+ "height": 512,
+ "background": "#c0c0c0"
+ }
+ }
+ )
+ ]
+
+
[email protected]_task(split="train")
+async def start(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Initialize the task environment."""
+ global pid
+
+ html_content = (Path(__file__).parent / "gui/index.html").read_text()
+
+ pid = await session.launch_window(
+ html=html_content,
+ title="Button Task",
+ x=100,
+ y=100,
+ width=300,
+ height=200,
+ )
+
+
[email protected]_task(split="train")
+async def evaluate(task_cfg: cb.Task, session: cb.DesktopSession) -> list[float]:
+ """Return reward based on task completion."""
+ global pid
+
+ if pid is None:
+ return [0.0]
+
+ clicked = await session.execute_javascript(pid, "window.__clicked")
+ return [1.0] if clicked is True else [0.0]
+
+
[email protected]_task(split="train")
+async def solve(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Demonstrate the solution."""
+ global pid
+
+ if pid is None:
+ return
+
+ await session.click_element(pid, "#submit-btn")
+```
+
+</details>
+
+<details>
+<summary>gui/index.html (complete)</summary>
+
+```html
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body {
+ font-family: -apple-system, BlinkMacSystemFont, sans-serif;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ height: 100vh;
+ margin: 0;
+ background: #f5f5f5;
+ }
+
+ h1 {
+ font-size: 18px;
+ color: #333;
+ margin-bottom: 20px;
+ }
+
+ #submit-btn {
+ padding: 12px 32px;
+ font-size: 16px;
+ background: #007AFF;
+ color: white;
+ border: none;
+ border-radius: 8px;
+ cursor: pointer;
+ transition: background 0.2s;
+ }
+
+ #submit-btn:hover {
+ background: #0056b3;
+ }
+
+ #submit-btn.clicked {
+ background: #28a745;
+ }
+ </style>
+</head>
+<body>
+ <h1>Click the button below</h1>
+ <button id="submit-btn">Submit</button>
+
+ <script>
+ window.__clicked = false;
+
+ document.getElementById('submit-btn').addEventListener('click', function() {
+ window.__clicked = true;
+ this.textContent = 'Clicked!';
+ this.classList.add('clicked');
+ });
+ </script>
+</body>
+</html>
+```
+
+</details>
+
+<details>
+<summary>pyproject.toml (complete)</summary>
+
+```toml
+[project]
+name = "my-button-task"
+version = "0.1.0"
+
+[tool.cua-bench]
+description = "Click a submit button"
+difficulty = "easy"
+category = "grounding"
+tags = ["grounding", "click", "button"]
+```
+
+</details>
+
+## Next Steps
+
+- [Build a Custom Agent](/cuabench/guide/examples/custom-agent) to solve this task
+- [Create a Native Linux Task](/cuabench/guide/examples/linux-native-task) for real applications
+- Learn about [OS Themes](/cuabench/guide/fundamentals/os-themes) for visual variants
diff --git a/docs/content/docs/cuabench/guide/examples/windows-native-task.mdx b/docs/content/docs/cuabench/guide/examples/windows-native-task.mdx
new file mode 100644
index 0000000000..687f8f184f
--- /dev/null
+++ b/docs/content/docs/cuabench/guide/examples/windows-native-task.mdx
@@ -0,0 +1,455 @@
+---
+title: Native Windows Task
+description: Create a task that runs in a Windows 11 virtual machine
+---
+
+In this tutorial, you'll create a task that runs in a full Windows 11 virtual machine. This is the foundation for Windows Arena-style benchmarks.
+
+**Time:** ~2 hours (image creation) + 15 minutes (task)
+**Prerequisites:** x86_64 Linux with KVM support
+
+<Callout title="Requirements" type="warn">
+ Windows QEMU requires:
+ - x86_64 Linux host (not macOS or ARM)
+ - KVM enabled (`/dev/kvm` accessible)
+ - For cloud VMs: nested virtualization enabled
+ - ~64GB disk space for the Windows image
+</Callout>
+
+## What You'll Build
+
+A task where the agent must open Notepad, type a message, and save the file. You'll learn:
+
+- Creating Windows 11 images (basic and with apps)
+- Writing tasks for Windows applications
+- Windows-specific considerations (app launch times, coordinates)
+
+## Step 1: Create Windows Image
+
+You have two options for creating the base image:
+
+### Option A: Basic Windows Image
+
+```bash
+# Download Windows 11 ISO and create base image (~1-2 hours)
+cb image create windows-qemu --download-iso
+```
+
+This creates a clean Windows 11 installation.
+
+### Option B: Windows with Pre-installed Apps
+
+```bash
+# Create image with common apps pre-installed
+cb image create windows-qemu --download-iso --apps chrome,notepad++,vscode
+```
+
+Available apps: `chrome`, `firefox`, `notepad++`, `vscode`, `vlc`, `libreoffice`, `7zip`, `gimp`
+
+<Callout title="Monitor Progress" type="info">
+ During image creation, monitor progress at `http://localhost:8006` (VNC). You can also watch logs:
+ ```bash
+ docker logs -f cua-setup-windows
+ ```
+</Callout>
+
+## Step 2: Verify the Image
+
+After creation, verify the image works:
+
+```bash
+cb image shell windows-qemu
+```
+
+Open `http://localhost:8006` in your browser. You should see the Windows 11 desktop.
+
+- Try opening Notepad: `Win + R`, type `notepad`, press Enter
+- Navigate the Start menu
+- Note the screen resolution and UI element positions
+
+Press `Ctrl+C` to stop when done.
+
+## Step 3: Create Task Directory
+
+```bash
+mkdir -p tasks/win-notepad
+cd tasks/win-notepad
+```
+
+## Step 4: Create the Task Configuration
+
+Create `main.py`:
+
+```python
+import cua_bench as cb
+from pathlib import Path
+
+
[email protected]_config(split="train")
+def load():
+ """Define Notepad task variants."""
+ return [
+ cb.Task(
+ description="""
+ Open Notepad and type "Hello from Cua-Bench!".
+ Then save the file as "greeting.txt" on the Desktop.
+ """,
+ metadata={
+ "content": "Hello from Cua-Bench!",
+ "filename": "greeting.txt",
+ "save_location": "Desktop"
+ },
+ computer={
+ "provider": "native",
+ "setup_config": {
+ "os_type": "windows",
+ "width": 1920,
+ "height": 1080,
+ }
+ }
+ )
+ ]
+
+
[email protected]_task(split="train")
+async def start(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Initialize the Windows environment."""
+ # Wait for Windows to be fully ready
+ # Windows VMs need more startup time than Linux
+ await session.execute_action(cb.WaitAction(seconds=5.0))
+
+
[email protected]_task(split="train")
+async def evaluate(task_cfg: cb.Task, session: cb.DesktopSession) -> list[float]:
+ """Check if the file was created correctly."""
+
+ # Take screenshot for debugging
+ screenshot = await session.screenshot()
+ Path("debug_screenshot.png").write_bytes(screenshot)
+
+ # In production, you would:
+ # 1. Check if file exists on Desktop
+ # 2. Verify file contents
+ # For now, return placeholder
+
+ return [1.0]
+
+
[email protected]_task(split="train")
+async def solve(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Demonstrate the solution."""
+
+ content = task_cfg.metadata.get("content", "Hello!")
+ filename = task_cfg.metadata.get("filename", "file.txt")
+
+ # Step 1: Open Run dialog
+ await session.execute_action(cb.HotkeyAction(keys=["win", "r"]))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+
+ # Step 2: Launch Notepad
+ await session.execute_action(cb.TypeAction(text="notepad"))
+ await session.execute_action(cb.KeyAction(key="Return"))
+ await session.execute_action(cb.WaitAction(seconds=2.0)) # Windows apps are slower
+
+ # Step 3: Type content
+ await session.execute_action(cb.TypeAction(text=content))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+
+ # Step 4: Save file (Ctrl+S)
+ await session.execute_action(cb.HotkeyAction(keys=["ctrl", "s"]))
+ await session.execute_action(cb.WaitAction(seconds=1.0))
+
+ # Step 5: Navigate to Desktop in Save dialog
+ # Press Ctrl+L to focus location bar
+ await session.execute_action(cb.HotkeyAction(keys=["ctrl", "l"]))
+ await session.execute_action(cb.WaitAction(seconds=0.3))
+
+ # Type Desktop path
+ await session.execute_action(cb.TypeAction(text=r"%USERPROFILE%\Desktop"))
+ await session.execute_action(cb.KeyAction(key="Return"))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+
+ # Step 6: Type filename
+ # Tab to filename field
+ await session.execute_action(cb.HotkeyAction(keys=["alt", "n"]))
+ await session.execute_action(cb.WaitAction(seconds=0.3))
+ await session.execute_action(cb.TypeAction(text=filename))
+
+ # Step 7: Save
+ await session.execute_action(cb.KeyAction(key="Return"))
+ await session.execute_action(cb.WaitAction(seconds=1.0))
+```
+
+## Step 5: Add Task Metadata
+
+Create `pyproject.toml`:
+
+```toml
+[project]
+name = "win-notepad"
+version = "0.1.0"
+
+[tool.cua-bench]
+description = "Create and save a file using Notepad on Windows"
+difficulty = "medium"
+category = "desktop"
+tags = ["windows", "native", "notepad", "file-save"]
+```
+
+## Step 6: Run the Task
+
+### Run Interactively
+
+```bash
+cb interact tasks/win-notepad --image windows-qemu --variant-id 0
+```
+
+Watch at `http://localhost:8006` while the oracle runs.
+
+### Run with Oracle
+
+```bash
+cb run task tasks/win-notepad --image windows-qemu --oracle
+```
+
+### Run with Agent
+
+```bash
+cb run task tasks/win-notepad --image windows-qemu --agent cua-agent --model anthropic/claude-sonnet-4-20250514
+```
+
+## Windows-Specific Tips
+
+### 1. Longer Wait Times
+
+Windows applications take longer to launch than Linux apps:
+
+```python
+# Linux: 0.5-1 second
+# Windows: 2-5 seconds
+
+await session.execute_action(cb.WaitAction(seconds=3.0)) # After app launch
+```
+
+### 2. Use Keyboard Shortcuts
+
+Windows has consistent keyboard shortcuts that are more reliable than clicking:
+
+| Shortcut | Action |
+|----------|--------|
+| `Win + R` | Open Run dialog |
+| `Win + E` | Open File Explorer |
+| `Win + D` | Show Desktop |
+| `Alt + F4` | Close window |
+| `Ctrl + S` | Save |
+| `Ctrl + Shift + S` | Save As |
+| `Alt + Tab` | Switch windows |
+
+### 3. Screen Resolution
+
+Default Windows resolution is 1920x1080. Button coordinates differ from Linux:
+
+```python
+computer={
+ "provider": "native",
+ "setup_config": {
+ "os_type": "windows",
+ "width": 1920,
+ "height": 1080,
+ }
+}
+```
+
+### 4. App-Specific Paths
+
+Windows uses backslashes and has different paths:
+
+```python
+# Desktop path
+desktop = r"%USERPROFILE%\Desktop"
+
+# Documents
+documents = r"%USERPROFILE%\Documents"
+
+# Program Files
+programs = r"C:\Program Files"
+```
+
+## Adding Complexity
+
+### Multi-Application Task
+
+```python
[email protected]_config(split="train")
+def load():
+ return [
+ cb.Task(
+ description="""
+ 1. Open Chrome and search for "Python tutorial"
+ 2. Copy the URL of the first result
+ 3. Open Notepad and paste the URL
+ 4. Save the file as "url.txt" on Desktop
+ """,
+ metadata={"search_query": "Python tutorial"},
+ computer={
+ "provider": "native",
+ "setup_config": {"os_type": "windows", "width": 1920, "height": 1080}
+ }
+ )
+ ]
+```
+
+### Using Pre-installed Apps
+
+If you created an image with `--apps`:
+
+```python
[email protected]_task(split="train")
+async def solve(task_cfg: cb.Task, session: cb.DesktopSession):
+ # Open VS Code instead of Notepad
+ await session.execute_action(cb.HotkeyAction(keys=["win", "r"]))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+ await session.execute_action(cb.TypeAction(text="code"))
+ await session.execute_action(cb.KeyAction(key="Return"))
+ await session.execute_action(cb.WaitAction(seconds=5.0)) # VS Code takes time
+```
+
+## Complete Code
+
+<details>
+<summary>main.py (complete)</summary>
+
+```python
+import cua_bench as cb
+from pathlib import Path
+
+
[email protected]_config(split="train")
+def load():
+ """Define Notepad task variants."""
+ return [
+ cb.Task(
+ description="""
+ Open Notepad and type "Hello from Cua-Bench!".
+ Then save the file as "greeting.txt" on the Desktop.
+ """,
+ metadata={
+ "content": "Hello from Cua-Bench!",
+ "filename": "greeting.txt",
+ "save_location": "Desktop"
+ },
+ computer={
+ "provider": "native",
+ "setup_config": {
+ "os_type": "windows",
+ "width": 1920,
+ "height": 1080,
+ }
+ }
+ )
+ ]
+
+
[email protected]_task(split="train")
+async def start(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Initialize the Windows environment."""
+ await session.execute_action(cb.WaitAction(seconds=5.0))
+
+
[email protected]_task(split="train")
+async def evaluate(task_cfg: cb.Task, session: cb.DesktopSession) -> list[float]:
+ """Check if the file was created correctly."""
+ screenshot = await session.screenshot()
+ Path("debug_screenshot.png").write_bytes(screenshot)
+ return [1.0]
+
+
[email protected]_task(split="train")
+async def solve(task_cfg: cb.Task, session: cb.DesktopSession):
+ """Demonstrate the solution."""
+
+ content = task_cfg.metadata.get("content", "Hello!")
+ filename = task_cfg.metadata.get("filename", "file.txt")
+
+ # Open Run dialog
+ await session.execute_action(cb.HotkeyAction(keys=["win", "r"]))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+
+ # Launch Notepad
+ await session.execute_action(cb.TypeAction(text="notepad"))
+ await session.execute_action(cb.KeyAction(key="Return"))
+ await session.execute_action(cb.WaitAction(seconds=2.0))
+
+ # Type content
+ await session.execute_action(cb.TypeAction(text=content))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+
+ # Save file
+ await session.execute_action(cb.HotkeyAction(keys=["ctrl", "s"]))
+ await session.execute_action(cb.WaitAction(seconds=1.0))
+
+ # Navigate to Desktop
+ await session.execute_action(cb.HotkeyAction(keys=["ctrl", "l"]))
+ await session.execute_action(cb.WaitAction(seconds=0.3))
+ await session.execute_action(cb.TypeAction(text=r"%USERPROFILE%\Desktop"))
+ await session.execute_action(cb.KeyAction(key="Return"))
+ await session.execute_action(cb.WaitAction(seconds=0.5))
+
+ # Enter filename
+ await session.execute_action(cb.HotkeyAction(keys=["alt", "n"]))
+ await session.execute_action(cb.WaitAction(seconds=0.3))
+ await session.execute_action(cb.TypeAction(text=filename))
+
+ # Save
+ await session.execute_action(cb.KeyAction(key="Return"))
+ await session.execute_action(cb.WaitAction(seconds=1.0))
+```
+
+</details>
+
+<details>
+<summary>pyproject.toml</summary>
+
+```toml
+[project]
+name = "win-notepad"
+version = "0.1.0"
+
+[tool.cua-bench]
+description = "Create and save a file using Notepad on Windows"
+difficulty = "medium"
+category = "desktop"
+tags = ["windows", "native", "notepad", "file-save"]
+```
+
+</details>
+
+## Troubleshooting
+
+### KVM not available
+
+```bash
+# Check KVM
+ls -la /dev/kvm
+
+# If missing on cloud VM, enable nested virtualization
+# or use a bare-metal server
+```
+
+### Windows hangs during setup
+
+- Increase memory: `--memory 16G`
+- Increase CPUs: `--cpus 8`
+- Use `--no-kvm` for slower but more compatible emulation
+
+### App doesn't launch
+
+- Increase wait times after launching apps
+- Use keyboard shortcuts instead of mouse clicks
+- Verify the app is installed with `cb image shell`
+
+## Next Steps
+
+- [Generate Tasks with AI](/cuabench/guide/examples/genai-task-generation)
+- Explore [Windows Arena](/cuabench/guide/fundamentals/native-tasks) benchmark
+- See [Configuration](/cuabench/guide/advanced/configuration) for advanced settings
diff --git a/docs/content/docs/cuabench/guide/fundamentals/os-themes.mdx b/docs/content/docs/cuabench/guide/fundamentals/os-themes.mdx
index 899bf758be..9c059d6ccc 100644
--- a/docs/content/docs/cuabench/guide/fundamentals/os-themes.mdx
+++ b/docs/content/docs/cuabench/guide/fundamentals/os-themes.mdx
@@ -99,14 +99,14 @@ def load():
## Generating Themed Tasks
-Use `cb generate-task` to create tasks with AI assistance:
+Use `cb task generate` to create tasks with AI assistance:
```bash
# Generate a Windows 11 styled task
-cb generate-task "todo app with dark mode" --output tasks/todo_win11
+cb task generate "todo app with dark mode" --output tasks/todo_win11
# Generate a macOS styled task
-cb generate-task "notes app with sidebar" --output tasks/notes_macos
+cb task generate "notes app with sidebar" --output tasks/notes_macos
```
The generated task will include:
diff --git a/docs/content/docs/cuabench/guide/fundamentals/registry.mdx b/docs/content/docs/cuabench/guide/fundamentals/registry.mdx
index 77f5178431..7b18c20f71 100644
--- a/docs/content/docs/cuabench/guide/fundamentals/registry.mdx
+++ b/docs/content/docs/cuabench/guide/fundamentals/registry.mdx
@@ -12,7 +12,7 @@ The goal of the registry is to be a community-based effort to increase the varie
### List Available Datasets
```bash
-cb datasets
+cb dataset list
```
### Run a Dataset from the Registry
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 11a2f49dcb..999b82c810 100644
--- a/docs/content/docs/cuabench/guide/getting-started/first-steps.mdx
+++ b/docs/content/docs/cuabench/guide/getting-started/first-steps.mdx
@@ -22,7 +22,7 @@ cb image list
The Cua-Bench CLI can run many different computer-use benchmarks and versions of benchmarks.
-To see the available datasets, run `cb datasets` or visit the [registry](http://cuabench.ai/cuabench/registry/).
+To see the available datasets, run `cb dataset list` or visit the [registry](http://cuabench.ai/cuabench/registry/).
### Step 1: Explore Interactively
@@ -120,36 +120,34 @@ cb image create windows-qemu --download-iso
docker logs -f cua-setup-windows
```
-### Step 2: Start Sandbox
+### Step 2: Verify Image (Optional)
```bash
-# Start Windows sandbox
-cb sandbox start windows-qemu
+# Start interactive shell to verify the image works
+cb image shell windows-qemu
-# Verify it's running
-cb sandbox list
-
-# Connect via VNC
-cb sandbox vnc windows-qemu
+# Access VNC at http://localhost:8006
+# Press Ctrl+C to stop when done verifying
```
### Step 3: Run Tasks
```bash
-# List available tasks
-cb run tasks/winarena_adapter --list
-
# Run specific task with oracle
cb interact tasks/winarena_adapter --variant-id 0 --oracle
-# Run with agent
-cb run tasks/winarena_adapter \
+# Run with agent (2-container architecture)
+cb run task tasks/winarena_adapter \
--agent cua-agent \
--model anthropic/claude-sonnet-4-20250514 \
--image windows-qemu
-# Stop when done
-cb sandbox stop windows-qemu
+# Run entire dataset in parallel
+cb run dataset datasets/winarena \
+ --agent cua-agent \
+ --model anthropic/claude-sonnet-4-20250514 \
+ --image windows-qemu \
+ --max-parallel 4
```
## View Past Runs
@@ -159,7 +157,7 @@ cb sandbox stop windows-qemu
cb runs
# View traces from a specific run
-cb view-traces outputs/<run-id>
+cb trace grid outputs/<run-id>
```
## Export Training Data
@@ -168,11 +166,11 @@ Export agent trajectories to training datasets:
```bash
# Export with aguvis-stage-1 format
-cb process outputs/<run-id> --save-dir datasets/
+cb dataset build outputs/<run-id> --save-dir datasets/
# Export with gui-r1 format
-cb process outputs/<run-id> --mode gui-r1 --save-dir datasets/
+cb dataset build outputs/<run-id> --mode gui-r1 --save-dir datasets/
# Push to Hugging Face
-cb process outputs/<run-id> --push-to-hub --repo-id username/my-dataset
+cb dataset build outputs/<run-id> --push-to-hub --repo-id username/my-dataset
```
\ No newline at end of file
diff --git a/docs/content/docs/cuabench/guide/getting-started/images.mdx b/docs/content/docs/cuabench/guide/getting-started/images.mdx
index eb91613907..167ed7d908 100644
--- a/docs/content/docs/cuabench/guide/getting-started/images.mdx
+++ b/docs/content/docs/cuabench/guide/getting-started/images.mdx
@@ -3,7 +3,7 @@ title: Base Images
description: Setting up reproducible VM environments for benchmarks
---
-Base images are reproducible environments for running benchmarks. Each image type provides a consistent, isolated desktop or mobile environment that can be started, stopped, and reset to a known state.
+Base images are reproducible environments for running benchmarks. Each image type provides a consistent, isolated desktop or mobile environment. Images are protected by overlays during benchmark runs, ensuring each task starts from a clean state.
## Image Types
@@ -25,14 +25,11 @@ Container-based Linux GUI. No KVM required, works anywhere Docker runs.
# Create image (~1 minute)
cb image create linux-docker
-# Start sandbox
-cb sandbox start linux-docker
+# Start interactive shell (protected by overlay)
+cb image shell linux-docker
-# Connect via browser
-cb sandbox vnc linux-docker
-
-# Stop when done
-cb sandbox stop linux-docker
+# Access via browser at http://localhost:8006
+# Press Ctrl+C to stop
```
### windows-qemu (Windows Arena)
@@ -69,33 +66,56 @@ macOS VM using Apple's Virtualization framework via Lume.
cb image create macos-lume --version sonoma
```
-## Managing Sandboxes
+## Interactive Shells
-### Start and Stop
+Use `cb image shell` to interactively explore or debug images. By default, shells use an overlay to protect the golden image.
-```bash
-# Start sandbox from image
-cb sandbox start linux-docker
-cb sandbox start windows-qemu --vnc-port 8080 --api-port 9000
+### Protected Mode (Default)
-# List running sandboxes
-cb sandbox list
+```bash
+# Start shell with overlay protection
+cb image shell windows-qemu
-# Stop sandbox
-cb sandbox stop linux-docker
+# Access VNC at http://localhost:8006
+# Any changes are discarded when you exit
```
-### Connect to Sandbox
+### Writable Mode (Image Authoring)
+
+Use `--writable` when you need to permanently modify an image (e.g., installing apps, configuring settings):
```bash
-# Open VNC in browser
-cb sandbox vnc linux-docker
+# Clone image first (recommended workflow)
+cb image clone windows-qemu windows-custom
-# Or access directly via ports
-# linux-docker: http://localhost:6901 (VNC), http://localhost:8000 (API)
-# windows-qemu: http://localhost:8006 (VNC), http://localhost:5000 (API)
+# Modify the clone
+cb image shell windows-custom --writable
+# Install apps, configure settings...
+# Changes persist to the image
+
+# Use your custom image in benchmarks
+cb run task my-task --image windows-custom
```
+<Callout title="Warning" type="warn">
+ `--writable` mode directly modifies the golden image. Always clone first to preserve your original base image.
+</Callout>
+
+### Shell Options
+
+```bash
+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) |
+| `--memory <size>` | Memory (default: 8G) |
+| `--cpus <count>` | CPU cores (default: 8) |
+| `--no-kvm` | Disable KVM acceleration |
+
## Image Management
Images are stored in `~/.local/share/cua-bench/images/`. Use the `cb image` commands to manage them:
@@ -126,10 +146,10 @@ Different image types use different internal ports:
| `linux-qemu` | 8006 | 5000 |
| `android-qemu` | 8006 | 5000 |
-When starting sandboxes, you can map these to custom external ports:
+When starting shells, you can map these to custom external ports:
```bash
-cb sandbox start linux-docker --vnc-port 8080 --api-port 9000
+cb image shell linux-docker --vnc-port 8080 --api-port 9000
```
## Storage Structure
@@ -138,17 +158,19 @@ Cua-Bench follows the XDG Base Directory specification:
```
~/.local/share/cua-bench/ # Data directory
-├── images/ # Base images
+├── images/ # Base images (golden)
│ ├── linux-docker/
│ ├── windows-qemu/
│ │ ├── windows.boot # Marker file (setup complete)
│ │ └── data/ # VM disk files
│ └── ...
+├── workers/ # 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
-└── sandboxes.json # Running sandbox registry
+└── images.json # Image registry
```
## Architecture
@@ -161,8 +183,8 @@ Cua-Bench follows the XDG Base Directory specification:
│ (Development & Authoring) │ (Execution & Scale) │
├─────────────────────────────────┼───────────────────────────────────────┤
│ │ │
-│ cb image create windows-qemu │ cb run --on cloud │
-│ cb sandbox start │ Parallel execution │
+│ cb image create windows-qemu │ cb run dataset --on cloud │
+│ cb image shell │ Parallel execution │
│ cb interact │ Agent orchestration │
│ cb image clone │ Result aggregation │
│ │ │
@@ -176,6 +198,19 @@ Cua-Bench follows the XDG Base Directory specification:
**Local** is the authoring environment for images and tasks. **Cloud** handles scale.
+## Image Protection
+
+During benchmark runs, golden images are protected by an overlay system:
+
+1. **Golden image** mounted read-only at `/golden`
+2. **Worker overlay** mounted writable at `/storage`
+3. QEMU creates a QCOW2 overlay on top
+
+This ensures:
+- Each task starts from a pristine state
+- Golden images are never accidentally modified
+- Failed tasks don't contaminate subsequent runs
+
## Troubleshooting
### KVM not available
@@ -202,5 +237,5 @@ open -a Docker
```bash
# Use custom ports
-cb sandbox start linux-docker --vnc-port 9000 --api-port 9001
+cb image shell linux-docker --vnc-port 9000 --api-port 9001
```
diff --git a/docs/content/docs/cuabench/guide/getting-started/installation.mdx b/docs/content/docs/cuabench/guide/getting-started/installation.mdx
index 02170c7552..a50eb6493f 100644
--- a/docs/content/docs/cuabench/guide/getting-started/installation.mdx
+++ b/docs/content/docs/cuabench/guide/getting-started/installation.mdx
@@ -66,19 +66,14 @@ You should see output similar to:
toolkit for computer-use RL environments and benchmarks
Commands:
- run Run a benchmark file or task
+ run Run tasks (cb run task, cb run dataset)
interact Run a task interactively with visible GUI
task Inspect and manage tasks (info, list)
- image Manage base images (create, list, info, clone, delete)
- sandbox Manage running sandboxes (start, stop, list, vnc, logs, exec)
+ image Manage base images (create, list, info, clone, delete, shell)
platform View available platforms (list)
status Show system status
- datasets List available datasets from the registry
- process Process outputs into training datasets
- view-trace View a single trace
- view-traces View multiple traces in a grid
- create-task Scaffold a new task
- generate-task AI-generate a task from description
+ dataset Manage datasets (list, build)
+ trace View and manage traces (view, grid, replay)
login Authenticate with Cua Cloud
Options:
diff --git a/docs/content/docs/cuabench/guide/getting-started/introduction.mdx b/docs/content/docs/cuabench/guide/getting-started/introduction.mdx
index 9f4ad36e65..48aeb9d38a 100644
--- a/docs/content/docs/cuabench/guide/getting-started/introduction.mdx
+++ b/docs/content/docs/cuabench/guide/getting-started/introduction.mdx
@@ -40,7 +40,7 @@ After [installing the package](/cuabench/guide/getting-started/installation), yo
# Base Images
-Cua-Bench uses **base images** - reproducible environments that provide consistent, isolated desktop or mobile VMs. Each image can be used to start sandboxes that can be stopped and reset to a known state.
+Cua-Bench uses **base images** - reproducible environments that provide consistent, isolated desktop or mobile VMs. Images are protected by overlays during benchmark runs, ensuring each task starts from a clean state.
| Type | Description | Requirements |
|------|-------------|--------------|
diff --git a/docs/content/docs/cuabench/guide/meta.json b/docs/content/docs/cuabench/guide/meta.json
index 93bc120de0..505e067e5c 100644
--- a/docs/content/docs/cuabench/guide/meta.json
+++ b/docs/content/docs/cuabench/guide/meta.json
@@ -5,6 +5,7 @@
"pages": [
"getting-started",
"fundamentals",
+ "examples",
"advanced"
]
}
diff --git a/docs/content/docs/cuabench/index.mdx b/docs/content/docs/cuabench/index.mdx
index a220adf247..972f26f462 100644
--- a/docs/content/docs/cuabench/index.mdx
+++ b/docs/content/docs/cuabench/index.mdx
@@ -18,10 +18,13 @@ uv tool install -e .
cb image create linux-docker
# Run interactive task
-cb interact tasks/click_button --dataset cua-bench-basic
+cb interact click-icon --dataset cua-bench-basic
-# Run with agent
-cb run --dataset cua-bench-basic --agent cua-agent --model anthropic/claude-sonnet-4-20250514
+# Run single task with agent
+cb run task tasks/click_button --agent cua-agent --model anthropic/claude-sonnet-4-20250514
+
+# Run entire dataset in parallel
+cb run dataset datasets/cua-bench-basic --agent cua-agent --max-parallel 4
```
## Key Features
@@ -44,7 +47,7 @@ Cua-Bench uses a **2-container architecture** where agent and environment run in
│ ┌─────────────────────┐ ┌─────────────────────────────┐│
│ │ cua-agent-{id} │ │ cua-env-{id} ││
│ │ │ │ ││
-│ │ Your agent image │───►│ Base image sandbox ││
+│ │ Your agent image │───►│ Base image environment ││
│ │ (or built-in) │HTTP│ (linux/windows/android) ││
│ │ │ │ ││
│ └─────────────────────┘ └─────────────────────────────┘│
diff --git a/docs/content/docs/cuabench/reference/cli-reference.mdx b/docs/content/docs/cuabench/reference/cli-reference.mdx
index 1a42994b90..71481dc6a9 100644
--- a/docs/content/docs/cuabench/reference/cli-reference.mdx
+++ b/docs/content/docs/cuabench/reference/cli-reference.mdx
@@ -18,6 +18,7 @@ cb image <action> [options]
| `cb image info <name>` | Show image details |
| `cb image clone <src> <dst>` | Clone/fork an image |
| `cb image delete <name>` | Delete an image |
+| `cb image shell <name>` | Interactive shell into image (protected) |
### Create Options
@@ -48,34 +49,26 @@ cb image list [options]
| `--format <fmt>` | Output format: table, json |
| `--platform <type>` | Filter by platform type |
-## Sandbox Commands
+### Shell Options
-Manage running sandbox instances.
+Interactive shell into an image. By default uses an overlay to protect the golden image.
```bash
-cb sandbox <action> [options]
-```
-
-| Command | Description |
-|---------|-------------|
-| `cb sandbox start <image>` | Start sandbox from image |
-| `cb sandbox stop <id>` | Stop running sandbox |
-| `cb sandbox list` | List running sandboxes |
-| `cb sandbox vnc <id>` | Open VNC in browser |
-| `cb sandbox logs <id>` | View sandbox logs |
-| `cb sandbox exec <id> <cmd>` | Execute command in sandbox |
-
-### Start Options
-
-```bash
-cb sandbox start <image> [options]
+cb image shell <name> [options]
```
| Option | Description |
|--------|-------------|
-| `--vnc-port <port>` | VNC port (default varies by type) |
-| `--api-port <port>` | API port (default varies by type) |
-| `--name <name>` | Custom sandbox name |
+| `--writable` | Modify golden image directly (dangerous!) |
+| `--vnc-port <port>` | VNC port (default: 8006) |
+| `--api-port <port>` | API port (default: 5000) |
+| `--memory <size>` | Memory (default: 8G) |
+| `--cpus <count>` | CPU cores (default: 8) |
+| `--no-kvm` | Disable KVM acceleration |
+
+<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.
+</Callout>
## Platform Commands
@@ -97,77 +90,90 @@ Show system status.
cb status
```
-Shows Docker status, KVM availability, and running sandboxes.
+Shows Docker status, KVM availability, running shells, and active runs.
## Run Commands
Run tasks with the 2-container architecture (agent container + environment container).
```bash
-cb run <task> [options]
+cb run <subcommand> [options]
```
-### Basic Options
+| Command | Description |
+|---------|-------------|
+| `cb run task <path>` | Run a single task |
+| `cb run dataset <path>` | Run all tasks in a dataset (parallel) |
+| `cb run list` | List all runs with status |
+| `cb run status <id>` | Show detailed run status |
+| `cb run watch <id>` | Watch a run in real-time |
+| `cb run stop <id>` | Stop/cancel a run |
+| `cb run logs <id>` | View combined logs from a run |
+
+### Task Options
+
+```bash
+cb run task <path> [options]
+```
| Option | Description |
|--------|-------------|
+| `--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 |
| `--model <model>` | Model to use (e.g., `anthropic/claude-sonnet-4-20250514`) |
| `--oracle` | Run with oracle solution (no agent) |
-| `--variant-id <n>` | Run specific task variant (default: 0) |
| `--max-steps <n>` | Maximum steps per task (default: 100) |
-
-### Environment Options
-
-| Option | Description |
-|--------|-------------|
| `--image <name>` | Use specific base image |
| `--platform <type>` | Platform type: `linux-docker`, `windows-qemu`, `android-qemu` |
-
-### Debugging Options
-
-| Option | Description |
-|--------|-------------|
| `--vnc-port <port>` | Expose VNC on host port (for live viewing) |
| `--api-port <port>` | Expose API on host port (for debugging) |
-
-### Batch Options
-
-| Option | Description |
-|--------|-------------|
-| `--max-parallel <n>` | Maximum parallel sessions |
-| `--max-variants <n>` | Maximum variants per task |
| `--output-dir <dir>` | Output directory for results |
-| `--dataset <name>` | Use dataset from registry |
-| `--dataset-path <path>` | Use local dataset path |
-| `--list` | List available tasks |
-### Provider Options
+### Dataset Options
+
+```bash
+cb run dataset <path> [options]
+```
| Option | Description |
|--------|-------------|
-| `--on <provider>` | Where to run: `local` (default) or `cloud` |
+| `--max-parallel <n>` | Maximum parallel task runners (default: 4) |
+| `--max-variants <n>` | Maximum variants per task (default: all) |
+| `--task-filter <pattern>` | Filter tasks by name pattern (glob) |
+| `--agent <name>` | Agent to use (from `.cua/agents.yaml`) |
+| `--model <model>` | Model to use |
+| `--oracle` | Run with oracle solution (no agent) |
+| `--max-steps <n>` | Maximum steps per task (default: 100) |
+| `--image <name>` | Use specific base image |
+| `--platform <type>` | Platform type |
+| `--output-dir <dir>` | Output directory for results |
### Examples
```bash
-# Run task with oracle solution
-cb run tasks/click_button --variant-id 0
+# Run single task with oracle solution
+cb run task tasks/click_button --variant-id 0 --oracle
-# Run with agent evaluation
-cb run tasks/click_button --variant-id 0 --agent cua-agent
+# Run single task with agent evaluation
+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 tasks/click_button --agent cua-agent --vnc-port 8006
+cb run task tasks/click_button --agent cua-agent --vnc-port 8006
-# Run with custom model and step limit
-cb run tasks/click_button --agent cua-agent --model gpt-4o --max-steps 50
+# Run Windows task with specific image
+cb run task tasks/winarena --image windows-qemu --agent cua-agent
-# Run Windows task
-cb run tasks/winarena --variant-id 0 --platform windows-qemu --agent cua-agent
+# Run all tasks in a dataset (4 parallel)
+cb run dataset datasets/cua-bench-basic --agent cua-agent --max-parallel 4
-# Run with specific image
-cb run tasks/winarena --image windows-custom --agent cua-agent
+# 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
```
## Interact Commands
@@ -185,55 +191,69 @@ cb interact <task> [options]
| `--screenshot <path>` | Save screenshot to file |
| `--dataset <name>` | Use dataset from registry |
-## Task Creation Commands
+## Task Commands
-Create and generate tasks.
+Manage task environments.
```bash
-# Create empty task scaffold
-cb create-task <path>
+cb task <action> [options]
+```
-# AI-generate a task
-cb generate-task "<description>" [options]
+| Command | Description |
+|---------|-------------|
+| `cb task info <path>` | Show task details (provider, variants) |
+| `cb task list [path]` | List tasks in a directory |
+| `cb task create [path]` | Scaffold a new task environment |
+| `cb task generate "<prompt>"` | Generate a task using Claude |
+
+### Generate Options
+
+```bash
+cb task generate "<description>" [options]
```
| Option | Description |
|--------|-------------|
| `--output <path>` | Output directory for generated task |
+| `--no-interaction` | Skip prompts and run Claude non-interactively |
-## Data Processing Commands
+## Trace Commands
-Export snapshots to training datasets.
+View and manage trace datasets.
```bash
-cb process <dir> [options]
+cb trace <action> [options]
```
-| Option | Description |
-|--------|-------------|
-| `--save-dir <dir>` | Output directory for datasets |
-| `--mode <mode>` | Processor mode: aguvis-stage-1, gui-r1 |
-| `--push-to-hub` | Push to Hugging Face Hub |
-| `--repo-id <id>` | Hugging Face repo ID |
+| Command | Description |
+|---------|-------------|
+| `cb trace view <path>` | View a single trace dataset in browser |
+| `cb trace grid <dir>` | View multiple traces in a grid layout |
+| `cb trace replay <dataset>` | Create a replay task from a trace |
-## View Commands
+## Dataset Commands
-View traces and results.
+Manage datasets and build from outputs.
```bash
-# View single trace
-cb view-trace <path>
-
-# View multiple traces
-cb view-traces <dir>
+cb dataset <action> [options]
```
-## Datasets Commands
+| Command | Description |
+|---------|-------------|
+| `cb dataset list` | List available datasets from registry |
+| `cb dataset build <outputs>` | Build a dataset from batch outputs |
-View available datasets.
+### Build Options
```bash
-cb datasets [options]
+cb dataset build <outputs> [options]
```
-Lists available datasets from the registry.
+| Option | Description |
+|--------|-------------|
+| `--save-dir <dir>` | Output directory for datasets |
+| `--mode <mode>` | Processor mode: aguvis-stage-1, gui-r1 |
+| `--push-to-hub` | Push to Hugging Face Hub |
+| `--repo-id <id>` | Hugging Face repo ID |
+| `--private` | Create private repo on Hub |