Quickstart
Install Sandbox SDK, run a Local sandbox, and switch to a cloud provider.
Sandbox SDK uses one TypeScript API for Local, E2B, Daytona, Vercel Sandbox, Upstash Box, Ascii Box, and Railway Sandboxes.
Install
bun add @opencoredev/sandbox-sdkUse Node.js 22 or 24, or Bun 1.3 or newer.
Local is included and needs no account or API key. Cloud providers need their official SDK and credentials; each provider page has the setup details.
Run your first sandbox
import { createSandbox } from "@opencoredev/sandbox-sdk";
import { local } from "@opencoredev/sandbox-sdk/local";
await using sandbox = await createSandbox({ provider: local() });
await sandbox.files.write("hello.mjs", `console.log("hello from the sandbox")`);
const result = await sandbox.run("node /workspace/hello.mjs");
console.log(result.stdout);bun quickstart.tsawait using stops the sandbox when the current scope exits, including when an operation throws. Call createSandbox() without await using only when the sandbox must outlive the current scope and your application will stop it explicitly.
Node.js 24 and Bun run await using directly. When targeting Node.js 22, compile TypeScript to ES2022 or use withSandbox() in uncompiled JavaScript.
What you can do
| Capability | Shared API | Typical use |
|---|---|---|
| Commands | sandbox.run() | Builds, tests, scripts, and one-off jobs |
| Files | sandbox.files | Seed a project and collect artifacts |
| Processes | sandbox.processes | Dev servers and long-running workers |
| Ports | sandbox.ports | Preview a service or call it from your app |
| Snapshots | sandbox.snapshots | Cache setup and restore workspace state |
| Native features | sandbox.raw | Use provider-specific APIs without losing types |
Switch providers
Change the provider import and factory. The sandbox calls do not change.
- import { local } from "@opencoredev/sandbox-sdk/local";
+ import { e2b } from "@opencoredev/sandbox-sdk/e2b";
- const provider = local();
+ const provider = e2b();Install the E2B package and set E2B_API_KEY before running that version. The provider overview lists the requirements for every adapter.
Add the agent skill
Install the Sandbox SDK skill through skills.sh when a coding agent will work with the SDK:
npx skills add opencoredev/sandbox-sdk --skill sandbox-sdkThe skill works with Codex, Claude Code, Cursor, and other agents supported by the skills.sh CLI. See Agent skill for project and global installation.