01Documentation
Coding Agents
Use a Sandbox0 sandbox as a persistent coding workspace with isolated command execution, file APIs, network policy, and rootfs snapshots.
Workspace Lifecycle#
- Claim the
coding-agenttemplate. - Clone or create the repository under
/workspace. - Pause the sandbox when it is idle; resume restores the writable rootfs.
- Create a named rootfs snapshot at a useful milestone.
- Claim additional sandboxes with that snapshot ID for parallel tasks.
bashSANDBOX_ID="$( s0 -o json sandbox create --template coding-agent \ | jq -r '.ID // .id' )" s0 sandbox exec "$SANDBOX_ID" -- \ sh -lc 'git clone https://github.com/example/repo /workspace/repo'
Use the SDK file and command helpers when the agent needs structured reads, writes, directory listings, or long-running command contexts.
Shared Browser#
The template includes sandbox0-browser, Google Chrome Stable, Playwright CLI,
TigerVNC, Openbox, and a built-in noVNC viewer. Start the helper in a supervised
session and open a Private Preview for port 6080 to share the browser with a
human. Dependencies are installed at image build time; claiming a sandbox does
not start the desktop. Applications can use the same helper with their own
authenticated viewer.
See Chrome Shared Desktop for the Quickstart.
Existing sandboxes need an explicit upgrade if sandbox0-browser is not installed.
Run the headed browser as the dedicated sandbox-browser user, retaining
Chrome's process sandbox. A human viewer and Playwright CLI can share the
same browser through a loopback CDP endpoint. Keep the browser profile on the
persistent RootFS and restrict the desktop ingress to authorized viewers;
never publish CDP directly. Pause/resume preserves profile files. A
filesystem-only resume starts new browser and desktop processes; an explicit
memory checkpoint can retain supported process state; viewer connections still
need to reconnect.
Template Updates#
The coding-agent candidate build workflow refreshes the npm latest stable
versions of Codex, Claude Code, OpenCode, Pi, and Playwright CLI every three UTC
days. A daily schedule checks UTC epoch days, so the interval does not reset at
month boundaries. Maintainers can also run it manually.
Chrome Stable is installed from Google's official package for each native architecture during the image build. Playwright CLI attaches to the running browser through CDP instead of downloading its own browser executable.
The workflow records exact dependency versions, the lockfile, and the package inventory in build artifacts and release assets. Both native amd64 and arm64 image builds must pass the image checks before a uniquely tagged candidate receipt is published. These candidates are private prereleases; a successful build does not admit an image to production or update the hosted template.
Production promotion requires qualification of the exact image and its lifecycle behavior, followed by a reviewed template update. The infrastructure refresh workflow accepts qualified releases in its supported receipt format; it skips candidate prereleases and retains the existing pin when no eligible release exists. Deployment prepares the image using the active region's RootFS importer policy and waits for attested artifacts. Failed imports leave the previous template unchanged. Updating a public template alone does not replace a team override.
Updating the template affects new sandboxes after deployment. Existing sandbox RootFS generations retain their installed harness versions across pause/resume; they require an explicit in-place upgrade or a new sandbox initialized from the updated template. RootFS rebase is not exposed by the current public gateway; see Snapshot And Restore.
Durability Boundary#
The writable rootfs is tied to the sandbox identity. Pause/resume preserves it; deleting the sandbox removes it. Named rootfs snapshots are independent restore points that support restore and claim-time initialization. Fork is a separate operation on a source sandbox, not on a named snapshot. Snapshots are subject to their expiry and retention limits.
/tmp remains a runtime tmpfs and is excluded from RootFS checkpoints. An
explicit memory checkpoint can retain supported tmpfs state, but a default
filesystem-only pause discards it. Keep repositories, dependency environments,
agent memory, and generated artifacts under ordinary writable RootFS paths such
as /workspace or /var/tmp.
Parallel Tasks#
After repository setup and dependency installation, create a rootfs snapshot and claim one sandbox per task from the same snapshot. Each claim receives an isolated Copy-on-Write rootfs, so task changes do not mutate the source snapshot or sibling sandboxes.
See Snapshot And Restore for SDK and HTTP examples.