Overview
OpenSandbox is an open-source platform that gives AI applications a safe, isolated place to run code and shell commands. It exposes one unified sandbox API and ships SDKs for Python, Java/Kotlin, JavaScript/TypeScript, C#/.NET, and Go, so you can plug it into almost any stack.
It is built for the work agents actually do: coding agents, GUI agents, agent evaluation, AI code execution, and reinforcement-learning training. Under the hood it runs on Docker for local use and a high-performance Kubernetes runtime for large-scale, distributed scheduling.
Each sandbox comes with built-in Command, Filesystem, and Code Interpreter tools, plus network controls and a credential vault. For tighter isolation between workloads and the host, it supports secure container runtimes like gVisor, Kata Containers, and Firecracker microVMs.
What it does
- Multi-language SDKs for Python, Java/Kotlin, JavaScript/TypeScript, C#/.NET, and Go over one unified sandbox API
- Docker runtime for local runs and a high-performance Kubernetes runtime for large-scale distributed scheduling
- Built-in Command, Filesystem, and Code Interpreter environments, plus examples for coding agents, browser automation, and desktop (VNC, VS Code)
- Network policy with a unified Ingress Gateway and per-sandbox egress controls
- Credential Vault that injects secrets into outbound requests without exposing real credentials to the workload
- Strong isolation via secure container runtimes including gVisor, Kata Containers, and Firecracker microVM
Getting started
You need Docker (for local execution) and Python 3.10+ for the examples and local runtime. Install the SDK or CLI, start a local sandbox server, then create a sandbox and run code inside it.
Install the Python SDK
Add the OpenSandbox SDK to your project. SDKs are also available for JavaScript/TypeScript, Java/Kotlin, C#/.NET, and Go.
pip install opensandboxStart the local sandbox server
Generate a Docker example config and launch the server with uvx (no separate clone needed).
uvx opensandbox-server init-config ~/.sandbox.toml --example docker
uvx opensandbox-serverCreate a sandbox and run a command
Create a sandbox, then execute a shell command inside it and read the output.
import asyncio
from datetime import timedelta
from opensandbox import Sandbox
async def main() -> None:
sandbox = await Sandbox.create(
"opensandbox/code-interpreter:v1.1.0",
entrypoint=["/opt/code-interpreter/code-interpreter.sh"],
timeout=timedelta(minutes=10),
)
async with sandbox:
execution = await sandbox.commands.run("echo 'Hello OpenSandbox!'")
print(execution.logs.stdout[0].text)
await sandbox.kill()
asyncio.run(main())Drive sandboxes from the terminal
The osb CLI handles the common workflow: configure a connection, create a sandbox, and run commands.
pip install opensandbox-cli
osb config init
osb sandbox create --image python:3.12 --timeout 30m -o json
osb command run <sandbox-id> -o raw -- python -c "print(1 + 1)"Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Letting a coding agent (such as Claude Code) install dependencies, run commands, and edit files in an isolated environment instead of on the host
- Safely executing AI-generated or untrusted code in apps, with strong isolation via gVisor, Kata Containers, or Firecracker
- Running browser-automation and GUI tasks inside sandboxes using built-in Chrome, Playwright, VNC, and VS Code examples
- Spinning up many isolated environments on Kubernetes for agent evaluation and reinforcement-learning training workloads
How OpenSandbox compares
OpenSandbox alongside other open-source gpu & compute clouds tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Daytona | ★ 72.2k | Daytona is an open-source runtime that spins up isolated sandboxes in under 90ms so agents can safely run and persist AI-generated code. |
| Ray | ★ 43.2k | A distributed computing framework that scales Python and ML workloads for training, tuning, data processing, and serving. |
| Prefect | ★ 23.3k | A Python-native workflow orchestration tool for scheduling, running, and monitoring data and ML pipelines. |
| Dagster | ★ 15.8k | A data and ML pipeline orchestrator with a declarative asset model, built-in lineage, and observability. |
| Kubeflow | ★ 15.8k | A Kubernetes toolkit that brings together pipelines, notebooks, and training operators for running ML workflows at scale. |
| E2B | ★ 13k | E2B is open-source infrastructure that runs AI-generated code inside secure, isolated cloud sandboxes, controlled from JavaScript or Python SDKs. |
| OpenSandbox | ★ 12k | General-purpose sandbox platform that runs AI-generated code in isolated containers |
| SkyPilot | ★ 10.3k | A framework that runs AI jobs across clouds and Kubernetes, automatically finding and provisioning the cheapest available GPUs. |