Skip to main content

Toolkit for computer-use RL environments and benchmarks

Project description

cua-bench

Framework for benchmarking Computer-Use Agents with verifiable cross-platform environments.

Documentation - Installation, guides, and API reference.

Running Tests

The test suite covers the core gym interface, worker system, and benchmark runners.

Install dev dependencies

uv pip install -e ".[dev,browser,server,rl]"

Note: The browser extra installs Playwright for e2e tests with the simulated provider.

Run all tests

uv run --with pytest pytest cua_bench/tests/ -v

Run specific test modules

# Core gym interface (make, reset, step, evaluate)
uv run --with pytest pytest cua_bench/tests/test_gym_interface.py -v

# HTTP worker client (/reset, /step endpoints)
uv run --with pytest pytest cua_bench/tests/test_worker_client.py -v

# Worker server endpoints and action serialization
uv run --with pytest pytest cua_bench/tests/test_worker_server.py -v

# Benchmark runner functions
uv run --with pytest pytest cua_bench/tests/test_run_benchmark.py -v

# Worker manager (spawning/managing workers)
uv run --with pytest pytest cua_bench/tests/test_worker_manager.py -v

# Action parsing
uv run --with pytest pytest cua_bench/tests/test_actions.py -v

Run tests with coverage

uv run --with pytest --with pytest-cov pytest cua_bench/tests/ -v --cov=cua_bench --cov-report=term-missing

Test Structure

Test Module What it Tests Approach
test_gym_interface.py Core Environment API: make(), reset(), step(), evaluate() E2E - Real simulated (Playwright) environments
test_worker_client.py HTTP client for worker servers (CBEnvWorkerClient) Mock server - Uses @patch("requests.post") to mock HTTP responses
test_worker_server.py FastAPI endpoints and action serialization Unit - Action serialize/deserialize, request models, simple endpoints
test_run_benchmark.py run_benchmark(), run_single_task(), run_interactive() E2E - Real simulated (Playwright) environments
test_worker_manager.py Workers + dataloader training loop E2E - Real workers, real envs, mock model for actions
test_actions.py Action string parsing (repr_to_action()) Unit - Pure function tests

Test Approach Philosophy

  • E2E tests use real simulated (Playwright) environments. The simulated provider is fast enough for testing.
  • Mock server tests (test_worker_client.py) mock HTTP responses to test client logic in isolation.
  • Mock model (test_worker_manager.py) uses a mock model that returns simple actions to test the dataloader training loop without requiring a real ML model.

Infrastructure Benchmarking

Measure the throughput of the worker infrastructure:

uv run python -m cua_bench.scripts.benchmark_workers --num_workers 16 --num_steps 10

Options:

Flag Default Description
--num_workers 16 Number of parallel workers
--num_steps 10 Steps per worker
--task_path None Path to task directory (creates temp if empty)

Output:

  • Average reset time
  • Average step time
  • Average finish time
  • Step throughput (steps/sec)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cua_bench-0.2.4.tar.gz (13.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cua_bench-0.2.4-py3-none-any.whl (13.4 MB view details)

Uploaded Python 3

File details

Details for the file cua_bench-0.2.4.tar.gz.

File metadata

  • Download URL: cua_bench-0.2.4.tar.gz
  • Upload date:
  • Size: 13.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cua_bench-0.2.4.tar.gz
Algorithm Hash digest
SHA256 5eda835c40c22fd1b57d50318925f901363fbad138e5aab51664fbf20e6b6c31
MD5 5dbfd87caf495af05ff583ca02db5e43
BLAKE2b-256 4fdc49640fdd0b4f6d07a3375930165c5b8f52504acd60bf18ee16f6baa74457

See more details on using hashes here.

File details

Details for the file cua_bench-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: cua_bench-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 13.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cua_bench-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7a79155247c61e9d7b044686ae52fcdbe9027293c88d8a353a02463e24f3c930
MD5 66b8713972753a040cf154fb2f3f112b
BLAKE2b-256 2c1ad0a5a8b3432bc33e1d9d9cd704656f989fa444a9e47dc696e3d6cd27a9f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page