Add `/computer-use` desktop sandboxes to Pax

Merged
AD
10d ago
+2009-186

Why we make these changes

Pydantic AI Harness has ComputerUse and desktop=True on every sandbox backend. This PR lets Pax use it: /computer-use gives the model a desktop in its /sandbox, and the status row shows watch live ↗, a click opening the provider's own link to watch it, where the provider has one.

New public surface

StatusLink(text=, url=) in pydantic_ai_pax.ui.rendering.status: a plugin status segment may return one to show a clickable link (documented in PLUGINS.md). Also the /computer-use command on the built-in sandbox plugin, and SupportsDesktopUrl beside the internal SandboxProvider protocol.

User-visible behavior

/computer-use          # turn it on (before /sandbox, or inside a sandboxed conversation)
/sandbox daytona       # makes the sandbox with a desktop; the footer shows `daytona sandbox | watch live ↗`
/computer-use off      # the model loses the `computer` tool; the sandbox keeps running
/sandbox delete        # deletes the sandbox
  • Where a provider can add a desktop to a running sandbox (boxd, daytona, local smol, render, sprites, kubernetes), /computer-use works at once, also after turns have run.
  • Where it can only make one at create (e2b, modal, local boxlite), Pax says to run /sandbox delete, /new, /computer-use, then /sandbox PROVIDER. It never deletes the sandbox itself, since a fork or copy of the conversation may use it.
  • opensandbox offers no desktop: installing one needs Debian's package servers, which its GitHub-only network policy blocks, so /computer-use refuses there.
  • Whether computer use is on is saved in each response's metadata, so /resume and compaction keep it. A sandbox that had a desktop keeps it after /computer-use off, so turning it back on needs no new sandbox.
  • The model gets the computer tool only under /permissions full, checked at each step, as harness offers none on a read-only workspace. Under another mode the instructions, /computer-use and /sandbox say the desktop needs /permissions full.
  • While computer use is on, the status row shows watch live ↗ next to the sandbox. Full screen, a click opens it with Pax's open_browser (pinned rows only, http(s) only; transcript links are not captured). Inline, the footer carries it as an OSC 8 hyperlink, and a footer cut inside the link closes it.
  • The segment runs every frame, so it only reads a link cached on the sandbox. Pax mints it at /computer-use on, /sandbox PROVIDER with computer use armed, on_session_start, on_conversation_changed and on_turn_start, only when there is none or (Daytona, 1 hour) it is over 50 minutes old, and hides it once expired. A failed mint logs a warning and leaves the segment empty. While the link shows, (computer-use) is dropped from the sandbox segment.
  • There is no /computer-use view: the status row's link replaces it. Pax runs no viewer of its own.

Removed: Pax's own desktop viewer

An earlier version of this PR served a loopback viewer (sandbox/viewer.py and viewer.html) with its own token, CSP and SSE stream, split the web UI's access check into web/guard.py to share it, added a Desktop side panel and a watch live ↗ link on computer rows, and kept screenshot frames for it. All of that is gone, and web/app.py is as on main. It was a second local server to secure and maintain for something the providers that have a desktop link already give. The PR is now about 870 lines smaller.

Which providers have a desktop link

A provider is listed only if its link opens the desktop in a plain browser with nothing relayed by Pax. Checked against the installed SDKs and the harness backends, and live on 2026-11-25 (each probe sandbox deleted):

ProviderLinkEvidence
boxdyes: Machine.access.desktop_url, the console's Desktop viewboxd 0.3.4 models.py MachineAccess.desktop_url ("needs a signed-in browser"). Live: GET https://app.<zone>/desktop/<machine> returned 200. It opens only for the owner's boxd login.
daytonayes: create_signed_preview_url(6080, expires_in_seconds=3600) + /vnc.html?autoconnect=1daytona 0.226.1 create_signed_preview_url puts the token in the host name. Live: vnc.html returned 200 (noVNC), /websockify answered RFB 003.008 with no password, and after expiry a new load returned 401 while an open socket stayed connected. Also checked through the status row link in uv run pax (see Verification).
e2bnoPax creates sandboxes with allow_public_traffic: False, so port URLs need the e2b-traffic-access-token header, and the harness desktop is Xvfb with no VNC server.
modal, render, sprites, opensandbox, kubernetesnoNo desktop or VNC API in their SDKs (modal 1.6.3, render 1.6.0, sprites-py 0.7.1, opensandbox 1.1.1, k8s-agent-sandbox 1.0.11); the harness desktop is Xvfb driven by xdotool, with no server a browser could reach.
local smol, local boxlitenoSame Xvfb desktop. BoxLite's ComputerBox has a web desktop, but Pax uses BoxLiteSandboxBackend on python:3.13, not that image.

Verification

  • tests/pax/test_computer_use.py covers toggling, the refusal to replace a sandbox, resume and compaction, and the computer tool only under full: after a mid-turn change to auto, the next request offers neither the computer function tool nor the native ComputerTool (core's _drop_unrunnable_computer_tool leaves out an optional ComputerTool once no computer function tool is left, so Pax's prepare_tools filter gates both). test_sandbox.py covers boxd's and Daytona's desktop_url through the harness SDK fakes, and each provider's reopen(desktop=True) wiring.
  • Ran test_computer_use.py, test_sandbox.py, test_live_prompt.py, test_prompt_surface.py and test_status.py (-n 2), ruff and strict pyright on the touched files, scripts/check_complexity.py and scripts/check_test_waits.py.
  • test_computer_use.py also covers the status row: the link after /computer-use on and on resume, none for a provider without one, renewal at 50 minutes and hiding after expiry, and a failed mint. test_live_prompt.py, test_prompt_surface.py and test_status.py cover the footer click, the inline OSC 8 output, a truncated footer closing its link, wide-character columns, and http(s)-only pinned clicks. Every changed line is covered.
  • Live in uv run pax in tmux against Daytona (2026-11-25), with BROWSER pointed at a logging script: inline, the footer showed daytona sandbox | watch live ↗ with an OSC 8 link that returned 200 (noVNC); after a resize to full screen, an SGR mouse click on watch live ↗ sent the link to BROWSER, and it returned 200. The sandbox was deleted.
  • The status-row link code is ported from closed https://github.com/pydantic/pydantic-ai/pull/14587, without its viewer, file:// page or transcript link capture.

What changes for existing users

Nothing unless they run /computer-use. Sandbox refs are unchanged, so existing sandboxed conversations resume as before.

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.