Skip to content
Sandbox SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

Overview

Sandboxes for your agents and your users. Any provider, one line. Sandbox SDK is one TypeScript API over Docker, E2B, Vercel Sandbox, Daytona, and ten more providers.

Sandbox SDK gives your code an isolated Linux machine to run commands in, write files to, and start dev servers on. You use the same TypeScript API whether that machine is a Docker container on your laptop or a microVM at E2B, Vercel, Daytona, or any of the other supported providers. Changing providers is one import.

It is for two kinds of app. One gives an AI agent a computer: the model runs tests, edits code, and starts a server. The other runs code your users write, such as an app builder with a live preview. Both need a machine that can’t touch your servers, and both need it to come back when the user does.

import { createSandbox } from "@opencoredev/sandbox-sdk";
import { local } from "@opencoredev/sandbox-sdk/local";

await using box = await createSandbox(local());

const result = await box.run("node --version");
console.log(result.output);

That starts a sandbox, runs one command, prints its output, and deletes the sandbox when the block ends. Swap local() for e2b(), vercel(), or daytona() and nothing else changes.

Start here

What you can build

Providers

Works with your stack

How it differs

  • Your keys, no middleman. The SDK calls each provider’s API or SDK with your credentials. Nothing runs between you and the provider, and nothing is installed inside the sandbox.
  • It never quietly ignores an option. If you ask a provider for a network allow list or a machine size it can’t enforce, createSandbox fails with unsupported instead of handing you an open sandbox.
  • Failed commands are results. A non-zero exit code comes back as ok: false. The SDK throws only when the sandbox or the provider fails.
  • Sandboxes come back. Give a sandbox a key and the next request, on any server, gets the same one. Background processes and their logs live inside the sandbox, so they survive a redeploy.

The SDK is not an isolation layer of its own. The provider you choose supplies the security boundary. See Security.

Coming from 0.2? Read Upgrade from 0.2.

Was this page helpful?