Developers
Ten lines of Python get an agent a desktop, work it, and give it back. Watch each line become an HTTP call.
# illustrative: not run against a live servicefrom deskspawn import Deskspawn ds = Deskspawn(api_key="YOUR_KEY")with ds.computer() as c: c.click(400, 300) png = c.screenshot() c.type("hello") c.key("Return") c.scroll(400, 300, "down", 3) out = c.bash("ls /tmp") c.save_screenshot("shot.png")
- POST
/v1/computers Needs the fleet key. Hands out a warm desktop with its own bearer token, shown once.
- POST
/v1/computers/ {id}/ control/ click Needs the desktop's token. The fleet's proxy forwards it to that desktop.
- GET
/v1/computers/ {id}/ control/ screenshot Returns the screen as a PNG.
- POST
/v1/computers/ {id}/ control/ type Types the text.
- POST
/v1/computers/ {id}/ control/ key Presses a key.
- POST
/v1/computers/ {id}/ control/ scroll Scrolls at a point on the screen.
- POST
/v1/computers/ {id}/ control/ bash Runs a shell command and returns its exit code, stdout and stderr.
- GET
/v1/computers/ {id}/ control/ screenshot Saves the screen to a file.
- DELETE
/v1/computers/ {id} Leaving the with block destroys the desktop. The container is removed, not reused.
The HTTP API
Two kinds of credential. The fleet key opens the fleet. A desktop's own bearer token opens that desktop and nothing else.
| Route | Needs | Does |
|---|---|---|
GET /health | Nothing | Says the fleet is up. |
GET /v1/pool | Fleet key | Reads the warm pool. |
GET, POST /v1/computers | Fleet key | Lists desktops, or hands one out. |
GET, DELETE /v1/computers/{id} | Desktop token | Reads one desktop, or destroys it. |
POST /v1/computers/{id}/pause, /resume | Desktop token | Freezes a desktop, or wakes it. |
POST /v1/computers/{id}/stop, /start | Desktop token | Stops a desktop and keeps its home, or starts it again. |
ANY /v1/computers/{id}/control/* | Desktop token | The control verbs: screenshot, click, type, key, scroll and bash. |
The same in JavaScript
The JavaScript client has the same shape, with camelCase names and promises.
The Python client uses only the standard library: nothing to install. The Python client also has a command line with pool, new, ls, shot, click, type, key, scroll, bash, pause, resume, rm, vnc and run.
The clients are part of the private prototype and are not published yet. Ask about access.
// illustrative: not run against a live service
import { Deskspawn } from "./deskspawn.mjs";
const ds = new Deskspawn({ apiKey: "YOUR_KEY" });
await ds.withComputer(async (c) => {
await c.click(400, 300);
const png = await c.screenshot();
await c.type("hello");
await c.key("Return");
await c.scroll(400, 300, -3);
const out = await c.bash("ls /tmp");
await c.saveScreenshot("shot.png");
});