Sandbox persistence is now GA
Vercel Sandboxes now automatically save and restore filesystem state between sessions with persistence enabled by default. New features include durable sandbox names, lifecycle hooks, snapshot management, and tagging for multi-tenant tracking.
now automatically save and restore filesystem state between sessions. Persistence is on by default, meaning no snapshots to manage or state to track manually.Vercel Sandboxes
Each sandbox has a durable, that acts as a unique reference in your project. You can create, retrieve, or resume a sandbox by name. Vercel spins sessions up and down automatically, without interrupting your workflow.customizable name
When you call , persistence is enabled by default:Sandbox.create()
Each automatic snapshot consumes , which is billed separately from compute. For ephemeral workloads, opt out of persistence to minimize storage costs:snapshot storage
To opt out of persistence with the CLI, pass to . Non-persistent sandboxes discard their filesystem when the session ends.--non-persistentsandbox create
Resuming is automatic. Any call on a stopped sandbox, like or , starts a new session from the most recent snapshot.runCommand()writeFiles()
Upgrade to the latest version to create persistent sandboxes by default:
Learn more about persistent sandboxes in the .documentation
Create a persistent sandbox
Resume a persistent sandbox
Other improvements
Get started
: Create a new sandbox from an existing one
Sandbox.fork(): Idempotent retrieve-or-create for long-lived sandboxes
Sandbox.getOrCreate(): Permanently delete a sandbox
Sandbox.delete()Richer : Returns snapshot metadata plus active-CPU and network-transfer totals
sandbox.stop()Lifecycle hooks: and hooks for , , and
onCreateonResumecreategetgetOrCreate: Assign custom properties to sandboxes for multi-tenant trackingTags
pnpm install @vercel/sandbox@latest # SDKpnpm install -g sandbox@latest # CLI
Source: original entry ↗