Purpose sandbox-sdk provides a unified sandbox API for server-side TypeScript code, used to create sandboxes, execute commands, edit files, and provide preview services. Its core goal is to let the same code run on multiple sandbox providers, including 15 cloud providers such as E2B, Daytona, Vercel Sandbox, Upstash Box, Railway, Tenki, and Freestyle, and also run in local Docker or in agentOS within a Node.js process. Switching providers only requires changing one import.
Key capabilities
- Unified interface: use one TypeScript API to complete sandbox creation, command execution, file editing, and preview services.
- Multi-provider support: the official list includes 15 providers, covering E2B, Daytona, Vercel Sandbox, Upstash Box, Railway, Tenki, Freestyle, Superserve, Instabox, Boat, Sandboxer, Docker, and agentOS.
- Capabilities vary by provider: pause and snapshot exist only on providers that support them, and the TypeScript type system can identify which capabilities a specific provider supports.
- In-memory sandbox: memory() is an in-process fake sandbox that requires no account and no Docker, and can be used to try the API and write tests.
- Agent tools: sandboxTools converts a sandbox into agent-callable tools, including run, read_file, write_file, edit_file, and background process control. Registered secrets are not passed to the model.
- Error model: all failures are thrown as SandboxError with a code that can be used for branching.
- Extensible: implement the Provider interface in @opencoredev/sandbox-sdk/provider to connect your own provider, and use runConformance from @opencoredev/sandbox-sdk/testing for conformance testing.
Usage Runtime requirements are server-side Node.js 22+ or Bun 1.3+, Cloudflare Workers and other edge runtimes are not supported. For dependency installation, E2B, Daytona, Freestyle, Superserve, Instabox, Boat, and Sandboxer call their respective HTTP APIs directly and require no additional installation; the remaining providers load their respective SDKs as optional peers, so you only need to install the ones you actually use, for example npm install @vercel/sandbox. Regarding lifecycle, when using await using, a sandbox created without a key is deleted when the scope ends, even if the code throws an exception; with a key, close() is called and the sandbox keeps running, and destroy() is called afterward to destroy it. When a command exits with a non-zero status, it does not throw an exception but returns a result with ok: false. Regarding agent integration, the example uses the AI SDK with E2B, and the model string goes through the Vercel AI Gateway, requiring AI_GATEWAY_API_KEY and E2B_API_KEY to be set on the server; any AI SDK provider can be substituted. The same tools also provide integration methods for Mastra (/mastra), the OpenAI Agents SDK (/openai), and other frameworks (/tools). To integrate a custom provider, implement the Provider interface and validate it with runConformance.
Use cases Suitable for scenarios that require running untrusted code in server-side TypeScript, providing an isolated execution environment for AI agents, migrating or comparing between different sandbox services, and developing and debugging in local Docker before switching to a cloud provider. The official documentation also provides example topics such as Docker sandboxes, E2B self-hosting, the Daytona SDK and API, OpenAI Agents SDK sandboxes, and a comparison of Node.js sandbox solutions.
Limitations and notes
- Only server-side environments are supported, requiring Node.js 22+ or Bun 1.3+, and edge runtimes are not supported.
- Capabilities such as pause and snapshot depend on the specific provider and are not available in all providers.
- Except for providers that call HTTP APIs directly, the remaining providers require additional installation of the corresponding SDK.
- Version 1.0Compared with 0.2, this version changes the API, and the official documentation provides an item-by-item guide for upgrading from 0.2.
- EARLY_ACCESS.md records configuration instructions and known limitations for each provider.
- Information such as billing models, pricing, and open-source licenses is not yet available in the existing materials.
Documentation and versions The repository provides entry points for Docs, Quickstart, Providers, npm, and Changelog; the release process is described in RELEASING.md, issues are reported via issues, and a security policy is also included.