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
Install
Add the package, and a provider’s SDK for the few providers that need one.
Quickstart
Run your first sandbox in memory with no account, then in Docker.
Choose a provider
Pick where sandboxes run, based on what your app needs.
Compare providers
See which features each provider supports, side by side.
What you can build
Give your agent a sandbox
Hand a model ready-made tools to run commands, edit files, and start servers.
Build an AI app builder
A chat that writes an app in a sandbox and shows it running in an iframe.
One sandbox per user
Give each user a sandbox that is still there on their next request.
Dev servers and previews
Start a server, wait until it answers, and show its URL.
Providers
Local
Docker on your machine or CI runner. No account.
E2B
Hosted microVMs that pause with memory intact.
Vercel Sandbox
MicroVMs on Vercel, with exact keys and OIDC auth.
Daytona
Custom machine sizes and idle auto-stop.
Memory
An in-process fake for unit tests.
Write a provider
Adapt any other sandbox service to the same API.
Works with your stack
AI SDK
Tools for generateText and streamText.
Mastra
A tool map for a Mastra agent.
OpenAI Agents
A tool array for the OpenAI Agents SDK.
Next.js
Route handlers that keep a sandbox per project.
Hono
The same pattern on Node or Bun.
All integrations
Everything in one place.
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,
createSandboxfails withunsupportedinstead 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
keyand 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.