The screenshot viewer
Watch any of your workspace's desktops from the console while your code drives it. Observation only.
Every computer's page in the console has a Desktop tab that shows the desktop as it is now. Use it to watch a rollout your code is driving, to check a task's setup before you act, or to see why a checker said what it said.
Open it
- Start a desktop from your code (or launch one under Computers > Launch computer).
- In the console, open Computers and select the computer. Its id is the
env.idyour code prints. - The Desktop tab is selected by default.
import drums
# leave the desktop running after the script exits
client = drums.connect(close_on_exit=False)
# closed by its lifetime (600 s) if you forget it
env = client.create(task="e0df059f", ttl=600)
print("open Computers in the console and select", env.id)curl -s "$DRUMS_URL/v1/tasks/e0df059f" -H "Authorization: Bearer $DRUMS_TOKEN" \
| jq '{checkpoint: "osworld-ubuntu", task: ., ttl_s: 600}' \
| curl -s -X POST "$DRUMS_URL/v1/slots" -H "Authorization: Bearer $DRUMS_TOKEN" \
-H "Content-Type: application/json" -d @- \
| jq -r '"open Computers in the console and select " + .id'What it shows
| Element | Meaning |
|---|---|
| The frame | A screenshot fetched every 1.5 s, not a video stream. Polling pauses while the browser tab is hidden |
| Connection state | Live; Connecting; Stale frame when the newest frame is older than 5 s; Disconnected after repeated failures |
| Frame age and fetch time | How old the shown frame is, and when the gateway fetched it (UTC) |
| Observation only | There is no keyboard or mouse input from the browser. Act through the SDK or HTTP API |
| Fullscreen, Reconnect | View controls |
The viewer is available while the computer is Ready or In use.
How access works
The console never holds your API key. When you open the Desktop tab, the console asks the gateway for a viewer grant: a signed URL for one computer that is valid for 60 seconds and is renewed after 45 seconds while you watch. On every frame the gateway checks the grant, that you are still an active member of the workspace, and that the computer still is the same desktop (a frame is never shown from a different desktop that later reused the same host slot). Frames are limited to 2 per second per grant and cached for 750 ms, so several viewers of one desktop share one screenshot.
From code
The same picture is available to your code as a PNG:
import drums
with drums.connect() as client:
with client.create(ttl=600) as env:
open("frame.png", "wb").write(env.screenshot()) # 1920 x 1080 PNG