SDK & API
Python, TypeScript, and Go SDKs and the raw HTTP surface for api.use.computer.
SDKs (Python · TypeScript · Go)
All SDKs live in one monorepo, josancamon19/use-computer-sdk, and expose the same sandbox surface — create({ type, version, ... }) for macOS / iOS / Windows / Ubuntu, plus mouse, keyboard, screenshot, exec/run, files, recording, and the native UI tree. Pick your language:
| Language | Install | Path |
|---|---|---|
| Python | pip install use-computer | python/ |
| TypeScript / JS | npm install use-computer-sdk | js/ |
| Go | go get github.com/josancamon19/use-computer-sdk/go | go/ |
// TypeScript — async-native
import { Computer } from "use-computer-sdk";
const win = await new Computer().create({ type: "windows", version: "windows-11" });
console.log((await win.run("$env:COMPUTERNAME")).stdout);
await win.close();// Go — context-based
c := usecomputer.New()
win, _ := c.Create(ctx, usecomputer.CreateOptions{Type: usecomputer.Windows})
r, _ := win.RunShell(ctx, "$env:COMPUTERNAME", "powershell")
defer win.Close(ctx)Ubuntu is available on customer keys today; Windows is coming soon (admin-only beta), see Windows & Ubuntu. The rest of this page covers the Python SDK in depth. The TypeScript and Go SDKs mirror the sandbox surface; Python additionally ships optional computer-use agents and Harbor adapters behind extras.
Desktop Snapshots
Ubuntu sandboxes can be snapshotted after you seed them, usually by opening the live desktop over VNC and setting it up by hand. A snapshot captures disk + RAM state, so installed apps, logins, browser sessions, open windows, and running processes are all present when you create a new sandbox from it. Windows joins when Windows sandboxes open up.
from use_computer import Computer
client = Computer(api_key="uc_live_...")
# Boot a desktop and configure it by hand over VNC, then snapshot it.
with client.create(type="ubuntu", version="ubuntu-24.04") as ubuntu:
print("Set up the desktop here:", ubuntu.vnc_url)
# In the VNC session, bake whatever you want into the image:
# - install the apps and tools your agent needs
# - sign into accounts (email, GitHub, a web app)
# - pre-open the tabs, windows, or files it should start from
input("Press Enter once the desktop is ready to snapshot...")
# Freeze disk + RAM (open apps and logins included) as a reusable image.
snapshot = ubuntu.snapshot("chrome-seeded-ubuntu")
# Every future sandbox boots from that exact state, no setup needed.
with client.create(type="ubuntu", snapshot=snapshot.version) as seeded:
print(seeded.vnc_url) # installed apps, logins, and open windows restoredUse client.snapshots("ubuntu") to list saved snapshot versions. The same flow
will work with type="windows" and version="windows-11" once Windows is on
customer keys.
Python SDK
The Python SDK lives at use-computer-sdk/python.
pip install use-computerBase installs only the SDK client and httpx. Agent and Harbor integrations are opt-in:
pip install "use-computer[agents]" # computer-use agents and provider SDKs
pip install "use-computer[harbor]" # Harbor environment adapter, Python 3.12+
pip install "use-computer[harbor,agents]" # Harbor adapter plus agentsCanonical Harbor import paths are use_computer.harbor.environment:UseComputerEnvironment and use_computer.harbor.agents:*.
environment:
import_path: use_computer.harbor.environment:UseComputerEnvironment
kwargs:
platform: macos
agents:
- import_path: use_computer.harbor.agents:AnthropicCUAAgent
model_name: anthropic/claude-sonnet-4-6For coding agents, the use-computer SDK skill lives at runner/skills/SKILL.md. It includes the setup, platform control surfaces, keepalive notes, and model-coordinate scaling rules.
from use_computer import Computer, SandboxType, SimulatorFamily
client = Computer(api_key="uc_live_...")Creating a sandbox
mac = client.create(type=SandboxType.MACOS)
ios = client.create(type=SandboxType.IOS)
watch = client.create(type=SandboxType.IOS, family=SimulatorFamily.WATCH)type=SandboxType.IOS is the simulator route. By default it picks iPhone 17 Pro
on the latest installed iOS runtime. Prefer family=SimulatorFamily.IPHONE,
IPAD, or WATCH when choosing a simulator family; the SDK discovers
/v1/platforms and sends a compatible device_type + runtime pair.
Raw strings like type="ios" still work for compatibility, and you can still
pass device_type and runtime directly to pin exact CoreSimulator identifiers.
The runtime must match the family: iPhone/iPad -> iOS, Watch -> watchOS.
SimulatorFamily.TV and VISION exist in the SDK but the fleet runtimes are
coming soon.
If one account key has more than one active Mac reservation, pass
reservation_id="..." when creating macOS or iOS sandboxes.
ios.exec("simctl getenv $UDID HOME") runs CoreSimulator-scoped commands for
setup/debugging. It is not SSH and does not provide a shell; each script line
must be simctl ... or xcrun simctl ... and target $UDID, ${UDID},
booted, or the current simulator UDID.
Per-family input notes:
- iPhone / iPad — full touch + on-screen keyboard via
input.tap,input.swipe,input.type_text. - Apple Watch — touch + crown / side button.
input.type_textis unsupported (watchOS keyboard isn't exposed); useinput.press_key/input.swipeinstead. - Apple TV / Apple Vision: coming soon.
DSL
MacOSSandbox and IOSSandbox share a base (screenshot, display, recording, file transfer). The columns mark which client supports each call.
| Method | macOS | iOS | Notes |
|---|---|---|---|
screenshot.take_full_screen(show_cursor=False) | ✓ | ✓ | PNG bytes. |
screenshot.take_region(x, y, w, h) | ✓ | ✓ | PNG bytes of a region. |
screenshot.take_compressed(...) | ✓ | ✓ | JPEG/PNG with quality control. |
display.get_info() | ✓ | ✓ | Screen size, scale. |
display.get_windows() | ✓ | ✓ | Accessibility tree. |
recording.start(name=None) / .stop(id) | ✓ | ✓ | Start / stop screen recording. |
recording.download(id, local_path) | ✓ | ✓ | Save mp4 to disk. |
recording.list_all() / get(id) / delete(id) | ✓ | Manage recordings (macOS only for now). | |
upload(local, remote) / upload_bytes(data, p) | ✓ | ✓ | Upload a file. iOS stages it on the simulator host for install flows. |
download_file(remote, local) | ✓ | ✓ | Download a file. iOS reads from that per-simulator staging area. |
mouse.click(x, y, button="left", double=False) | ✓ | Native CGEvent click. | |
mouse.move(x, y) / drag(start, end, ...) | ✓ | Cursor move / press-move-release. | |
mouse.scroll(x, y, direction="down", amount=3) | ✓ | Scroll wheel. | |
mouse.get_position() | ✓ | Cursor x, y. | |
keyboard.type(text, delay=None) | ✓ | Typed input (macOS). | |
keyboard.press(key, modifiers=None) | ✓ | Single key + optional modifiers. | |
keyboard.hotkey(keys) | ✓ | Multi-key chord (e.g. "cmd+shift+4"). | |
exec_ssh(cmd, timeout=120) | ✓ | Shell command via SSH. | |
exec_ax(cmd, timeout=120) | ✓ | Runs under cua-server (TCC-granted; needed for AX APIs). | |
exec(cmd, timeout=120) | ✓ | CoreSimulator-scoped exec/debug script. Not SSH. | |
act(action: dict, screenshot_after=True, ...) | ✓ | Drive any cua-server action; returns the post-action screenshot. | |
upload_dir(local, remote) / download_dir(...) | ✓ | Tar + push / pull + untar a directory. | |
input.tap(x, y) | ✓ | Tap. | |
input.long_press(x, y, duration=1.0) | ✓ | Touch and hold for duration seconds. | |
input.swipe(from_x, from_y, to_x, to_y) | ✓ | Swipe (use for scroll / drag too). | |
input.type_text(text) | ✓ | Typed input on iPhone/iPad simulators; unsupported on watchOS. | |
input.press_button(Button.HOME) | ✓ | Hardware button: home, lock, volume_up, volume_down, etc. | |
input.press_key(Key.RETURN) | ✓ | Single hardware-keyboard keycode. | |
input.press_remote(RemoteButton.SELECT) | ✓ | Apple TV remote: up/down/left/right, select, menu, home, play_pause. tvOS only. | |
apps.open_url(url) | ✓ | Open a URL via the system handler. | |
apps.install(app_path) | ✓ | Install a staged .app / .ipa; upload it first and pass the same path. | |
apps.launch(bundle_id) / terminate(bundle_id) | ✓ | Launch / terminate an app. | |
environment.set_location(lat, lon) / clear_… | ✓ | Simulated GPS. | |
environment.set_appearance("light" | "dark") | ✓ | Light / dark mode toggle. |
Keep-alive and cleanup
The idle reaper kills sandboxes that go ~2 min without activity. The SDK has both covered:
with client.create() as mac: # context manager: auto destroy on exit
mac.start_keepalive(interval=30) # background heartbeat thread
... # long-running agent work
# leaves the with block → keepalive stops + sandbox destroyedIf you can't use with, call mac.start_keepalive() and mac.close() explicitly.
HTTP API
Not on Python? Every SDK method is a thin wrapper over https://api.use.computer/v1/... — auth is Authorization: Bearer uc_live_.... The full surface is documented as an interactive Swagger viewer at api.use.computer/docs, with the raw spec at api.use.computer/openapi.yaml for Postman / Insomnia.