Skip to main content
Use display controls to capture screenshots of a Devbox, click anywhere on its screen, and type into the focused app. Together they let an agent see what an app shows and act on it, for example to check that a page renders or to click through a flow that has no command-line equivalent.
Display controls are available on macOS Devboxes only. See Create a Devbox.

Take screenshots

Capture the full screen as a PNG. The screenshot is 2560 by 1600 pixels.
The CLI prints the screenshot size, in the same pixels that devbox desktop click uses. Pass --file - to write the PNG to stdout instead.
The result is a full-screen capture, ready to pass to your model:
A screenshot of a macOS Devbox desktop with namespace.so open in Safari

Click the mouse

Click at a point on the screen. Coordinates are in screenshot pixels, with (0, 0) at the top-left corner, so a point read from a screenshot can be passed as is.
Pass --button right or --button middle to click another mouse button.
A click returns as soon as it is sent, before the app reacts. Wait briefly, then take a new screenshot to confirm the result before choosing the next action.
The screenshot after the click, with the namespace.so contact page open in a new Safari tab

Use the keyboard

Type text into the app that has focus, and press keys and shortcuts. Click a text field first, or use a shortcut, to choose where the text goes.

Agent loop

Screenshots and clicks combine into a loop that lets an agent work on an app until a task is done:
  1. Start the app with a command, for example open -a Safari https://namespace.so.
  2. Take a screenshot to capture what the screen shows.
  3. Send the screenshot and the task to a vision model, and ask it for the next action.
  4. Run the action the model returns, such as a click, typing, or a key press, then wait for the app to react.
  5. Repeat from step 2 until the model reports that the task is done.
The loops below follow that pattern. decide_next_action in the CLI script and decideNextAction() in the TS SDK stand for your model call, for example to the Claude or OpenAI computer use tools. It receives the screenshot and returns the next action: a click, text to type or a key to press (CLI only), a URL to open, or done with the task result.
Tell the model the screen size, 2560 by 1600 pixels, so that the coordinates it returns match the screenshot. The open action shows how to mix commands into the loop. For anything that does not need the screen, such as launching apps or opening URLs, run a command with devbox exec or devbox.exec(). Commands are usually faster and more reliable than working through the screen.

Watch the desktop

Open the desktop in a VNC client on your machine to watch an agent work, unblock it when it is stuck on a dialog, or take over with your own mouse and keyboard. See Remote Desktop.
You and an agent share one pointer and keyboard, so input from both at the same time collides. Ask the agent to pause before you take over, and have it take a new screenshot before it acts again.
Last modified on October 16, 2026