Start a sandbox with a Linux desktop, watch and control it in a browser, and let an agent click, type and take screenshots.
The desktop template is the ubuntu template with an Xfce desktop and Firefox. The sandbox streams its desktop to a browser on port 6080.
Open a desktop
- Create a sandbox from the
desktoptemplate:
curl -sS --fail-with-body https://api.munito.ai/sandboxes/v1/sandboxes \
-H "Authorization: Bearer $MUNITO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"template": "desktop"}'- Get a signed URL of port 6080:
curl -sS --fail-with-body -X POST "https://api.munito.ai/sandboxes/v1/sandboxes/$SANDBOX/ports/6080/url" \
-H "Authorization: Bearer $MUNITO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"expires_in": 3600}'- Open the
urlin a browser. Use the keyboard and the mouse as on your own computer.
- A desktop needs 2 vCPUs and 4 GiB at least. A create without
sizegets thedefaultsize, and the API refusessmall. - A desktop starts in less than one second, as the other templates do.
- The viewer fits the screen to your browser window.
- Port 6080 is private. A person with the signed URL can see and control the desktop until the URL ends. See ports and SSH.
Control a desktop from an agent
An agent controls the desktop with commands. Send each command to POST /sandboxes/{sandbox_id}/exec. The commands find the screen at once:
| Task | Command |
|---|---|
| Take a screenshot | scrot -o /tmp/screen.png, then GET /sandboxes/{sandbox_id}/files/content?path=/tmp/screen.png |
| Move the mouse and click | xdotool mousemove 640 400 click 1 |
| Type text | xdotool type 'hello' |
| Press keys | xdotool key ctrl+l |
| Open a page | nohup firefox https://example.com >/dev/null 2>&1 & |
- For screenshots of one size, set the size of the screen:
munito-desktop size 1280x800. The viewer then keeps this size.munito-desktop size autolets the viewer fit the screen to its window again. - To change the frame rate of the stream, use
munito-desktop fps 60. The frame rate is from 8 to 60, and the default is 30. A higher frame rate uses more of the sandbox's vCPUs.
Price
A desktop adds $0.10 for each hour that it runs, on any size. A default desktop pays $0.118 an hour: $0.018 for its size and $0.10 for the desktop. See pricing and limits.
- The stream sends only the parts of the screen that change. A still screen uses almost no CPU.