Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Cua Driver SDK and agent examples
These executable examples cover two intentionally different boundaries:
- Native application route: Python or Node imports
cua-driverin process. Claude Agent SDK can wrap a narrow set of those calls as in-process custom tools. - MCP agent route: Claude or Codex launches
cua-driver mcp. The agent SDK already supplies the language-independent MCP client.
Codex SDK does not expose direct custom-tool callbacks. Its Cua Driver examples therefore use MCP rather than inventing a bespoke native adapter.
Deterministic perceive → act → verify fixture
Start the loopback-only fixture in one terminal:
python3 fixture_server.py
It opens a page with one autofocus input. The native examples capture the
desktop, type a unique value, press Enter, and verify the submitted value
through the independent /state endpoint. A timeout after a mutation is
treated as an unknown outcome: the examples observe the fixture before any
retry.
Python:
python3.12 -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv/bin/python native_driver.py
TypeScript:
npm install
npm run native
Grant Screen Recording and Accessibility/Input permission to the importing Python or Node process. Keep the fixture browser window focused when the native example starts.
Claude Agent SDK: native or MCP
Python:
.venv/bin/python claude_agent.py --route native \
"Enter a short value in the fixture and submit it"
.venv/bin/python claude_agent.py --route mcp \
"Open Calculator, compute 19 * 23, and report the result"
TypeScript:
npm run claude -- --route native \
"Enter a short value in the fixture and submit it"
npm run claude -- --route mcp \
"Open Calculator, compute 19 * 23, and report the result"
The native route supplies four narrow in-process callbacks: observe, click,
type, and key press. The MCP route discovers the complete live Cua Driver tool
surface. Set CLAUDE_MODEL optionally.
Codex SDK: MCP
Python:
.venv/bin/python codex_agent.py \
"Inspect the active app and summarize what is visible without changing it"
TypeScript:
npm run codex -- \
"Inspect the active app and summarize what is visible without changing it"
Set CODEX_MODEL optionally. Both scripts configure one long-lived
cua-driver mcp transport. Its first admitted stateful call creates an
implicit session, later unnamed calls reuse it, and transport shutdown runs
the same cleanup as an explicit end_session.
Environment and safety
- Put
cua-driveronPATH, or setCUA_DRIVER_BINfor MCP examples. - Select an exact window or desktop target on each action. Sessions do not store capture modality.
- Authenticate the chosen agent SDK using its normal local login or API key.
- Run only trusted tasks. These examples remove interactive approval prompts.
- Keep purchases, messages, deletion, credential entry, and other irreversible actions out of unattended prompts.
Credential-free checks
python3.12 -m py_compile \
claude_agent.py codex_agent.py fixture_server.py native_driver.py native_tools.py
python3.12 -m unittest tests.test_fixture_server
npm run typecheck