Vercel Sandbox
Vercel Sandbox via @vercel/sandbox — exec-emulation, native ports, and a filesystem that is auto-snapshotted on stop. No code interpreter.
Installation
@vercel/sandbox is an optional peer dependency of sbox-sdk, loaded lazily on first use.
pnpm add sbox-sdk @vercel/sandboxUsage
import { createSandboxClient } from "sbox-sdk";
import { vercel } from "sbox-sdk/vercel";
const client = createSandboxClient({
provider: vercel({
token: process.env.VERCEL_TOKEN!,
teamId: process.env.VERCEL_TEAM_ID!,
projectId: process.env.VERCEL_PROJECT_ID!,
}),
});
const sandbox = await client.create({ template: "node22", ports: [3000] });
const preview = await sandbox.ports.expose(3000);
console.log(preview.url);template maps to Vercel's runtime selector (e.g. "node22"), not an arbitrary image. Vercel has no code interpreter, so sandbox.code is undefined.
Authentication
An access token plus the team and project ids.
| Option | Env var | Required | Description |
|---|---|---|---|
token | VERCEL_TOKEN | required | Vercel access token, or an OIDC token. |
teamId | VERCEL_TEAM_ID | required | The team that owns the project. |
projectId | VERCEL_PROJECT_ID | required | The project to associate sandboxes with. |
When running on Vercel, the @vercel/sandbox SDK can resolve these from the standard environment (e.g. VERCEL_OIDC_TOKEN) automatically — pass them explicitly anywhere else.
Options
Prop
Type
Capabilities
| Capability | Level | Notes |
|---|---|---|
background / streaming | native | |
filesUpload | native | |
exposePort | native | preview via declared ports |
list / stop / pause / setTimeout | unsupported | |
killProcess | unsupported | |
codeInterpreter / statefulKernel | unsupported | sandbox.code is undefined |
snapshot / fork | unsupported |
preservesDiskOnStop is true — stop() auto-snapshots the filesystem. previewModel is declaredPorts.
E2B
The canonical reference adapter — richest capability set, with a code interpreter, snapshots, native ports, and pause/resume. Backed by @e2b/code-interpreter.
Cloudflare Sandbox
Cloudflare Sandbox via a Worker / Durable Object binding — a code interpreter, native ports with proxied fetch, and get-or-create semantics. Worker-only.