Alibaba's OpenSandbox Gives Developers a Free Self-Hosted AI Agent Runtime
Alibaba open-sources the sandbox infrastructure it runs internally, giving AI agent builders a free, self-hostable alternative to managed platforms like E2B
ProTakeaways
- Alibaba open-sourced OpenSandbox, the sandbox infrastructure it uses internally for large-scale AI workloads, under Apache 2.0.
- Supports Docker (local) and Kubernetes (production) runtimes with strong isolation via gVisor, Kata Containers, and Firecracker microVMs.
- Ships with SDKs for Python, Java/Kotlin, JavaScript/TypeScript, C#/.NET, and Go -- all sharing a unified API surface.
- Covers coding agents (Claude Code, Gemini CLI, Codex), browser automation (Playwright, Chrome), full desktop environments (VNC, VS Code), and RL training.
- Includes a CLI tool (
osb) and an MCP server for direct integration with Claude Code and Cursor. - Fully self-hostable alternative to managed services like E2B, with no per-minute fees or vendor lock-in; now listed in the CNCF Landscape.
OpenSandbox is Alibaba's open-source sandbox platform for AI agents, and it's now available to anyone under the Apache 2.0 license. It is built on the same internal infrastructure Alibaba uses for large-scale AI workloads, and the team has packaged it into something you can run locally with Docker or scale out across a Kubernetes cluster. The repo crossed 10,000 stars and has already attracted nearly 900 forks, which tells you how badly the community wanted something like this.
The problem it solves
Building an autonomous agent typically involves two components: the "brain" (usually a large language model) and the "tools" (code execution, web access, or file manipulation). Providing a safe environment for these tools has required developers to manually configure Docker containers, manage complex network isolation, or rely on third-party APIs. That's a painful amount of plumbing before you even start on the actual agent logic.
Secure execution environments have been a hidden bottleneck in AI agent deployment. Most teams either build their own basic isolation environments or avoid the problem altogether. The alternative -- paying for managed sandbox services -- comes with per-minute fees and vendor lock-in that can get expensive fast at scale.
What's inside the box
At its core, a FastAPI-based server manages sandbox lifecycles through Docker or Kubernetes runtimes, with communication standardized via OpenAPI specifications covering lifecycle and execution. Within each isolated container, a high-performance Go-based execution daemon called execd connects to internal Jupyter kernels. This daemon enables stateful code execution, real-time output streaming over Server-Sent Events (SSE), and full filesystem management.
The architecture is deliberately layered into four tiers: SDKs, Specs, Runtime, and Sandbox Instances. This design deliberately decouples client logic from underlying execution environments, so you can swap runtimes without rewriting your agent code. The OpenAPI spec is public, meaning you can also plug in a completely custom sandbox runtime if the built-ins don't fit your needs.