Add `desktop` to `SpritesSandbox` for `ComputerUse`

Merged
AD
11d ago
+204-10

Why

ComputerUse needs a screen. The shared X11 desktop that DockerContainer(desktop=True) and E2BSandbox(desktop=True) use runs unchanged on a Sprite, so this PR adds the same desktop option to SpritesSandbox.

New public surface

  • SpritesSandbox.desktop and SpritesSandboxBackend(desktop=...): True for 1280x800, or (width, height). The default is False. Specs can set it.
  • SpritesSandboxBackend.display.

User-visible behavior

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

The display starts on first use. run() starts it before each shell command and adds DISPLAY, so programs the agent starts from the shell open on it. A Sprite runs commands as a user with passwordless sudo, so the first start installs the X programs (#11040).

A cold wake stops the display and the apps on it (Sprite lifecycle): the display starts again empty, and the agent has to open its apps again. Files on disk are kept. The docs page, README, backend docstring and skill say so.

Sprites run Ubuntu, where firefox and chromium are snaps that don't run in a Sprite. The docs don't cover browsers; the live run installed Firefox from Mozilla's APT repository.

There's no live viewer; the docs show how to save each screenshot to watch a run. The agent can type only ASCII, as on the other X11 desktops.

Verification

  • sprites_sandbox/test_sprites_desktop.py: an agent runs the computer tool on a new Sprite; a shell command finds the desktop running; a desktop size reaches the display; a reattached Sprite keeps its display.

  • test_sprites_live.py::test_a_desktop_meets_the_display_contract: 1 passed live, 50.7 s.

  • Live, 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 / 362.0 s (cold Sprite plus the install)
    openai-responses:gpt-5.5pass4 / 365.7 s

    Both Sprites were deleted afterwards.

What changes for existing users

Nothing: desktop defaults to False.

Changes in this round

  • The display is built with the shared x11_display() from #11040, and DISPLAY is set in one line.
  • The test that a display which fails to start names the Sprite is cut: the message is the shared code's, and test_x11.py tests it.
  • The skill's Sprites bullet now says what the desktop is on its own, instead of "the same desktop".
  • Renamed for clarity, following #11040: checked_desktop_size, full_display in tests.
  • test_sprites_desktop.py 4 passed, test_sprites_sandbox.py 127.

Review rounds

One round with gpt-6.2-sol on this PR's own diff, after the same early command check as Modal was added here. Not changed: after a cold wake mid-run, a shell command finds no display until a screenshot restarts it (restart detection is parked in #11871); typing about 4.5 KB in one action goes over Sprites' exec URL limit.

Depends on

#11040.

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
  • PR title is fit for the release changelog.