Introduction
CubeSandbox is an open-source sandbox infrastructure purpose-built for AI Agents — a production-hardened runtime that executes untrusted code, hosts long-running Agent processes, and runs stateful services. Built on RustVMM + KVM, each sandbox runs inside a hardware-isolated MicroVM with its own dedicated kernel, booting in under 60ms with less than 5MB of additional VMM memory overhead, and natively supporting both x86_64 and ARM64. The core system was validated at scale in Tencent Cloud production environments before open-sourcing.
Key Advantages
Instant Boot & Hardware Isolation
⚡ Sub-60ms Cold Start · High Density: Powered by pre-warmed snapshot pooling and CubeCoW copy-on-write, single-concurrency cold starts average 41ms, while 50 concurrent creations average 92.4ms (P95 121.9ms) at 512 sandboxes/s throughput on bare metal (CubeBench v0.7.3). Per-instance VMM overhead is < 5MB (~18–25 MiB amortized host memory per idle VM), enabling thousands of instances per node. See Performance Benchmark.
🔒 Dedicated-Kernel Hardware Isolation: Every sandbox gets its own Guest OS kernel — eliminating shared-kernel container escape surfaces. KVM + eBPF enforce hardware and kernel-level boundaries so you can run untrusted LLM-generated code safely.
⚙️ Native x86_64 & ARM64 Pipeline: Full-stack native support across
x86_64andaarch64 (ARM64)— from the hypervisor and guest kernel to base images and automated deployment.
Agent-Native Lifecycle & State Primitives
🤖 Agent Hosting, Not Just Code Execution: The same lifecycle primitives cover one-shot code execution, full stateful service stacks (Redis, MySQL, browsers, desktops, dev environments), and long-running Agent processes (including hosting OpenClaw assistants via AgentHub (Preview)).
⏸️ Auto-Pause & Hundred-Millisecond Resume: Idle sandboxes are automatically snapshot-suspended to release compute resources and transparently restored on the next request — hundred-millisecond wake-up with zero caller awareness — plus configurable auto-restart policies when in-sandbox services crash.
📸 Snapshot · Clone · Rollback: Hundred-millisecond checkpoints powered by CubeCoW and incremental dirty-page tracking let you roll back to any saved state, fork parallel exploration branches, or take lower-cost filesystem-only (FS-only) snapshots. See Snapshot, Rollback & Clone.
🌐 Cross-Node Pause & Resume (Preview): With the JuiceFS or S3 shared snapshot backend, paused sandboxes can be resumed — and new sandboxes created from snapshots — on any compatible node in the cluster, so node maintenance or failure no longer strands workloads. See Cross-Node Migration.
Zero-Trust Networking, Storage & E2B Compatibility
🔌 Seamless E2B Migration & Official SDKs: Native E2B SDK compatibility (covering up to E2B 2.51.0+; see E2B Compatibility) — swap an environment variable with zero business code changes. Official Python, Go, and Node.js SDKs are also included.
🛡️ Credential Vault & L7 Egress Control: Secrets stay in the control plane and never enter sandboxes, model context, or logs. CubeEgress enforces L7 domain allowlists, blocks unauthorized egress immediately, injects credentials dynamically, and records full audit logs, complementing Network Policy and Sandbox-to-Sandbox Access.
💾 Decoupled Volume Storage Framework: An E2B-compatible Volume framework with pluggable storage drivers (S3, COS, JuiceFS, NFS, and custom backends) decouples storage lifecycles from sandboxes and supports multi-sandbox data sharing.
Simple Deployment & Production Operations
🚀 Ready Out of the Box: A minimal one-click script brings up a complete environment in minutes. Deploy on standard cloud VMs without
/dev/kvmvia PVM, or run on bare metal, multi-node clusters, Kubernetes (Helm), hybrid deployments (K8s control plane + bare-metal/VM data plane), and Tencent Cloud (Terraform).📦 Template System: Convert OCI images into templates in one step, use template aliases, commit running sandboxes as templates, install presets from the Template Store, and auto-distribute across nodes. See Templates Overview.
🖥️ Web Console & Production Observability: Built-in WebUI Dashboard (open
:12088right after install) to manage sandboxes, templates, nodes, and version matrices visually — alongside turnkey Prometheus / Grafana metrics, logs, and tracing, extensible scheduler plugins, and per-template QoS.
Drop-In E2B Compatibility in 5 Lines
Existing E2B workloads require zero application code changes — point the SDK to your CubeSandbox endpoint to switch to self-hosted, hardware-isolated MicroVMs:
export E2B_API_URL="http://127.0.0.1:3000"
export E2B_API_KEY="e2b_000000"from e2b_code_interpreter import Sandbox # Use the E2B SDK directly
with Sandbox.create(template="<your-template-id>") as sandbox:
result = sandbox.run_code("print('Hello from CubeSandbox!')")
print(result)See Quick Start for the full end-to-end walkthrough and E2B Compatibility for API coverage details.
Typical Use Cases
- Code Interpreters & Coding Agents: Run untrusted generated code and shell workflows safely with integrations for Claude Code, LangGraph, OpenAI Agents SDK, Google ADK, and more (see Framework & Tool Integrations).
- Browser & Desktop Automation (Computer Use): Run headless Chromium (Playwright) or a full Ubuntu Desktop inside isolated MicroVMs with strict per-session boundaries.
- Persistent Stateful Agents & Cloud Workspaces: Combine auto-pause/resume, decoupled Volumes, and L7 egress proxy to host long-lived dev environments, databases, and dedicated Agent instances.
- High-Concurrency Evaluation & RL Rollout: Leverage sub-60ms boot, high node density, and fast snapshot clone/rollback for SWE-bench evaluation and reinforcement learning rollouts.
Explore real-world production deployments in Case Studies and runnable demos in Example Projects.
CubeSandbox vs Alternatives
| Metric | Docker Container | Traditional VM | CubeSandbox |
|---|---|---|---|
| Isolation Level | Low (Shared Kernel Namespaces) | High (Dedicated Kernel) | Hardware-Isolated (Dedicated Kernel + eBPF) |
| Boot Speed | ~200ms | Seconds to minutes | Sub-60ms (41ms avg at c=1) |
| Memory Overhead | Low (Shared Kernel) | High (Full Guest OS) | Ultra-low (< 5MB VMM, CoW page sharing) |
| Single-Node Density | High | Low | High (Thousands per node) |
| Auto-Pause / Resume | Custom orchestration | Manual suspend, slow wake | ✅ Platform-managed (100ms-level resume) |
| Snapshot / Clone / Rollback | Filesystem-only, no RAM state | Supported (seconds to minutes) | ✅ Hundred-millisecond (Full-state / FS-only) |
| Cross-Node Pause / Resume | Custom migration | Needs shared storage & live migration | ✅ JuiceFS / S3 backend (Preview) |
| E2B SDK Compatible | No | No | ✅ Drop-in (zero code changes) |
| Agent Hosting | Manual setup | Manual setup | ✅ Native (AgentHub, Preview) |
Next Steps
Get Started
- Quick Start — go from zero to a running isolated sandbox in four steps.
- E2B Compatibility — version-by-version E2B SDK compatibility matrix and CubeSandbox extensions.
- Example Projects / Framework & Tool Integrations — end-to-end demos for code execution, browsers, LangGraph, Claude Code, and more.
Choose a Deployment Option
- PVM Deployment — deploy on standard cloud servers without
/dev/kvm. - Bare-Metal Deployment / Self-Build Deployment — deploy on native KVM hosts or build from source.
- Multi-Node Cluster Deployment — scale out to a multi-node production cluster.
- Kubernetes Deployment / Hybrid Deployment / Tencent Cloud Cluster (Terraform) — automated Helm installation, hybrid K8s control plane + bare-metal/VM data plane, or Terraform provisioning.
Dive Deeper & Operate
- Architecture Overview — control plane, data plane, and core component interactions.
- Sandbox Lifecycle / Snapshot, Rollback & Clone / Cross-Node Migration — master core state primitives.
- Creating Templates from OCI Images / Using Volumes — customize runtime images and persistent storage.
- Egress Proxy (Filtering & Secrets) / WebUI Dashboard / Sandbox Observability Deployment — security, visual operations, and monitoring.
- Digital Assistant (AgentHub) / Case Studies — hosted AI Agent instances and production stories.