Sandbox SDK

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, and Upstash Box.

Install

Terminal
bun add @opencoredev/sandbox-sdk

Use 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

quickstart.ts
import { withSandbox } from "@opencoredev/sandbox-sdk";
import { local } from "@opencoredev/sandbox-sdk/local";

await withSandbox({ provider: local() }, async (sandbox) => {
  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);
});
Terminal
bun quickstart.ts

withSandbox() stops the sandbox after the callback finishes or throws. Use createSandbox() only when the sandbox must outlive one callback.

What you can do

CapabilityShared APITypical use
Commandssandbox.run()Builds, tests, scripts, and one-off jobs
Filessandbox.filesSeed a project and collect artifacts
Processessandbox.processesDev servers and long-running workers
Portssandbox.portsPreview a service or call it from your app
Snapshotssandbox.snapshotsCache setup and restore workspace state
Native featuressandbox.rawUse provider-specific APIs without losing types

Switch providers

Change the provider import and factory. The sandbox calls do not change.

provider.ts
- 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:

Terminal
npx skills add opencoredev/sandbox-sdk --skill sandbox-sdk

The skill works with Codex, Claude Code, Cursor, and other agents supported by the skills.sh CLI. See Agent skill for project and global installation.

On this page