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
2
Start the desktop
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.Desktops for your own users
Desktops for your own users
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 }).On a workspace key: relay VNC
On a workspace key: relay VNC
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.Over HTTP
Over HTTP
Desktop
Every desktop call, viewers, and link rules.
SDK reference
Sandbox and sbx.desktop in full.