vercel/vercel-plugin/vercel-sandbox
Claude Code and agent skill by vercel/vercel-plugin
- vendor
Checking that the SKILL.md file is still in the repository.
Vercel Sandbox guidance — ephemeral Firecracker microVMs for running untrusted code safely. Supports AI agents, code generation, and experimentation. Use when executing user-generated or AI-generated code in isolation, or when streaming a sandbox desktop for graphical applications and computer-use agents.
Install
npx vskill@latest install vercel/vercel-plugin/vercel-sandboxSKILL.md
_CRITICAL_: Always Use Correct @vercel/sandbox Documentation
Your knowledge of @vercel/sandbox may be outdated. Follow these instructions before starting on any sandbox-related tasks:
Official Resources
- Documentation: https://vercel.com/docs/vercel-sandbox
- SDK Reference: https://vercel.com/docs/vercel-sandbox/sdk-reference
- CLI Reference: https://vercel.com/docs/vercel-sandbox/cli-reference
- GitHub: https://github.com/vercel/sandbox
- REST API: https://vercel.com/docs/rest-api/sandboxes
What changed in v2
The @vercel/sandbox@2 SDK and sandbox@3 CLI replace anonymous, ephemeral sandboxes with named, persistent sandboxes. Key differences from v1:
- Sandboxes are identified by `name` (not
sandboxId). Names are unique per project. - Sandboxes are persistent by default — when a sandbox stops, the SDK
automatically snapshots it and restores the filesystem on the next resume.
- A Session is a single running VM instance inside a sandbox. SDK calls
like runCommand, writeFiles, etc. automatically resume a stopped sandbox.
- New methods:
Sandbox.getOrCreate,Sandbox.fork,sandbox.update,
sandbox.delete, sandbox.listSessions, sandbox.listSnapshots, Snapshot.tree, defineSandboxProxy.
- New params:
name,persistent,tags,onResume,snapshotExpiration,
keepLastSnapshots, L7 network policy matchers, forwardURL.
- Pagination uses cursor-based iterators (async-iterable) instead of
since/until. Sandbox.list({ since, until })→Sandbox.list({ cursor, namePrefix, sortBy, tags }).- v1 sandboxes are backfilled so the only required code change is using
name
instead of sandboxId.
Quick Reference
Essential imports:
Default image: Sandboxes use vercel/sandbox/universal:latest, an Ubuntu-based image with Node.js 24, Bun, Python 3.14, coding agents, and common development and debugging utilities.
Creating Sandboxes
Basic Creation
Retrieve an Existing Sandbox
Get-or-Create (Idempotent)
Sandbox.getOrCreate is the recommended pattern for long-lived sandboxes.
Behavior:
- If a sandbox with that
nameexists → resumes it and firesonResume. - If it does not exist → creates a fresh sandbox and fires
onCreate. - If the sandbox exists but its snapshot expired → deletes the stale sandbox,
re-creates it with the same name, and fires onCreate.
Re-warming on Resume
Use onResume to restart background services or rehydrate caches whenever a persistent sandbox's session is resumed:
onResume also fires when a SDK call (e.g. runCommand, writeFiles) auto-resumes a stopped sandbox.
With Git Source
Git sources are cloned into a subdirectory named after the repository. For the example above, run commands with cwd: "sandbox-example-next".
With Private Git Repository
With Private npm Packages
Pass credentials: { npm: true } when the sandbox runs a coding agent or installs your team's private npm packages. Vercel injects the team's npm credentials into the sandbox network policy, so installs authenticate with no token inside the sandbox.
- Covers installs with npm, pnpm, and Bun. Publishing from the sandbox stays unauthenticated.
- When the team has no npm credentials, creation fails with a 400 error.
- CLI:
sandbox create --credentials=npm.
From Tarball
From a Snapshot
From a Custom Image (VCR)
Override the default with a Vercel Container Registry (VCR) image stored in the sandbox's project.
For a different distro or reproducible system tooling, prefer baking it into a custom image over installing packages when the sandbox starts.
image accepts a repository in the sandbox's project with an optional tag or digest, or a fully-qualified VCR URL. A bare repository name resolves to the latest tag:
Push images to VCR with Docker-compatible tooling before referencing them. See the Container Registry docs for push instructions.
Forking an Existing Sandbox
Sandbox.fork seeds a new sandbox from another sandbox's current snapshot and copies its config (resources, timeout, networkPolicy, tags, ports, image, persistent, snapshotExpiration, keepLastSnapshots, and env). Any field you pass overrides the inherited value. If the source has no current snapshot, the fork falls back to the source's base environment plus the copied config. You can only fork a sandbox in a project you have access to; forking an unknown source returns a 404. The fork runs in the source's region unless you pass region (and optionally failoverRegions) to override it.
When to fork a sandbox or a drive
Use Sandbox.fork when each worker needs its own sandbox environment, including installed tools and files from the source sandbox's snapshot. Use drive.fork when each worker needs an independent writable copy of persistent files. Sandbox.fork does not inherit drive mounts; pass mounts if the fork needs a drive. Mount a drive when files should persist across sandbox runs. Many sandboxes can mount drive.snapshot() for read-only access; each mount captures the drive's files at mount time. Mount a new snapshot to see later writes. A drive allows one read-write mount at a time. The sandbox and drive must be in the same region. Write to a read-write mount once before forking a drive or mounting its snapshot.
The worker's writes stay on workerDrive; the base drive keeps the starter files. Fork the base drive again with a different name for another worker.
Auto-Dispose Pattern
Use await using for automatic cleanup:
Running Commands
Basic Command Execution
With Options
Detached Commands (Background Processes)
Root Access
File Operations
Write Files
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 17 Mar 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/vercel-sandbox/SKILL.md
Popularity
- Repository stars
- 9
- Repository forks
- 1
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 16 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/vercel/vercel-plugin/vercel-sandbox)