Sandbox SDK
API Reference

Sandboxes

Create normalized sandboxes and access their shared surface.

Creating a sandbox

sandbox.ts
const sandbox = await createSandbox({
  provider,
  cwd: "/workspace",
  env: { NODE_ENV: "development" },
  timeout: 300_000,
  signal: abortController.signal,
});
OptionTypeDefaultBehavior
providerSandboxProviderRequiredAdapter used to create the runtime.
cwdstring/workspaceAbsolute working directory for normalized paths and commands.
envRecord<string, string>{}Environment variables passed during creation.
timeoutnumberProvider defaultCreation timeout in milliseconds.
signalAbortSignalNoneCancels creation when supported by the provider.

cwd must be absolute and cannot contain a null byte.

Sandbox properties

PropertyTypeDescription
idstringProvider or adapter identifier for this sandbox.
providerProviderNamelocal, e2b, daytona, vercel, or upstash.
cwdstringNormalized working directory.
capabilitiesCapabilityMapSupported operations and their modes.
rawProvider-native typeTyped access to the underlying provider SDK object.

Stopping a sandbox

sandbox.ts
await sandbox.stop();
await sandbox.stop(); // safe: stop is idempotent

Write files or run commands.

On this page