Add `desktop` to `BoxLiteSandbox` 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 BoxLite micro-VM on your machine, so this PR adds the same desktop option to BoxLiteSandbox.
New public surface
BoxLiteSandbox.desktopandBoxLiteSandboxBackend(desktop=...):Truefor 1280x800, or(width, height). The default isFalse.BoxLiteSandboxBackend.display.
User-visible behavior
agent = Agent('anthropic:claude-opus-5-5', capabilities=[BoxLiteSandbox(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.
BoxLite's default image is Alpine, which has no apt-get, so a desktop box without an image runs debian:bookworm-slim. Installing the X programs (#11040) needs allow_internet_access=True, with deb.debian.org in any allowed_hosts. Or use an image that already has them. A new desktop box without an image or internet access raises UserError when the backend is created, before BoxLite's runtime opens.
A new box's disk is 666 MB, with about 140 MB free once the display is installed. That's too little for a browser: installing Chromium failed with "No space left on device". The docs say to pass box_options={'disk_size_gb': 4} for a box that installs one.
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
-
boxlite_sandbox/test_boxlite_desktop.py: a desktop box runs Debian and the computer tool; a shell command finds the desktop running; a reattached box 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 38 s openai-responses:gpt-5.5pass 4 / 3 30.1 s -
Live display contract at 1024x768: passed (size, screenshot size, zoom, pointer, not blank). First use took 20 s, including the install.
-
Live:
image='alpine:3.20'without internet raisesWorkspaceUnavailableErrornaming the missing programs and that there's noapt-get.
All boxes were deleted afterwards.
What changes for existing users
Nothing: desktop defaults to False.
Changes in this round
- The "can't install the desktop" check moved from box creation into
__init__, inline, with the same message as smolvm and Render: "A new desktop sandbox without animageinstalls the display's programs withapt-geton first use, which needsallow_internet_access=True. Pass that, or animagethat has Xvfb, xdotool, xwininfo, scrot and setsid." - Docs, README and skill: "with
deb.debian.orgin anyallowed_hosts". - The display is built with the shared
x11_display()from #11040, andDISPLAYis set in one line. The base image name comes from the sharedDEFAULT_DESKTOP_BASE_IMAGE. - Not run locally: the
boxlitepackage has no wheel for this machine's Python, sotest_boxlite_desktop.pyis left to CI.
Review rounds
One round with gpt-6.2-sol on this PR's own diff. Not changed: the display and the backend reference each other, so a dropped box stops at Python's next garbage collection rather than at once; the docs example allows all egress rather than only the Debian mirrors, since the agent usually needs to browse.
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.