Skip to content

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_64 and aarch64 (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 ​

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:

bash
export E2B_API_URL="http://127.0.0.1:3000"
export E2B_API_KEY="e2b_000000"
python
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 ​

MetricDocker ContainerTraditional VMCubeSandbox
Isolation LevelLow (Shared Kernel Namespaces)High (Dedicated Kernel)Hardware-Isolated (Dedicated Kernel + eBPF)
Boot Speed~200msSeconds to minutesSub-60ms (41ms avg at c=1)
Memory OverheadLow (Shared Kernel)High (Full Guest OS)Ultra-low (< 5MB VMM, CoW page sharing)
Single-Node DensityHighLowHigh (Thousands per node)
Auto-Pause / ResumeCustom orchestrationManual suspend, slow wake✅ Platform-managed (100ms-level resume)
Snapshot / Clone / RollbackFilesystem-only, no RAM stateSupported (seconds to minutes)✅ Hundred-millisecond (Full-state / FS-only)
Cross-Node Pause / ResumeCustom migrationNeeds shared storage & live migration✅ JuiceFS / S3 backend (Preview)
E2B SDK CompatibleNoNo✅ Drop-in (zero code changes)
Agent HostingManual setupManual setup✅ Native (AgentHub, Preview)

Next Steps ​

Get Started ​

Choose a Deployment Option ​

Dive Deeper & Operate ​