# trycua/cua architecture

> Architecture diagram of the GitHub repository trycua/cua, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/trycua/cua
- Repository: https://github.com/trycua/cua

## Overview

Cua is a computer-use platform spanning agent tool access, isolated desktops, native/browser automation, VM management, and benchmark evaluation. The principal workflow is: an agent or operator selects a task, the runtime provisions or acquires a computer, the agent performs actions through MCP or Cua Driver, and the environment produces observations or a scored benchmark result. The tree supports these boundaries, but several orchestration links are inferred from documented product behavior because their implementations were not sampled.

Main entry points: [`libs/cua-bench/cua_bench/runner/task_runner.py`](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/runner/task_runner.py) (Task Runner), [`libs/cua-bench/cua_bench/computers/base.py`](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/computers/base.py) (Computer Backends), [`libs/cua-bench/cua_bench/agents/base.py`](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/agents/base.py) (Agent Adapters), [`libs/python/mcp-server/mcp_server/session_manager.py`](https://github.com/trycua/cua/blob/main/libs/python/mcp-server/mcp_server/session_manager.py) (MCP Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Agent Interfaces"]
  node_cli["Cua CLI<br/>[main.py]"]
  node_mcp["MCP Server<br/>[session_manager.py]"]
  node_agent_adapters["Agent Adapters<br/>[base.py]"]
end

subgraph group_runtime["Automation Runtime"]
  node_driver["Cua Driver Core<br/>[engine.rs]"]
  node_sessions["Session Manager<br/>[manager.py]"]
  node_computers["Computer Backends<br/>[base.py]"]
  node_actions["Desktop Actions<br/>[actions.py]"]
end

subgraph group_environments["Computer Environments"]
  node_fleet_sdk["Fleet SDK Routes<br/>[routes.rs]"]
  node_lume["Lume VM Manager"]
end

subgraph group_bench["Benchmarking"]
  node_task_runner["Task Runner<br/>[task_runner.py]"]
  node_worker_pool["Worker Pool<br/>[worker_manager.py]"]
  node_task_setup["Task Setup"]
  node_datasets["Benchmark Datasets"]
  node_evaluator["Task Evaluator<br/>[evaluator.py]"]
  node_telemetry["Telemetry Tracing<br/>[events.py]"]
  node_benchmark_result["Benchmark Result"]
end

subgraph group_models["Decision Models"]
  node_specialist_models["Specialist Models"]
end

node_operator(("Agent Operator"))
node_browser_service["Browser DevTools"]
node_fleet_api["Fleet Control Plane"]
node_vm_hypervisor["Virtualization Framework"]

node_operator -->|"selects task"| node_cli
node_operator -->|"connects tools"| node_mcp
node_operator -->|"supplies agent"| node_agent_adapters
node_cli -->|"dispatches run"| node_task_runner
node_task_runner -->|"starts workers"| node_worker_pool
node_task_runner -->|"creates sessions"| node_sessions
node_mcp -->|"manages sessions"| node_sessions
node_sessions -->|"acquires computer"| node_computers
node_agent_adapters -->|"calls tools"| node_mcp
node_agent_adapters -->|"drives apps"| node_driver
node_driver -->|"connects CDP"| node_browser_service
node_computers -->|"executes actions"| node_actions
node_fleet_sdk -->|"builds routes"| node_fleet_api
node_lume -->|"manages VMs"| node_vm_hypervisor
node_task_runner -->|"prepares task"| node_task_setup
node_task_setup -->|"writes and runs"| node_computers
node_datasets -->|"provides tasks"| node_task_runner
node_task_runner -->|"requests scoring"| node_evaluator
node_evaluator -->|"produces score"| node_benchmark_result
node_worker_pool -->|"records execution"| node_telemetry
node_agent_adapters -.->|"requests decisions"| node_specialist_models
node_fleet_sdk -.->|"provisions desktop"| node_computers
node_lume -.->|"provides VM"| node_computers

click node_cli "https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/cli/main.py"
click node_mcp "https://github.com/trycua/cua/blob/main/libs/python/mcp-server/mcp_server/session_manager.py"
click node_agent_adapters "https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/agents/base.py"
click node_driver "https://github.com/trycua/cua/blob/main/libs/cua-driver/rust/crates/cua-driver-core/src/browser/engine.rs"
click node_sessions "https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/sessions/manager.py"
click node_computers "https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/computers/base.py"
click node_actions "https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/actions.py"
click node_fleet_sdk "https://github.com/trycua/cua/blob/main/libs/fleet/sdk/src/routes.rs"
click node_lume "https://github.com/trycua/cua/blob/main/libs/lume/src/LumeController.swift"
click node_task_runner "https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/runner/task_runner.py"
click node_worker_pool "https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/workers/worker_manager.py"
click node_task_setup "https://github.com/trycua/cua/blob/main/libs/cua-bench/tasks/winarena_adapter/setup_controller.py"
click node_datasets "https://github.com/trycua/cua/tree/main/libs/cua-bench/datasets/cua-bench-basic"
click node_evaluator "https://github.com/trycua/cua/blob/main/libs/cua-bench/tasks/winarena_adapter/evaluator.py"
click node_telemetry "https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/telemetry/events.py"
click node_specialist_models "https://github.com/trycua/cua/tree/main/libs/cua-s1"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_mcp,node_agent_adapters,node_browser_service toneBlue
class node_driver,node_sessions,node_computers,node_actions toneAmber
class node_fleet_sdk,node_lume toneMint
class node_task_runner,node_worker_pool,node_task_setup,node_datasets,node_evaluator,node_telemetry,node_benchmark_result toneRose
class node_specialist_models,node_operator,node_fleet_api,node_vm_hypervisor toneIndigo
```

## Components

### Agent Interfaces

- [Cua CLI](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/cli/main.py): `libs/cua-bench/cua_bench/cli/main.py`
- [MCP Server](https://github.com/trycua/cua/blob/main/libs/python/mcp-server/mcp_server/session_manager.py): `libs/python/mcp-server/mcp_server/session_manager.py`
- [Agent Adapters](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/agents/base.py): `libs/cua-bench/cua_bench/agents/base.py`

### Automation Runtime

- [Cua Driver Core](https://github.com/trycua/cua/blob/main/libs/cua-driver/rust/crates/cua-driver-core/src/browser/engine.rs): `libs/cua-driver/rust/crates/cua-driver-core/src/browser/engine.rs`
- [Session Manager](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/sessions/manager.py): `libs/cua-bench/cua_bench/sessions/manager.py`
- [Computer Backends](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/computers/base.py): `libs/cua-bench/cua_bench/computers/base.py`
- [Desktop Actions](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/actions.py): `libs/cua-bench/cua_bench/actions.py`

### Computer Environments

- [Fleet SDK Routes](https://github.com/trycua/cua/blob/main/libs/fleet/sdk/src/routes.rs): `libs/fleet/sdk/src/routes.rs`
- [Lume VM Manager](https://github.com/trycua/cua/blob/main/libs/lume/src/LumeController.swift): `libs/lume/src/LumeController.swift`

### Benchmarking

- [Task Runner](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/runner/task_runner.py): `libs/cua-bench/cua_bench/runner/task_runner.py`
- [Worker Pool](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/workers/worker_manager.py): `libs/cua-bench/cua_bench/workers/worker_manager.py`
- [Task Setup](https://github.com/trycua/cua/blob/main/libs/cua-bench/tasks/winarena_adapter/setup_controller.py): `libs/cua-bench/tasks/winarena_adapter/setup_controller.py`
- [Benchmark Datasets](https://github.com/trycua/cua/tree/main/libs/cua-bench/datasets/cua-bench-basic): `libs/cua-bench/datasets/cua-bench-basic`
- [Task Evaluator](https://github.com/trycua/cua/blob/main/libs/cua-bench/tasks/winarena_adapter/evaluator.py): `libs/cua-bench/tasks/winarena_adapter/evaluator.py`
- [Telemetry Tracing](https://github.com/trycua/cua/blob/main/libs/cua-bench/cua_bench/telemetry/events.py): `libs/cua-bench/cua_bench/telemetry/events.py`
- **Benchmark Result**

### Decision Models

- [Specialist Models](https://github.com/trycua/cua/tree/main/libs/cua-s1): `libs/cua-s1`

### Other components

- **Agent Operator**
- **Browser DevTools**
- **Fleet Control Plane**
- **Virtualization Framework**

## Connections

- Agent Operator → Cua CLI: selects task
- Agent Operator → MCP Server: connects tools
- Agent Operator → Agent Adapters: supplies agent
- Cua CLI → Task Runner: dispatches run
- Task Runner → Worker Pool: starts workers
- Task Runner → Session Manager: creates sessions
- MCP Server → Session Manager: manages sessions
- Session Manager → Computer Backends: acquires computer
- Agent Adapters → MCP Server: calls tools
- Agent Adapters → Cua Driver Core: drives apps
- Cua Driver Core → Browser DevTools: connects CDP
- Computer Backends → Desktop Actions: executes actions
- Fleet SDK Routes → Fleet Control Plane: builds routes
- Lume VM Manager → Virtualization Framework: manages VMs
- Task Runner → Task Setup: prepares task
- Task Setup → Computer Backends: writes and runs
- Benchmark Datasets → Task Runner: provides tasks
- Task Runner → Task Evaluator: requests scoring
- Task Evaluator → Benchmark Result: produces score
- Worker Pool → Telemetry Tracing: records execution
- Agent Adapters → Specialist Models: requests decisions
- Fleet SDK Routes → Computer Backends: provisions desktop
- Lume VM Manager → Computer Backends: provides VM
