Skip to main content

use-computer Python SDK

Python client for use.computer — rent dedicated VMs across macOS, iOS/visionOS/tvOS simulators, Windows, and Ubuntu built for computer-use agents.

pip install use-computer
export USE_COMPUTER_API_KEY=uc_live_...

Optional agent and Harbor integrations are installed explicitly:

pip install "use-computer[agents]"        # computer-use agents and provider SDKs
pip install "use-computer[harbor]"        # Harbor agent wrapper dependencies
pip install "use-computer[harbor,agents]" # Harbor agent wrappers plus agents

Base installs only the SDK client and httpx. The agents extra installs the agent runtime plus model-provider dependencies; harbor installs Harbor for use_computer.harbor.agents.

Sandboxes default to ephemeral=True, so they are deleted after roughly 2 minutes without activity. Use ephemeral=False when a sandbox should persist until manual deletion, or call sandbox.start_keepalive(interval=30) during long model-think/install periods.

from use_computer.agents import AnthropicComputerAgent

In Harbor job YAML, use Harbor's built-in use.computer environment and the SDK agent wrappers:

environment:
  type: use-computer
  kwargs:
    platform: macos
agents:
  - import_path: use_computer.harbor.agents:AnthropicCUAAgent
    model_name: anthropic/claude-sonnet-4-6
from use_computer import Computer, SandboxType, SimulatorFamily

client = Computer()
reservation = client.reserve(hours=24)

with client.create(type="macos", reservation_id=reservation.id) as mac:
    mac.exec_ssh("open -a TextEdit")
    mac.keyboard.type("hello")
    png = mac.screenshot.take_full_screen()

with Computer().create(type=SandboxType.IOS, family=SimulatorFamily.TV) as tv:
    tv.screenshot.take_full_screen()
    tv.input.press_remote("select")

with Computer().create(type=SandboxType.IOS) as ios:
    ios.input.long_press(120, 300, duration=1.0)
    print(ios.exec("simctl getenv $UDID HOME").stdout)  # CoreSimulator exec, not SSH

# Only needed when the same account key has more than one active Mac reservation.
with Computer().create(type="macos", reservation_id="...") as mac:
    print(mac.exec_ssh("uname -a").stdout)

Each reserved Mac Mini supports up to 2 parallel macOS VMs. Check Computer().platforms(reservation_id=...)["macos"]["capacity"] for the selected reservation's max and used counts. iOS capacity is reported separately under ["ios"]["capacity"].

Windows (Beta)

with Computer().create(type="windows") as win:
    print(win.run("$env:COMPUTERNAME").stdout)  # PowerShell exec (no SSH)
    win.keyboard.type("hello")
    win.screenshot.take_full_screen()
    win.ui_tree()  # native Windows UIAutomation tree

Windows sandboxes are Beta (admin-only). Same mouse/keyboard/screenshot/ recording/file surface as macOS; exec runs in-guest via PowerShell/cmd (win.run / win.shell) instead of SSH. AsyncWindowsSandbox mirrors it. See docs.use.computer/docs/windows.

Selectable Windows images are exposed by Computer().platforms()["windows"]. Prefer version="windows-11" plus resources={"cpus": 4, "memory_mb": 4096, "disk_gb": 40} to select a resource profile. Explicit image IDs such as windows-11-4c4g40g still work. The image metadata includes CPU/RAM/disk and display size.

Ubuntu (Beta)

with Computer().create(type="ubuntu", version="ubuntu-24.04") as ubuntu:
    print(ubuntu.run("uname -a").stdout)  # bash exec (no SSH)
    print(ubuntu.display.get_info())
    ubuntu.keyboard.type("hello")
    ubuntu.screenshot.take_full_screen()

Ubuntu sandboxes are Beta (admin-only). They use the same KVM/noVNC backend as Windows; pass version="ubuntu-24.04" plus resources to select CPU/RAM/disk. Ubuntu and Windows share a per-account KVM concurrency limit. The default is 8 running desktops; when the limit is hit, create() raises SandboxLimitReachedError with limit and running fields from the gateway's HTTP 429 response.

Selectable Ubuntu images are exposed by Computer().platforms()["ubuntu"]. Current examples include ubuntu-24.04, ubuntu-24.04-4c4g80g, ubuntu-24.04-4c4g40g, and ubuntu-24.04-2c4g40g.

client = Computer()
platforms = client.platforms()
for image in platforms["ubuntu"]["images"]:
    print(image["version"], image["resources"], image["display"])

with client.create(
    type="ubuntu",
    version="ubuntu-24.04",
    resources={"cpus": 2, "memory_mb": 4096, "disk_gb": 40},
) as ubuntu:
    print(ubuntu.display.get_info())

Snapshots (Beta)

macOS, Windows, and Ubuntu snapshots let you seed a VM once, snapshot it, then create new sandboxes from that snapshot version. macOS snapshots preserve disk state. Windows and Ubuntu snapshots preserve disk + RAM state, including open apps and running processes.

macOS snapshot launch is slower because the gateway stores a portable disk-delta artifact and transfers it to the Mac Mini that claims the new VM. Windows and Ubuntu snapshots restore disk + RAM on their desktop host.

client = Computer()

# Configure the desktop by hand over VNC, then snapshot it.
with client.create(type="macos") as mac:
    print("Set up the desktop here:", mac.vnc_url)
    # install apps, sign into accounts, create files your agent starts from
    input("Press Enter once the desktop is ready to snapshot...")
    snapshot = mac.snapshot("chrome-seeded-macos")

# New sandboxes boot from that saved state, no setup needed.
with client.create(type="macos", snapshot=snapshot.version) as seeded:
    print(seeded.vnc_url)  # installed apps, files, and logins restored

Use client.snapshots("macos"), client.snapshots("ubuntu"), or client.snapshots("windows") to list saved snapshot versions.

Full DSL reference: docs.use.computer/docs/sdk

Simulator sandboxes use type=SandboxType.IOS for the SDK route, but device_type and runtime can target any installed compatible CoreSimulator pair: iPhone or iPad with iOS, Apple Watch with watchOS, Apple TV with tvOS, or Apple Vision with visionOS. Prefer family=SimulatorFamily.TV/WATCH/VISION unless you need to pin raw CoreSimulator identifiers. Raw strings like type="ios" still work for compatibility. If omitted, the gateway defaults to iPhone 17 Pro on the latest installed iOS runtime. Known-incompatible simulator types are filtered from family selection, including the non-4K Apple Vision Pro type on current fleet runtimes. For iOS app installs, upload the .app / .ipa first and pass the same path to sandbox.apps.install(path); files are staged on the simulator host.

Per-family input

iPhone / iPad sims have full touch + on-screen keyboard. Apple Watch supports touch + crown / button (no type_text — watchOS keyboard isn't exposed). Apple TV has no touch — drive it with input.press_remote(RemoteButton.SELECT) (the remote D-pad, select, menu, home, play/pause). Apple Vision (visionOS) is BETA: sessions display and you can screenshot / launch apps, but input.tap is a no-op because there's no XCTest-free coordinate tap path on visionOS yet. Use it for read-only flows for now.

Examples

File What it shows
examples/_1_hello_macos.py create → exec → keyboard → screenshot
examples/_2_hello_ios.py create iPhone sim → open URL → screenshot
examples/_3_recording.py start / stop / download a screen recording
examples/_4_file_transfer.py upload bytes, download a file back
examples/_5_keepalive.py heartbeat for ephemeral sessions idle > 2 min
examples/_6_hello_tvos.py tvOS: pick TV family + drive the Apple Remote
examples/_7_hello_windows.py create Windows → run PowerShell → screenshot
examples/_8_hello_ubuntu.py create Ubuntu → run bash → screenshot
examples/_9_seeding.py typed setup: files, hosts, open URLs/apps
examples/_10_snapshots.py snapshot seeded macOS/Ubuntu/Windows state

For agent loops and evals: use-computer-cookbook. Harbor job YAMLs should use Harbor's type: use-computer environment plus use_computer.harbor.agents:* agent wrappers.

Skill for AI coding assistants

Point your assistant at use-computer-cookbook/skills/SKILL.md — short body with per-topic references for macOS, Apple simulators, lifecycle, and the Harbor harness.

HTTP API

Every SDK method wraps https://api.use.computer/v1/... with Authorization: Bearer uc_live_.... Swagger: api.use.computer/docs. OpenAPI spec: api.use.computer/openapi.yaml.

Metadata

Release files for use-computer 0.0.45

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for use-computer 0.0.45
File Size Uploaded
use_computer-0.0.45.tar.gz 487.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for use-computer 0.0.45
File Interpreter ABI Platform
use_computer-0.0.45-py3-none-any.whl Python 3 none any Details

Total release size: 606.7 kB

Release files / use_computer-0.0.45.tar.gz

Download URL use_computer-0.0.45.tar.gz
Size 487.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0b34e68b67de1b16886ba69b51497734497fbf2bdce59d467bce7da6fba8f865
BLAKE2b-256 checksum
How to use checksums
5039589caaf9d987190d0faecdce35e6f2e1e855342ef3649cd4f7dabb23eb7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / use_computer-0.0.45-py3-none-any.whl

Download URL use_computer-0.0.45-py3-none-any.whl
Size 119.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8f81d2d0894fe3b743f9866d3857b63695b854581068c43370fb1429f7a3080
BLAKE2b-256 checksum
How to use checksums
4d80c50f482d6cc0f9f2f9a8fa7ef664875118ec2ea24353e90783bf7007fe2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

This release

0.0.45 This release

2 release files

0.0.44

2 release files

0.0.43

2 release files

0.0.42

2 release files

0.0.39

2 release files

0.0.38

2 release files

0.0.37

2 release files

0.0.36

2 release files

0.0.35

2 release files

0.0.34

2 release files

0.0.33

2 release files

0.0.32

2 release files

0.0.31

2 release files

0.0.30

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page