agent-browser template (shown as standard) have a Linux desktop with a
browser. To watch it, open a machine in the dashboard and choose the Computer tab. Click the
desktop to take control. Control goes back to the agent after a minute without input, or 30 seconds after
you close the tab.
Let an agent drive it
move(x, y), drag([x1, y1], [x2, y2]), cursorPosition(), and status().
start() is safe to call again: it leaves a running desktop alone.
A minimal agent loop
A minimal agent loop
Share a link to the desktop
streamUrl() makes a link to a full-screen viewer of one machine’s desktop. The link works without
signing in, and you can embed it in an <iframe>.
- One machine. A link opens that machine’s desktop only. It is not an API key and cannot call the API.
- View-only is enforced by the server. Keyboard, mouse, and clipboard input from a view-only link
never reach the machine. Pass
viewOnly: falsefor a link that can control it. - Expiry stops new connections. A viewer that is already connected stays connected until it leaves.
- Revoke ends everything.
revokeStreamUrls()invalidates every link for the machine and closes open viewers within a few seconds. Deleting the machine does the same.
- Open the desktop over
GET /v1/machines/{id}/vnc, VNC in a WebSocket for a viewer such as noVNC. It needsmachines:write. - Read the screen with
sbx.desktop.screenshot().
Build a service for your own users
Keep your API key on your server, never in a browser. Make a fresh link each time a user opens their desktop, and revoke it when their access ends. Links belong to the creator, so this server runs on the personal key of the account that creates the machines, and it creates them with that key too.Sandbox.list({ metadata }), tag them with metadata such as
{ customer: 'acme' }.
Relay the desktop with a workspace key
Relay the desktop with a workspace key
Your server opens
GET /v1/machines/{id}/vnc, a WebSocket, with a key that has machines:write. It
passes the VNC stream to your user’s viewer, or sends them sbx.desktop.screenshot() images. Your
server then decides who sees what, and revoking means closing that connection.Each user has at most 8 open terminals and desktops at once, and a workspace key counts as its
workspace’s owner. A ninth /vnc connection gets a retryable 429 quota_exceeded, so close a
viewer’s connection when they leave.Start and share the desktop over HTTP
start does not install anything. On a template without the desktop (universal, t3), send
{"action": "install"} first, poll {"action": "status"} until installed is true (about half a minute),
then start. A start that started nothing answers with installed false and a hint naming the next call.
Both stream calls belong to the creator, as above: use a personal key with machines:write.
Computer use
An agent that browses and clicks on its own machine.
SDK quick start
Create, run and pause machines from code.