The safest way to run code you didn’t write
Modern apps increasingly need to execute code they didn’t author. From AI agents, customer scripts, or dynamic systems.
Run the agent’s code, the agent itself, or your own code
Every sandbox is the same isolated Firecracker microVM with its own filesystem and network. What you run inside it is up to you.
The agent’s code
Write agent output to a secure sandbox for isolated code execution.
app.tsx
Write the agent’s output to the sandbox filesystem and execute it there.
// Run untrusted, agent-generated code
Execute untrusted agent code in a secure container without local risk.
const sandbox = await Sandbox.create();
Create a sandbox instance and run the generated file within seconds.
The agent itself
Install the CLI and log in. npm i -g sandbox; sandbox login. Start a sandbox and boot the agent using sandbox sh and claude.
Point a coding agent at a sandbox instead of your laptop. Its edits, package installs, and shell commands all stay inside the microVM.
The base image already includes tools, so there is nothing to install. The agent walks you through its own login the first time you start it.
Your code
Builds, test suites, and migrations work the same way. One command gets you a clean machine, so nothing depends on what is installed on your laptop.
- Install the CLI and log in. npm i -g sandbox sandbox login
- Run a command.
# One command creates a sandbox, runs the code, and hands back the output
sandbox run -- node-e"console.log('Hello from Vercel Sandbox')"
Security
Network Firewall with Credentials Brokering and Requests Proxying
Sandbox Network Control
Control egress traffic with fine-grained policies that inject secrets securely at runtime.
Dynamic policies
Credentials injected
Requests proxying
Live policy updates
Secure Egress API
Route traffic through your own proxy servers while keeping credentials inside the host.
Bearer tokens
Proxy forwarding
Wildcard domains
Traffic denial
Implementation Guide
Lock down network access before running untrusted code within your sandbox environment.
Sandbox setup
Policy injection
Endpoint masking
Egress lockdown
Regions
1
Select region
Pick a region per sandbox or set a project default for maximum performance.
2
Add failover
Pro and Enterprise teams can add failover regions for high availability.
3
Deploy code
Same workflow everywhere SDK, CLI, and dashboard for your deployments.
Performance
Snapshots with Instant Environment Restore
Instant Snapshots
Capture the complete state of a running sandbox and restore it instantly.
Skip dependency install
Share identical environments
Checkpoint long tasks
Run parallel instances
Environment Setup
Create sandboxes, install packages, and build your project infrastructure.
Create initial sandbox
Install dependencies
Run build commands
Finalize environment
Snapshot Operations
Capture state snapshots and spin up instances from your saved environments.
Capture current state
Generate snapshot ID
Restore new instances
Scale via snapshots
Cost-efficient, scalable execution with Fluid compute
Vercel Sandbox runs on Fluid compute, Vercel’s optimized execution model that scales CPU and memory dynamically across millions of executions.
With Active CPU pricing, you’re billed for CPU only when code is actively running, not during idle or wait time, resulting in up to 95% lower cost for workloads with bursty or I/O-bound patterns.
Infrastructure powering the future of AI workflows
Trusted by industry leaders to run complex agentic tasks and secure code execution at scale.
How much will it cost?
Estimate your monthly Vercel Sandbox costs. Adjust your workload settings and compare pricing across providers.
Vercel
Optimal for AI agent workloads that require consistent compute efficiency.
Learn more- Active CPU Usage
- Provisioned Memory
- No hidden overhead
- Global scale
Daytona
Enterprise solution for heavy compute tasks with high burst requirements.
View details- Dedicated CPU cores
- High memory allocation
- Advanced scaling
- Enterprise support
Modal
Flexible compute infrastructure designed for complex AI development pipelines.
Contact sales- Custom burst limits
- GPU accelerated nodes
- Full resource control
- Priority 24/7 support
Get started
Launch a secure, interactive sandbox environment in milliseconds.
Copy CLI code
You can get started with Vercel Sandbox quickly and easily.
$ npx sandbox create --connect
See more examples
Quickly give Vercel Sandbox a try with your AI tool of choice.
Copy AI prompt
Bootstrap a simple Node.js CLI that creates a Vercel sandbox. Use this code:
import { Sandbox } from '@vercel/sandbox';
const sandbox = await Sandbox.create();
const { exitCode } = await sandbox.runCommand({
cmd: 'node',
args: ['-e', 'process.exit(0)'],