Cua lets you create isolated, agent-ready computers from Python with a singleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/trycua/cua/llms.txt
Use this file to discover all available pages before exploring further.
async with block. This quickstart walks you through installing the SDK, creating an ephemeral Linux desktop container, running a shell command inside it, and saving a screenshot — then watching the sandbox clean itself up automatically.
Prerequisites: Python 3.12 or 3.13 and Docker Desktop or Docker Engine running on your machine.
Steps
Install the Cua SDK
Open a terminal and install the This installs
cua meta-package from PyPI:cua-sandbox, cua-agent, and cua-cli together. The sandbox SDK alone (cua-sandbox) supports Python 3.11–3.13 if you need an earlier version.Create the script
Create a file named The
quickstart.py with the following content:quickstart.py
Image.linux(kind="container") argument selects a lightweight Linux desktop container. The same API accepts .macos(), .windows(), or .android() when you need a different OS.Run it
Execute the script from the same directory:You should see output similar to:A new file called
screenshot.png will appear in your current directory showing the sandbox desktop.Understand what happened
Sandbox.ephemeral(..., local=True) created a Linux desktop container through Docker. The script ran uname -a inside that container, set and read the clipboard, and captured a screenshot of the desktop. When the async with block exited, the sandbox destroyed itself — no cleanup needed.Supported OS targets
The sameSandbox API works across operating systems, both locally and in the cloud:
| Target | Image call | Local backend |
|---|---|---|
| Linux container | Image.linux(kind="container") | Docker |
| Linux VM | Image.linux(kind="vm") | QEMU |
| macOS VM | Image.macos() | Lume (Apple Silicon) |
| Windows VM | Image.windows() | QEMU / Hyper-V |
| Android VM | Image.android() | QEMU |
More sandbox operations
Once you have a sandbox, you can interact with it through mouse, keyboard, and more:quickstart_full.py
Next steps
Drive a real app
Use Cua Driver to give an agent access to your existing desktop apps via MCP.
First Sandbox tutorial
A deeper walkthrough of the Sandbox API, including clipboard, screenshots, and lifecycle management.
How sandboxes work
Understand the isolation model, runtime backends, ephemeral vs. persistent, and image composition.
Create a macOS VM
Set up a full macOS VM on Apple Silicon using the Lume CLI.