TheDocumentation 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.
Image class is an immutable, chainable image specification used to configure sandbox environments in Cua. Each builder method returns a new Image instance — the original is never mutated. This makes it safe to share base images across multiple sandboxes and to compose configurations freely.
Import Image from cua:
Constructors
Class methods that create a newImage for a specific operating system or source.
Image.linux
Creates a Linux image. Defaults to a QEMU VM running Ubuntu 24.04. Pass kind='container' to use Docker with an XFCE desktop instead.
Linux distribution name, e.g.
'ubuntu' or 'debian'.Distribution version string, e.g.
'24.04' or '22.04'.Runtime type.
'vm' for QEMU, 'container' for Docker/XFCE.Image
Image.macos
Creates a macOS image using Apple Virtualization or the Lume runtime. Always a VM.
Supported version strings: '15' / 'sequoia', '26' / 'tahoe'.
macOS version string or friendly name, e.g.
'26' or 'tahoe'.Always
'vm'. macOS sandboxes cannot run as containers.Image
Image.windows
Creates a Windows image. Always a VM (QEMU or Hyper-V).
Windows version string, e.g.
'11'.Always
'vm'.Image
Image.android
Creates an Android image. Always a VM (QEMU emulator).
Android version string, e.g.
'14'.Always
'vm'.Image
Image.from_registry
Creates an image from an OCI registry reference. The kind is resolved automatically after the image is pulled.
OCI registry reference, e.g.
'ghcr.io/trycua/macos-tahoe-cua:latest' or 'ubuntu:22.04'.Image
Image.from_file
Creates an image from a local disk file, ISO, or HTTP/HTTPS URL. Supported formats: qcow2, vhdx, raw, img, iso. Downloaded images are cached in ~/.cua/cua-sandbox/image-cache/. Zip archives are extracted automatically. For ISOs, a qcow2 disk is created and the ISO is attached as a CD-ROM.
Local filesystem path or an
http/https URL pointing to the image file.Target operating system:
'linux', 'windows', 'macos', or 'android'.Runtime type:
'vm' or 'container'.Optional agent type. Use
'osworld' to enable the OSWorld Flask server inside the VM.Image
Image.from_dict
Reconstructs an Image from a serialized spec dictionary, such as the output of Image.to_dict(). Useful for persisting and restoring image configurations.
A dictionary previously produced by
Image.to_dict().Image
Builder Methods
Builder methods return a newImage with the additional layer applied. They can be chained in any order.
Package installation
Install one or more packages via
apt. Linux only.Install one or more packages via Homebrew. macOS only.
Install one or more packages via Chocolatey. Windows only.
Install one or more packages via
winget. Windows only.Install one or more APK files via
adb. Android only.Install one or more Python packages via
pip. Works across all OS types.Install one or more Python packages via
uv add into the cua-server project. Faster than pip_install.Android PWA installation
.pwa_install() builds an APK from a Progressive Web App manifest URL and installs it via adb. Android only.
Full URL to the PWA’s
manifest.json.Android package ID (e.g.
'com.example.myapp'). Derived from the manifest hostname if omitted.Path to a
.keystore or .jks file. Auto-generated and cached if omitted.Key alias inside the keystore.
Password for both the keystore and the key.
APK builder backend.
'pwa2apk' produces a lightweight WebView APK. 'bubblewrap' builds a Trusted Web Activity (TWA) — requires the SHA-256 fingerprint to match the server’s /.well-known/assetlinks.json.Timeout in seconds for the
adb install push step.Image
Environment and files
Set environment variables that will be present in the sandbox. Values are stored in the spec in plaintext — do not use for secrets.
Copy a local file into the image at the specified destination path.
Execute an arbitrary shell command during image setup.
Mark a TCP port the sandbox will serve on. Works in combination with
sb.tunnel.forward() for port forwarding.Chaining example
Builder calls are fully composable:Serialization
Image.to_dict
Serializes the Image to a plain dictionary suitable for JSON or the Cua cloud API.
Dict[str, Any]
Image.to_cloud_init
Generates a cloud-init user-data script from the image layers. Useful for provisioning VMs directly.
Returns: str
Attributes
These read-only attributes describe the resolved image specification.The operating system family:
'linux', 'macos', 'windows', or 'android'.The distribution name (e.g.
'ubuntu'). Empty string for non-Linux images.The version string (e.g.
'24.04', '26', '11', '14').The runtime type:
'container' or 'vm'. May be None before the image is pulled from a registry.