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.
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, claim-time initialization, and fork workflows.
/tmp remains ephemeral and is excluded from checkpoints. 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.