GuideGet Started
What is Cua?
Open-source sandboxes and agent framework for computer-use AI
Cua lets you spin up isolated desktop environments — Linux, macOS, Windows, Android — and build agents that can see and control them. One SDK, any OS, cloud or local.
import asyncio
from cua import Sandbox, Image, ComputerAgent
async def main():
async with Sandbox.ephemeral(Image.linux(), local=True) as sb:
agent = ComputerAgent(
model="cua/anthropic/claude-sonnet-4-5",
tools=[sb],
)
async for result in agent.run([{
"role": "user",
"content": "Open Firefox and search for 'open source computer use'",
}]):
for item in result["output"]:
if item["type"] == "message":
print(item["content"][0]["text"])
asyncio.run(main())Install
pip install cuaNo account needed to run locally with Docker. For cloud sandboxes and hosted models, get a free API key at cua.ai.
What it includes
Sandbox SDK — create and control sandboxes programmatically. Same API everywhere:
async with Sandbox.ephemeral(Image.linux()) as sb: # cloud Linux container
async with Sandbox.ephemeral(Image.macos()) as sb: # cloud macOS VM
async with Sandbox.ephemeral(Image.windows()) as sb: # cloud Windows VM
async with Sandbox.ephemeral(Image.android()) as sb: # cloud Android VM
async with Sandbox.ephemeral(Image.linux(), local=True) as sb: # local DockerInside any sandbox:
await sb.shell.run("npm install") # run shell commands
await sb.screenshot() # capture the screen
await sb.mouse.click(x, y) # click
await sb.keyboard.type("hello") # type
await sb.keyboard.press("ctrl+c") # key combos
await sb.mobile.tap(x, y) # Android touch
async with sb.tunnel.forward(3000) as t: # forward ports
print(t.url)Agent SDK — plug any vision-language model into a computer-use loop:
agent = ComputerAgent(
model="cua/anthropic/claude-sonnet-4-5", # or openai, gemini, qwen, ...
tools=[sb],
)
async for result in agent.run(messages): ...Image builder — configure the environment before the sandbox starts:
img = (
Image.linux()
.apt_install("curl", "ffmpeg")
.pip_install("playwright")
.env(API_KEY="...")
.run("playwright install chromium")
)
async with Sandbox.ephemeral(img) as sb: ...Use cases
- AI coding assistants — safe isolated environments for Claude Code, Codex, and similar tools
- Browser and desktop automation — agents that interact with any real UI
- Cross-platform testing — run the same test against Linux, macOS, Windows, and Android
- Benchmarking — evaluate agents on OSWorld, ScreenSpot, and custom task sets
Next
- Quickstart — running in 5 minutes
- Sandbox Lifecycle — ephemeral, persistent, connect
- Images — customizing your environment
- Examples — runnable samples for every OS
Was this page helpful?