Computer use
Linux desktop sandboxes an agent can see and drive - screenshots, clicks, typing, recordings and a live view for humans.
A desktop sandbox boots a Linux desktop (1280x800) with Chromium. The computer API lets an agent take screenshots and send mouse and keyboard input; a short-lived live view URL lets a person watch or take over in the browser; recordings capture a session as MP4.
Create a desktop and drive it#
import { writeFileSync } from "node:fs";
import { Sandal } from "@sandal-dev/sdk";
const sandal = Sandal.fromEnv();
const desk = await sandal.createSandbox({ desktop: true, name: "agent-desktop", ttlSeconds: 3600 });
try {
// The desktop session comes up a second or two after the sandbox is running.
while (!/ready/i.test(JSON.stringify(await sandal.computer.status(desk.id)))) await new Promise((r) => setTimeout(r, 1000));
await sandal.computer.openUrl(desk.id, "https://example.com/");
await sandal.computer.click(desk.id, 640, 400);
await sandal.computer.typeText(desk.id, "hello");
await sandal.computer.actions(desk.id, [{ kind: "hotkey", keys: ["ctrl", "l"] }]);
const shot = await sandal.computer.screenshot(desk.id, { format: "png" });
writeFileSync("desktop.png", shot.data);
const view = await sandal.computer.view(desk.id, { ttlSeconds: 300 });
console.log("watch live:", view.url); // a one-person link; treat it like a password
} finally {
await desk.delete();
}Recordings#
computer.startRecording(id, { maxDurationSeconds }) starts an MP4 recording; stopRecording finishes it and downloadRecording returns the bytes (deleteAfterRead: true removes it afterwards). Python and Go have the same calls (start_recording, StartRecording, ...).
Speed#
Measured on production (November 2026): desktop ready 17-22 s after create; PNG screenshot about 0.4 s (JPEG quality 70 about 1.4 s); open URL and click about 0.4 s; typing and hotkeys about 1.3 s.
Limits#
- Desktops run on the default VM runtime, not on Full VMs.
- A live-view URL is a short-lived credential for one browser: do not paste it into shared channels.
- A project without the
desktop/computer-usecapability getscapability_unavailable; nothing is created.