Preface¶
In July 2026, Tencent Cloud officially open-sourced CubeSandbox (TencentCloud/CubeSandbox) on GitHub. This is a high-performance secure sandbox designed for AI Agent code execution scenarios, built on RustVMM + KVM. It claims cold start time under 60ms, per-instance memory overhead below 5MB, and native compatibility with the E2B SDK interface.
As of late July 2026, the project’s GitHub Star count has exceeded 10,000 (approximately 10,700), and it has appeared on both GitHub Trending and the CNCF Landscape’s AI-Native Infrastructure list. Against the backdrop of frequent Agent security incidents—cases like OpenClaw autonomous Agents triggering security discussions due to excessive permissions, GitLost private repository leaks, and destructive commands accidentally deleting files—CubeSandbox provides a self-hosted path with “hardware-level isolation + millisecond-scale startup” that is worth careful evaluation by developers.
This article is based on the official README, architecture documents, DEV Community publications, and third-party technical observations, sorting out what problems CubeSandbox aims to solve, how its technical architecture is designed, and how to get started quickly.
Why Agents Need Independent Execution Sandboxes¶
The Managed Agent architecture proposed by Anthropic in 2026 splits Agents into three core components: Session, Harness, and Sandbox. Among them, the Sandbox is responsible for hosting code generated by LLMs and tool calls, and is the most critical layer of security boundary in the Agent architecture.
Existing solutions generally face a trade-off between “security vs. performance”:
| Solution | Advantages | Limitations |
|---|---|---|
| Docker Containers | Fast startup, high density | Shares the host kernel, with container escape risks in multi-tenant scenarios |
| Traditional Virtual Machines | Hardware-level isolation | Cold start takes seconds, memory usage is hundreds of MB, unsuitable for the Agent’s high-frequency “use and destroy” scheduling mode |
| E2B and other SaaS Sandboxes | Out-of-the-box, mature SDK | Closed-source, costs grow linearly with call volume, difficult to deeply customize |
CubeSandbox’s positioning is to meet both KVM hardware isolation and sub-100ms cold start under the premise of being open-source and self-hostable. In its DEV Community article, the project team described it as “the industry’s first open-source sandbox service that combines hardware-level isolation with sub-100ms startup”—this statement comes from the project team, and third parties have not yet independently reproduced all benchmark data, but performance reports and demo videos on GitHub are available for reference.
Core Metrics Overview¶
The following data are from the CubeSandbox official README and DEV publication:
| Metric | Data | Meaning |
|---|---|---|
| Cold Start | <60ms | Single-concurrency bare metal benchmark; P95 is approximately 90ms and P99 is approximately 137ms when creating 50 concurrent instances |
| Per-instance Memory Overhead | <5MB | Shares template pages based on CoW snapshots, physical memory is only allocated when actually written |
| Isolation Level | KVM Hardware-level | Each sandbox has an independent Guest OS kernel |
| Single-machine Concurrency | 2000+ | Tested by the official team on a 96 vCPU physical machine |
| E2B Compatibility | Native Support | Can be migrated by changing environment variables without modifying business code |
| License | Apache 2.0 | Commercially usable, secondary development allowed |
The project was first open-sourced on April 20, 2026 (v0.1.0), and as of July 23, 2026, the latest pre-release version is v0.6.0-rc2. Version v0.5.0 (2026-07-03) introduced capabilities such as AutoPause/AutoResume, one-click cluster deployment via Terraform, ARM64 support, and network policy hardening.
Technical Architecture: Separation of Control Plane and Data Plane¶
CubeSandbox adopts a clear layered architecture, with the following core components (see architecture documentation for details):
Client / E2B SDK
│
▼
CubeAPI ← E2B-compatible REST gateway
│
▼
CubeMaster ← Cluster scheduling and state maintenance
│
▼
Cubelet ← Node-level sandbox lifecycle management
│
▼
CubeShim ← containerd Shim v2 interface
│
▼
CubeHypervisor (RustVMM) ← KVM MicroVM management
│
▼
MicroVM(sandbox instance)
Brief descriptions of each component’s responsibilities:
- CubeAPI: Exposes E2B-compatible REST APIs, clients only need to switch the endpoint.
- CubeMaster: Receives creation/destruction requests, responsible for resource scheduling and cluster status.
- CubeProxy: Routes requests to the corresponding sandbox according to the format <port>-<sandbox_id>.<domain> in the Host header.
- Cubelet: Local scheduler on a single node, manages all sandbox instances on that node.
- CubeShim: A Rust-implemented containerd Shim v2 that bridges the container runtime abstraction and MicroVM.
- CubeHypervisor: A lightweight VMM based on RustVMM + KVM, managing vCPUs, memory, virtio devices, and snapshot recovery.
- CubeVS: An eBPF-based kernel-level network forwarder, which rejects private/link-local addresses by default and supports per-sandbox outbound policies.
Custom VMM Instead of Directly Adopting Firecracker¶
The project team explained in the DEV article that Firecracker is a general-purpose MicroVM, and its startup process includes steps unnecessary for Agent scenarios. CubeSandbox developed CubeVM based on CloudHypervisor with targeted optimizations:
1. Minimize device model: Only retain necessary virtual devices such as virtio-net, virtio-blk, and serial ports.
2. Custom Guest Kernel: Only retain the minimum set of kernel features required for Agent execution.
3. User-space interrupt handling: Key I/O paths are completed in user space, reducing kernel-mode switches.
Key to <60ms Cold Start: Resource Pool + Snapshot Cloning¶
Fast startup is not simply about “the VM itself starting quickly”, but relies on pre-created resource pools and Copy-on-Write snapshot cloning:
- Maintain a batch of pre-started “blank sandboxes” in the background, and directly take them from the pool when requests arrive, skipping the full startup process.
- Instantly clone new instances from template sandboxes based on CoW, and physical memory pages are only allocated when first written to—this is also the reason for the <5MB per-instance overhead.
The CubeCoW snapshot engine introduced in v0.3.0 also supports event-level snapshots, instant cloning, and rollbacks, providing additional protection against unpredictable Agent behavior.
Multi-layer Security Mechanisms¶
In addition to KVM hardware-level isolation, CubeSandbox also hardens security at the network and credential levels:
1. Network Isolation: CubeVS rejects private/link-local address ranges by default, and supports per-sandbox allow/deny policies.
2. Outbound Control: CubeEgress L7 proxy + domain name whitelist, unauthorized outbound traffic is immediately blocked and audited.
3. Credential Vault: Secrets are injected via header rewriting, and never enter the sandbox, model context, or logs.
4. Seccomp: CubeHypervisor runs with a minimal syscall whitelist.
Relationship with the E2B Ecosystem¶
E2B is currently the de facto standard protocol in the AI Agent sandbox field, adopted by products such as Manus, Perplexity, and Hugging Face. CubeSandbox natively supports the E2B protocol at the API layer, with extremely low migration costs—the official team states that “only one URL environment variable needs to be changed, with zero business code modifications”.
For projects already using the E2B SDK, the migration steps are roughly as follows:
1. Deploy the CubeSandbox service (requires x86_64 Linux + KVM support, OpenCloudOS 9 is recommended):
curl -sL https://cnb.cool/CubeSandbox/CubeSandbox/-/git/raw/master/deploy/one-click/online-install.sh | MIRROR=cn bash
2. Create a code interpreter template:
cubemastercli tpl create-from-image \
--image ccr.ccs.tencentyun.com/ags-image/sandbox-code:latest \
--writable-layer-size 1G \
--expose-port 49999 \
--expose-port 49983 \
--probe 49999
3. Install the E2B Python SDK and switch the endpoint:
pip install e2b-code-interpreter
export E2B_API_URL="http://127.0.0.1:3000"
export E2B_API_KEY="dummy"
export CUBE_TEMPLATE_ID="<your-template-id>"
4. No modifications required for existing business code:
import os
from e2b_code_interpreter import Sandbox
with Sandbox.create(template=os.environ["CUBE_TEMPLATE_ID"]) as sandbox:
result = sandbox.run_code("print('Hello from Cube Sandbox!')")
print(result)
The OpenAI Python SDK can also be used seamlessly—the official team marked E2B SDK compatibility items in the benchmark comparison table.
OpenClaw and Agent Security Background¶
The connection between CubeSandbox and OpenClaw mainly lies in the official AgentHub digital assistant capabilities: the README states that it can “pull up the OpenClaw assistant with one click”, and supports snapshots, rollbacks, and assistant template publishing. The examples/ directory of the repository also includes OpenClaw integration examples.
OpenClaw is a highly popular open-source autonomous Agent in 2026 that can connect to messaging platforms such as Telegram and WhatsApp to perform real tasks. Its default sandbox backend is Docker containers (optional), and the official documentation clearly notes that the sandbox is an “availability limitation” rather than a perfect security boundary, and tools.elevated can bypass the sandbox to execute commands on the host machine. The Cisco Security Research Team once tested third-party OpenClaw Skills and found data exfiltration and prompt injection risks; in March 2026, some Chinese institutions also issued security warnings regarding the use of OpenClaw.
Against this background, CubeSandbox provides a more underlying KVM MicroVM isolation—each Agent tool call runs in an independent Guest kernel, rather than sharing the host kernel namespace. For scenarios that need to run untrusted LLM-generated code or schedule multiple Agents in parallel, hardware-level sandboxes can limit the blast radius of “accidental file deletion” or “container escape” to a single MicroVM.
Destructive Command Guard, which appeared on GitHub Trending around the same time, intercepts dangerous shell/Git operations at the command layer. The two can be combined: Guard is responsible for “blocking”, and CubeSandbox is responsible for “isolation”—even if Guard misses a threat, the damage will be limited to the inside of the sandbox.
Applicable Scenarios¶
Based on official cases and architectural design, CubeSandbox is particularly suitable for the following scenarios:
1. Real-time code execution Agents: Such as code interpreters, data analysis assistants, requiring millisecond-level response + hardware isolation.
2. Agentic RL training: Each episode requires an independent, destroyable execution environment; the official team states that a certain model manufacturer can schedule hundreds of thousands of sandbox instances within minutes.
3. Enterprise-level Agent tool calls: Through outbound whitelists and credential vaults, prevent Agents from accessing unauthorized APIs or leaking secrets.
4. E2B self-hosted alternative: Projects that have integrated E2B SDK and want to reduce costs or keep data within the territory.
Environment requirements: x86_64 Linux + KVM (full-stack ARM64 support was added starting from v0.5.0). It supports single-machine deployment, and can also be scaled into a multi-node cluster via Kubernetes CRD/Operator; v0.5.0 provides a one-click cluster deployment script via Terraform.
How to Evaluate and Get Started¶
CubeSandbox has been verified in Tencent Cloud’s internal production environment, and the official team states that it supports stable operation of products such as Tencent Yuanbao, with a cumulative call volume of billions of times. However, as a project open-sourced in April 2026, it is still in rapid iteration (the latest version is v0.6.0-rc2 pre-release), and some capabilities of the E2B protocol’s “fully drop-in compatible” are still on the roadmap (such as cross-node Pause & Resume, Volume protocol, etc.).
The recommended evaluation path:
1. Non-production environment trial: Deploy on a Linux machine with KVM according to the Quick Start, and run through the E2B SDK example.
2. Compare with existing solutions: If you currently use Docker to run Agent tools, you can compare startup latency, memory density, and isolation levels; if you use E2B Cloud, you can evaluate migration costs and self-hosted operation and maintenance overhead.
3. Pay attention to security layer combination: Sandbox + command guard + outbound whitelist + credential vault form a multi-layer defense, and relying on any single layer is insufficient.
4. Track version iterations: AutoPause in v0.5 is meaningful for cost optimization; snapshot rollback in v0.3 is valuable for Agent debugging and RL training.
Summary¶
CubeSandbox attempts to solve a core contradiction in Agent infrastructure: containers are fast but not secure enough, while virtual machines are secure enough but not fast enough. Through the custom RustVMM, pre-created resource pools, and CoW snapshot cloning, it provides a combination of “KVM hardware-level isolation + 60ms-level cold start + E2B compatibility” in open-source solutions.
For developers building Agent platforms, it is worth adding to the technology selection list—especially when you need a self-hosted, controllable, high-concurrency code execution environment and already have E2B SDK integration, the migration threshold is very low. However, it is also necessary to clearly recognize: the performance data comes from official benchmarks, and production deployment still requires pressure testing with your own workload; Agent security is a systematic engineering, and the sandbox is only one part of it, which also needs to be combined with command interception, network policies, credential management, and model-side guardrails.
Project address: https://github.com/TencentCloud/CubeSandbox