Skip to main content
At the end of this page, a model drives a browser on a Linux desktop in a machine, and you watch the same screen live in the dashboard or through a link you share. An agent that uses a computer needs a screen to look at and a mouse and keyboard to drive. Every agent-browser machine (the default template) has a Linux desktop with a browser. Your code takes screenshots and sends clicks and keys.
1

Install the SDK

Keep the key on your server, never in a browser.
2

Start the desktop

The machine’s browser now shows https://example.com on the desktop.
3

Let the model drive

yourModel.nextAction stands for your own call to a vision model. Each pass sends it a screenshot and carries out the action it returns, until it answers done or 20 steps have run.The desktop also takes press('Enter') or a chord such as press(['ctrl', 'l']), scroll({ direction: 'down', amount: 5 }), move(x, y), drag([x1, y1], [x2, y2]), and click(x, y, { button: 'right' }) or { double: true }. cursorPosition() and status() read its state.
4

Watch the desktop

In the dashboard, open the machine and choose the Computer tab. You see the desktop as the model drives it. 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.
5

Share a link

streamUrl returns the link as url, and when it expires as expiresAt. Put url in place of LINK_URL. The link opens a full-screen viewer of this machine’s desktop with no sign-in. It is not an API key. sbx.desktop.revokeStreamUrls() ends every link and closes open viewers within a few seconds.
Links belong to the machine’s creator. Only the person who created the machine, signed in or with their personal key, can make or revoke them. A workspace API key gets 403 permission_denied. It opens the desktop over GET /v1/machines/{id}/vnc instead (below).
Make a fresh link from your server each time a user opens their desktop. Revoke the links when their access ends:
This server runs on the personal key of the account that creates the machines. Tag machines with metadata: { customer: 'acme' } at create to find them later with Sandbox.list({ metadata }).
Your server opens GET /v1/machines/{id}/vnc with any key that has machines:write. The endpoint is a WebSocket carrying VNC, for a viewer such as noVNC. Your server passes the stream to your user’s viewer, or sends them sbx.desktop.screenshot() images.Each user has at most 8 open terminals and desktops at once, and a workspace key counts as its workspace’s owner. A ninth connection gets a retryable 429 quota_exceeded, so close a viewer’s connection when they leave.

Desktop

Every desktop call, viewers, and link rules.

SDK reference

Sandbox and sbx.desktop in full.