Add `desktop` to `RenderSandbox` for `ComputerUse`

Merged
AD
11d ago
+201-5

Part of #9347. Builds on #11040.

This PR adds RenderSandbox(desktop=True), which lets ComputerUse() (#11037) see and control a screen inside a Render sandbox. It uses the shared X11 driver from #11040, the same one E2B uses.

agent = Agent('anthropic:claude-opus-5-5', capabilities=[RenderSandbox(desktop=True), Shell(), ComputerUse()])

How to review: render_sandbox/_backend.py: __init__, run and the new _run_argv. The rest is the capability field, docs and tests.

What the PR adds

  • Options. RenderSandbox.desktop and RenderSandboxBackend(desktop=...) take True for 1280x800, or (width, height). The default is False. Specs can set it.
  • The screen. Render's default image runs as root on Debian and has none of the X programs. So the first use of the screen installs xvfb xdotool x11-utils scrot util-linux with apt-get, through the shared start script. That needs allow_internet_access, which is on by default; a new desktop sandbox without it raises UserError when the backend is created.
  • Shell commands see it. run() starts the display before each command and adds DISPLAY=:1, so a program the agent starts from the shell opens on the screen. The display's own commands go through _run_argv, which doesn't start it.
  • No image option. RenderSandbox has no image parameter, and this PR doesn't add one. The screen starts empty, so the docs say to install a browser before the run or let the agent do it with Shell.
  • No viewer. Render sandboxes have no public URLs, and nothing is published for the screen.
  • Docs. A "Give the agent a desktop" section on the Render page and README, a desktop row in the configuration table, a row in ComputerUse's "Where the screen comes from" table, and the harness skill reference.

Design decisions

Use the shared X11 driver, as E2B does. Render has no computer API of its own, and its default image is root Debian, so the start script's apt-get install works there unchanged.

Start the display before each shell command. This is the decision from #11040: a program the agent opens from the shell must land on the screen the agent sees.

Tests

tests/harness/render_sandbox/test_render_desktop.py, against the existing fake Render SDK with the shared scripted FakeDisplay:

  • a shell command finds the desktop running, with DISPLAY and the user's env;
  • a desktop size reaches the display it starts;
  • a new desktop sandbox without internet access is refused;
  • a reattached desktop sandbox gets its display back, and a non-desktop one has none;
  • RenderSandbox(desktop=True) plus ComputerUse runs the computer tool on a new sandbox.

test_capability.py adds desktop to the spec schema list and the from_spec round trip.

test_render_desktop.py 5 passed, test_capability.py 27, test_workspace.py 51.

Live check

On real Render sandboxes (default image), with ComputerUse and the sandbox only, no shell (2026-11-23). The task: "Open a terminal, type echo hello-desktop, press Enter, and tell me what the terminal shows." In each run the final screenshot shows the command, hello-desktop and a new prompt, and the model reported it. No tool errors.

ModelResultRequests / computer callsTime
anthropic:claude-sonnet-5-5pass4 / 327 s
openai-responses:gpt-5.5pass4 / 330.0 s

The display contract at 1024x768 also passed live; first use took 10.9 s, including the install. A reattached sandbox kept its display's size. An attached sandbox without internet access now fails in 49.6 to 194.6 s with "could not install xdotool xwininfo scrot", instead of waiting out the 600 s start timeout. All sandboxes were destroyed afterwards.

Changes in this round

  • The display is built with the shared x11_display() from #11040, and DISPLAY is set in one line.
  • The "can't install the desktop" check is inline in __init__, after the display is built, with the same message as BoxLite and smolvm.
  • Cut duplicate tests: the capability reattach test (the backend reattach test already checks RenderSandbox(...).backend(ref)), the spec test (the shared spec test covers it), and the test that a display which fails to start names the sandbox (the message is the shared code's, tested in test_x11.py).
  • The test fake routes display commands with the shared FakeDisplay.answers instead of its own program list.

Review rounds

Three rounds of gpt-6.2-sol (high effort) on the diff against the shared desktop code.

  • Round 1: the desktop docs pointed to the "Prepare a sandbox" recipe, whose explicit backend left the screen off. They now say to pass RenderSandboxBackend(desktop=True) there. The example also runs its agent.
  • Round 2: the new tests used a host temp dir as the sandbox path, which fails on Windows CI. They now skip off POSIX, like the other fake-backed Render tests.
  • Round 3: only edge cases, logged as follow-ups. The first command waits for the install under the display's start timeout, as on E2B. A noise-like screenshot at a large size could pass Render's 10 MiB output cap.

Other findings were shared desktop behaviour, also logged: filesystem reads start the display, a display whose Xvfb died is not restarted, and a first display call under Trio binds the display's lock before Trio is refused. The skill's install list now names util-linux, found on the OpenSandbox PR.

Known limits

  • The agent can type only ASCII, as with every X11 desktop.
  • The desktop has no browser. A browser installed before the desktop first starts gets a panel button.