use-computer-sdk
v0.1.12
Published
TypeScript SDK for use.computer — rent dedicated VMs (macOS, iOS/visionOS/tvOS simulators, Windows, Ubuntu) built for computer-use agents.
Maintainers
Readme
use-computer — TypeScript SDK
TypeScript/JavaScript client for use.computer — rent dedicated VMs (macOS, iOS/visionOS/tvOS simulators, Windows, Ubuntu) built for computer-use agents. Parity with the Python SDK; async-native.
npm install use-computer-sdk
export USE_COMPUTER_API_KEY=uc_live_...import { Computer } from "use-computer-sdk";
const computer = new Computer(); // baseUrl + apiKey from env, or pass {baseUrl, apiKey}
// macOS (default)
const reservation = await computer.reserve({ hours: 24 });
const mac = await computer.create({ type: "macos", reservationId: reservation.id });
await mac.execSsh("open -a TextEdit");
await mac.keyboard.type("hello");
const png = await mac.screenshot.takeFullScreen();
await mac.close();
// Each reserved Mac Mini supports up to 2 parallel macOS VMs.
console.log((await computer.platforms(reservation.id)).macos.capacity);
// Windows (Beta) — no SSH; exec runs in-guest via PowerShell/cmd
const win = await computer.create({ type: "windows", version: "windows-11" });
try {
console.log((await win.run("$env:COMPUTERNAME")).stdout);
await win.mouse.click(400, 300);
await win.keyboard.type("hello from use.computer");
const tree = await win.uiTree(); // native Windows UIAutomation tree
} finally {
await win.close();
}
// iOS simulator
const ios = await computer.create({ type: "ios", family: "iphone" });
await ios.tap(120, 300);
console.log((await ios.exec("simctl getenv $UDID HOME")).stdout); // CoreSimulator exec, not SSH
// Ubuntu
const ubuntu = await computer.create({ type: "ubuntu", version: "ubuntu-24.04" });
try {
console.log((await ubuntu.run("uname -a")).stdout);
} finally {
await ubuntu.close();
}Surface
Computer.reserve({ hours?, miniCount? })→ reserve one Mac Mini from account credits.Computer.create({ type, reservationId?, version?, host?, family?, deviceType?, runtime?, resources?, ephemeral? })→ typed sandbox.ephemeraldefaults true; set it false when the sandbox should persist until manual deletion, or callsandbox.keepalive()during long idle periods. KVM CPU/RAM/diskresourcesselects the matching baked Windows/Ubuntu image profile. Ubuntu and Windows share a default 8-sandbox account limit; create throwsSandboxLimitReachedErroron HTTP 429 withlimitandrunning.Computer.platforms(reservationId?)→ discover available platforms. For Mac reservations,macos.capacityreportsmaxandusedmacOS VMs; the limit is 2 macOS VMs per reserved Mac Mini. Admin keys includewindows.imagesandubuntu.imageswith selectableversion,resources, anddisplaymetadata.- All sandboxes:
screenshot.takeFullScreen()/takeCompressed(),recording.start()/stop()/listAll()/download(),uiTree(),displayInfo(),upload(bytes, path),download(path),keepalive(),close(). - macOS / Windows / Ubuntu:
mouse.move/click/doubleClick/scroll/drag/position,keyboard.type/press/hotkey. - macOS:
execSsh(cmd). Windows:run(cmd, "powershell"|"cmd")(no SSH). Ubuntu:run(cmd, "bash"|"sh")(no SSH;execis an alias). - iOS:
tap,pressButton,pressRemote,launch, staged upload +install(path),execvia scopedsimctlscripts (no SSH/shell), no axe-schemauiTree.
KVM Images
Use platforms() to list the currently deployed Windows/Ubuntu image options:
const platforms = await computer.platforms();
console.log(platforms.windows.images);
console.log(platforms.ubuntu.images);
const win = await computer.create({
type: "windows",
version: "windows-11",
resources: { cpus: 4, memory_mb: 4096, disk_gb: 40 },
});
await win.close();
// OSWorld images use the same DSL when deployed.
const osworld = await computer.create({ type: "windows", version: "osworld" });
await osworld.close();Current profiles include 4 CPU / 4 GB RAM / 80 GB disk, 4 CPU / 4 GB RAM /
40 GB disk, and 2 CPU / 4 GB RAM / 40 GB disk for both Windows 11 and Ubuntu
24.04. Explicit image IDs such as windows-11-4c4g40g still work, but new code
should prefer version: "windows-11" plus resources.
Docs: docs.use.computer. Windows and Ubuntu are Beta (admin-only).
