E2B
The canonical reference adapter — richest capability set, with a code interpreter, snapshots, native ports, and pause/resume. Backed by @e2b/code-interpreter.
Installation
@e2b/code-interpreter is an optional peer dependency of sbox-sdk, loaded lazily on first use — install it alongside the SDK so the adapter's import resolves at runtime.
pnpm add sbox-sdk @e2b/code-interpreterUsage
import { createSandboxClient } from "sbox-sdk";
import { e2b } from "sbox-sdk/e2b";
const client = createSandboxClient({
provider: e2b({ apiKey: process.env.E2B_API_KEY! }),
});
const sandbox = await client.create({ template: "python-3.12", ttlMs: 60_000 });
// E2B has a code interpreter, so `sandbox.code` is defined:
const exec = await sandbox.code.runCode("import matplotlib; print('ok')");
console.log(exec.logs.stdout);E2B is the richest adapter and the reference implementation other adapters are measured against. template maps to an E2B template id / alias (e.g. "python-3.12" or a custom-built template).
Authentication
A single API key.
| Option | Env var | Required | Description |
|---|---|---|---|
apiKey | E2B_API_KEY | required | Your E2B API key. |
domain | — | optional | Self-hosted E2B domain, if not the default cloud. |
Options
Prop
Type
Capabilities
| Capability | Level | Notes |
|---|---|---|
list / pause / setTimeout | native | |
stop | unsupported | E2B has no stop-without-destroy |
background / streaming / killProcess | native | |
filesWatch / filesUpload | native | |
codeInterpreter / statefulKernel | native | sandbox.code is defined |
exposePort | native | preview via subdomain |
snapshot | native | |
fork | unsupported | |
metrics | native | |
egressControl / ssh / proxiedFetch | unsupported | use raw() for E2B-only features |
preservesMemoryOnPause is true; previewModel is subdomain.
In-Memory
An in-memory sandbox backed by Maps — the zero-config default and the conformance fixture. No dependencies, no network, non-persistent. Ideal for tests.
Vercel Sandbox
Vercel Sandbox via @vercel/sandbox — exec-emulation, native ports, and a filesystem that is auto-snapshotted on stop. No code interpreter.