Agents often run complex, multi-step tasks. Consider this scenario:
Agent starts task → Works in Sandbox A → Task evolves → Needs different tools/runtime → Moves to Sandbox B
Without persistent storage:
This is the problem Vercel Drives solves.
Vercel Drives is persistent, mountable file storage that exists independently of any sandbox environment.
┌─────────────────────────────────────────┐
│ VERCEL DRIVE │
│ (files live here permanently) │
└──────────────┬──────────────────────────┘
│ mount │ mount
▼ ▼
┌──────────┐ ┌──────────┐
│Sandbox A │ │Sandbox B │
│(Python) │ │(Node.js) │
└──────────┘ └──────────┘
The drive persists. The sandboxes are temporary.
A drive is created once and mounted into a sandbox at a specific path.
Using the CLI:
# Step 1: Create or retrieve an existing drive
sandbox drives get-or-create agent-workspace
# Step 2: Create a sandbox and mount the drive at /workspace
sandbox create --mount agent-workspace:/workspace
Using the SDK:
import { Sandbox, Drive } from '@vercel/sandbox';
// Step 1: Get or create the drive
const drive = await Drive.getOrCreate({ name: 'agent-workspace' });
// Step 2: Create sandbox with the drive mounted at /workspace
const sandbox = await Sandbox.create({
mounts: { '/workspace': drive },
});
// Step 3: Do work — this gets saved to the drive
await sandbox.runCommand('git', ['clone', repoUrl, '/workspace/repo']);
| Location | Belongs To | Persists? |
|---|---|---|
/workspace/... | The Drive | ✅ Yes |
| Everything else | The Sandbox | ❌ No |
Because the drive is independent, a new sandbox can mount the same drive and find everything exactly as the previous sandbox left it.
// Later run — completely new sandbox, same drive
const drive = await Drive.getOrCreate({ name: 'agent-workspace' });
const newSandbox = await Sandbox.create({
mounts: { '/workspace': drive },
});
// The repo cloned in the previous run is still here!
await newSandbox.runCommand('ls', ['/workspace/repo']);
Key benefit: No file transfers. No rebuilding. Just mount and continue.
Multiple agents can mount the same drive simultaneously.
Use case example:
Agent 1 builds dataset → saves to drive
↓
Agent 2 mounts drive (read-only) → analyzes data
Agent 3 mounts drive (read-only) → generates reports
// Agent 2 and Agent 3 mount the same drive as read-only
const sharedDrive = await Drive.getOrCreate({ name: 'dataset-drive' });
const analyzerSandbox = await Sandbox.create({
mounts: { '/data': sharedDrive }, // read-only access
});
Why read-only?
Forking creates an independent copy of a drive's current state.
Original Drive (dataset)
│
├──── Fork A (Agent tries Approach 1)
│
└──── Fork B (Agent tries Approach 2)
Key rules of forking:
When to use forking:
| Plan | Default Storage | Maximum Available |
|---|---|---|
| Hobby | 1 GiB | Up to 16 TiB |
| All others | 1 TiB | Up to 16 TiB |
VERCEL DRIVES — Core Ideas
1. PERSIST → Files survive sandbox shutdowns
2. MOUNT → Attach the same drive to any new sandbox
3. SHARE → Multiple agents read from one drive
4. FORK → Independent copies for parallel exploration
Q1: Where must files be saved for them to persist on a drive?
Under the mounted path (e.g.,
/workspace)
Q2: What happens to files outside the mounted path when a sandbox ends?
They are lost — they belong to the sandbox, not the drive
Q3: Can two sandboxes mount the same drive at the same time?
Yes — this enables shared state across agents
Q4: Do forks merge back into the original drive?
No — forks are permanently independent