Add `desktop` to `SmolSandbox` for `ComputerUse`
- Part of #9347
Why
ComputerUse needs a screen. The shared X11 desktop that DockerContainer(desktop=True) and E2BSandbox(desktop=True) use runs unchanged on a smolvm microVM on your machine, so this PR adds the same desktop option to SmolSandbox.
New public surface
SmolSandbox.desktopandSmolSandboxBackend(desktop=...):Truefor 1280x800, or(width, height). The default isFalse.SmolSandboxBackend.display.
User-visible behavior
agent = Agent('anthropic:claude-opus-5-5', capabilities=[SmolSandbox(desktop=True, allow_internet_access=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. Only the local target is covered.
smolvm's default image is Alpine, which has no apt-get, so a desktop VM without an image runs debian:bookworm-slim. Installing the X programs (#11040) needs allow_internet_access=True, or an image that already has them. A new desktop VM without either raises UserError when the backend is created.
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
-
smol_sandbox/test_smol_desktop.py: a desktop VM runs Debian and the computer tool; a shell command finds the desktop running; a reattached VM keeps its display. -
Live on macOS (Apple silicon), with
ComputerUseand the sandbox only, no shell (2026-11-23). The task: "Open a terminal, typeecho hello-desktop, press Enter, and tell me what the terminal shows." In each run the final screenshot shows the command,hello-desktopand a new prompt, and the model reported it. No tool errors.Model Result Requests / computercallsTime anthropic:claude-sonnet-5-5pass 4 / 3 25.7 s openai-responses:gpt-5.5pass 4 / 3 28.9 s -
Live display contract at 1024x768: passed. First use took 20.4 s, including the install.
-
Live:
image='alpine:3.20'raisesWorkspaceUnavailableErrornaming the missing programs and that there's noapt-get.
All VMs were deleted afterwards.
What changes for existing users
Nothing: desktop defaults to False.
Changes in this round
- The
check_desktophelper had one caller, so its check is now inline in__init__, with the same message as BoxLite and Render. - The display is built with the shared
x11_display()from #11040, andDISPLAYis set in one line. The desktop size is passed inline instead of stored. test_smol_desktop.py5 passed.
Review rounds
One round with gpt-6.2-sol on this PR's own diff: clean.
Depends on
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.