Sandbox desktops
Open a graphical Linux desktop in a Sandbox and hand input control between people and agents.
The built-in desktop template is a graphical Linux desktop with a browser.
To launch it from the CLI, apply a template built on it:
apiVersion: sandboxes.clusterbase.ai/v1
kind: SandboxTemplate
metadata:
name: desktop-tools
spec:
base: desktop
resources:
vcpu: 2
memory_mb: 1024
steps:
- run: mkdir -p /workspaceccp apply --file desktop.yaml --wait
ccp sandbox create --template desktop-tools --ttl 1hLeave out spec.ports: declaring ports removes the desktop viewer. You can
also create one with template_id desktop through
the API.
Like development, a desktop also has the public preview service on port
8000; see Public preview.
Watch the desktop
ccp sandbox desktop sbx_... --ttl 20mThis opens the desktop in your browser through a local link on 127.0.0.1
and keeps running until you press Ctrl-C or the access expires. The view is
read-only: you can watch, but not click or type. --ttl accepts 1s to 1h
(default 15m).
For automation that sets its own Authorization header, use
ccp sandbox connect with the
desktop service instead.
Browser
The desktop opens with the browser maximized on its start page, and the browser is ready as soon as the Sandbox starts. It includes uBlock Origin, which blocks ads, trackers, and cookie banners by default.
Pause and resume
A desktop pauses when idle and resumes with its windows and files as you left them. See Idle pause for what counts as activity.
If the host that held a paused desktop is unavailable, the desktop can resume on another host. Reconnect with an unexpired viewer link; the first connection can take longer than usual. This applies only to desktops whose only service is the read-only viewer, with no attached workspace, public preview, or custom domain.
Take input control
To click and type yourself, take a control lease. While you hold it, agents can't send input to the desktop. Control is available through the API:
LEASE_ID="sbxcl_$(uuidgen | tr 'A-Z' 'a-z')"
TOKEN="sbxt_$(openssl rand -base64 32 | tr '+/' '-_' | tr -d '=')"
curl -X POST https://api.clusterbase.dev/api/v1/sandboxes/sbx_.../desktop-control \
-H "Authorization: Bearer $(ccp auth print-access-token)" \
-H "Content-Type: application/json" \
-d "{\"lease_id\":\"$LEASE_ID\",\"token\":\"$TOKEN\",\"ttl_seconds\":300}"{ "lease_id": "sbxcl_...", "fence": 1, "endpoint": "wss://...", "token": "sbxt_...", "expires_at": "..." }Use a new lease ID (sbxcl_ plus a UUID) and a new token (sbxt_ plus 32
random bytes as unpadded base64url) for each lease, and keep the token: it
can't be retrieved later. Connect to endpoint
with that token. ttl_seconds accepts 10 to 900 and never outlasts the
Sandbox. Sending the same request again while the lease is active returns the
same lease.
| Action | Request |
|---|---|
| Renew | PATCH the same path with lease_id, fence, and a new ttl_seconds. Returns the new expires_at. |
| Release | DELETE the same path with lease_id and fence. Returns 204. |
If someone else holds the lease, or your lease_id and fence no longer
match the current lease, the request fails with control_lease_conflict
(409).
When the lease is released or expires, your control connection closes and the
desktop clipboard is cleared before agents can act again. ccp sandbox desktop
stays view-only the whole time.