Two kinds of volume
| Copy-mode | File-granular | |
|---|---|---|
| What it is | A gzip tar archive hydrated into the sandbox’s filesystem at boot | A persistent, shared filesystem you can edit directly — with or without a running sandbox |
| Reads/writes | Read-at-boot; guest writes stay private to that sandbox and never flow back | Live read and write; changes are shared and durable |
| Attach modes | copy | mount (read-write) or mount-ro (read-only) |
| Edit without a sandbox | No | Yes — read/write/list/delete files over the API |
| Best for | Seeding many parallel sandboxes from the same source (fanout, CI) | A shared workspace multiple sandboxes (or agents) read and write concurrently |
Create and attach (copy-mode)
Upload a gzip tar archive once, then attach it to sandboxes at create time. On boot, the archive is materialized under the attachment’smount_path before the first command runs.
- Python
- TypeScript
File-granular volumes (live mounts)
A file-granular volume is a shared filesystem you can edit from the SDK with no sandbox running, and live-mount into a sandbox so reads and writes go straight to the shared volume. Create one empty (or seed it from an archive), edit its files directly, then mount it read-write.- Python
- TypeScript
mode="mount-ro" for a read-only mount (guest writes are rejected). Live mounts require a file-granular volume; copy-mode volumes can only be attached with mode="copy".
Mount a sub-path
Mount just part of a volume withsubpath (live-mount only — the server rejects subpath on a copy attachment):
- Python
- TypeScript
Snapshot and commit
Capture filesystem state from a running sandbox into a new volume — the source is never modified:- Python
- TypeScript
snapshot captures any in-sandbox path; commit captures the mount path of a volume already attached to that sandbox. Both return a new volume and leave the source untouched. Synthetic paths (/proc, /sys, /dev) are rejected.
Coordinate writers with advisory locks
When several sandboxes share a live-mounted volume, coordinate writers with advisory leases over a(volume, path) pair. acquire returns a token you present to renew / release:
- Python
- TypeScript
if_version) check.
Limits
- Format: uploads are gzip-compressed tar archives (
application/gzip). Only regular files are materialized — symlinks, hardlinks, device nodes, and entries containing..are dropped for safety. - Upload size: the upload body is capped at 4 GiB.
- File-granular capacity: a flat 64 GiB per-volume cap (a hard abuse-prevention ceiling, not a per-tier quota — volumes are not tier-gated).
- Ownership: strictly owner-scoped; you can attach only your own volumes. A volume that is still live-mounted by a sandbox cannot be deleted.
VolumeInfo model
| Field | Type | Description |
|---|---|---|
volume_id | str | Unique identifier |
name | str | Human-readable name you set at creation |
size_bytes | int | Current size of the volume’s contents |
created_at | str | When the volume was created (ISO-8601 string) |
metadata | dict | Arbitrary key-value pairs attached at creation |
quota_bytes | int | Capacity cap for file-granular volumes (0 = unlimited) |
Use cases
Stage data before the sandbox exists
Stage data before the sandbox exists
Upload a dataset once, then fan out many parallel sandboxes that each read the same files at boot — no per-sandbox upload step.
Checkpoint a result into a versioned volume
Checkpoint a result into a versioned volume
Capture a sandbox’s output directory into a new volume after an expensive step, so you can restore or share it later.
For the full method reference, see the SDK volume guides (Python, TypeScript, Go) and the Volumes API. For runnable examples, see the Volumes cookbook.