AB
AiBoss
project

Cube Sandbox - Tencent Cloud's open-source AI Agent sandbox execution environment platform

Cube Sandbox is an open-source AI Agent sandbox execution environment platform from Tencent Cloud, built on RustVMM and KVM, offering both hardware-level security isolation and sub-millisecond startup speeds. Each Agent runs in an independent kernel...

What is a Cube Sandbox?

Cube Sandbox is Tencent Cloud's open-source AI Agent sandbox execution environment platform, built on RustVMM and KVM, offering both hardware-level security isolation and sub-millisecond startup speeds. Each Agent runs in an independent kernel, with single-instance memory overhead below 5MB, and thousands of instances can run concurrently on a single machine. Cube Sandbox is natively compatible with the E2B SDK, supporting zero-cost migration of Agent applications, and has already supported the stable operation of products with hundreds of millions of users, such as Tencent Yuanbao.

Main features of Cube Sandbox

  • High-speed sandbox startBased on resource pooling and snapshot cloning technology, it enables sandboxes with a complete kernel to be cold-start ready within 60 milliseconds, supporting high-frequency Agent call scenarios.
  • Hardware-level security isolationEach sandbox runs on an independent Guest OS kernel, and with the eBPF network isolation mechanism, it completely avoids the risk of container escape and securely executes arbitrary LLM generated code.
  • E2B interface compatibleIt is natively compatible with the E2B SDK standard, and the Agent application can be seamlessly migrated by simply modifying the environment variables, without changing the existing business code.
  • High-density concurrent deploymentThrough Rust underlying rewriting, CoW memory reuse, and reflink disk sharing, the memory overhead of a single instance is less than 5MB, and a single machine can run 2000+ sandbox instances simultaneously.
  • Agent full lifecycle supportIt supports single code execution and tool invocation, and can continuously carry out the "think-execute-feedback" loop of the Agent, covering the complete scenario from application operation to RL training.
  • Refined network managementCubeVS enables network isolation and outbound traffic filtering between sandboxes, allowing developers to customize the whitelist and blacklist for Agent access.
  • One-click cluster deploymentIt supports quick startup of single nodes and expansion of multi-node clusters, and provides one-click deployment capability from development environment to production environment.

The technical principles of Cube Sandbox

  • Core Virtualization ArchitectureBuilt on RustVMM and KVM, each sandbox runs on an independent Guest OS kernel, fundamentally avoiding the escape risk caused by Docker containers sharing the kernel namespace and achieving true hardware-level isolation.
  • Lightning-fast startup mechanismBy pre-provisioning resources through pooling, snapshot cloning, and underlying lock optimization, the lengthy initialization process of traditional virtual machines is skipped, and the sandbox cold start with a complete kernel is compressed to less than 60 milliseconds.
  • Ultimate resource optimizationThe Hypervisor core is rewritten in Rust, and combined with CoW (Copy-on-Write) memory reuse and reflink disk sharing technology, the Hypervisor's own memory overhead is reduced to below 5MB, enabling high-density deployment of 2000+ instances on a single machine.
  • Kernel-level network isolationBy using the eBPF-driven CubeVS component, strict network isolation and fine-grained outbound traffic filtering are achieved between sandboxes in the data plane, replacing the traditional shared network stack.
  • Distributed control architectureThe control plane consists of CubeAPI, CubeMaster, and Cubelet, and is responsible for the sandbox lifecycle and template management; the data plane proxies traffic through CubeProxy, supporting seamless scaling from single-node to multi-node clusters.

How to use Cube Sandbox

  • Preparing the KVM environmentOn an x86_64 Linux physical machine, a cloud bare metal server, or WSL2 (requires Windows 11 22H2+ with nested virtualization enabled), clone the repository and execute... prepare_image.sh and run_vm.sh Initialize the runtime environment; domestic users can access it from [link to source]. cnb.cool Mirror cloning is accelerated.
  • One-click deployment service: Execute the online installation script in the target environment: Domestic users can do so via... MIRROR=cn Parameters use mirror source, run curl -sL .../online-install.sh | MIRROR=cn bash Complete server-side deployment.
  • Create a sandbox template:use cubemastercli tpl create-from-image Based on a pre-built image (such as) sandbox-code:latestCreate a code interpreter template, configure the writable layer size and exposed port, and then... tpl watch Monitor the build progress and wait for the status to change. READY And record the template ID.
  • Configure and run the Agent code:Install e2b-code-interpreter Python SDK, settings E2B_API_URL(Pointing to the local or cluster server)E2B_API_KEY,CUBE_TEMPLATE_ID And the SSL certificate path, creating a sandbox and executing code via the standard E2B interface, GitHub. examples/ The directory provides examples of scenarios such as Shell commands, browser automation, and OpenClaw integration.

Key information and usage requirements for Cube Sandbox

  • Product PositioningTencent Cloud's open-source AI Agent sandbox execution environment platform is the industry's first open-source sandbox service that balances hardware-level isolation with sub-millisecond startup speeds.
  • Core performanceCold start time < 60 milliseconds (average 67 milliseconds with 50 concurrent users), single instance memory overhead < 5MB, a single 96-core server can run 2000+ sandbox instances concurrently.
  • Security ArchitectureBased on RustVMM + KVM, each sandbox has an independent Guest OS kernel, and CubeVS driven by eBPF achieves kernel-level network isolation, completely avoiding the risk of container escape.
  • Eco-compatibleIt is natively compatible with the E2B SDK interface standard, and Agent applications can migrate from overseas closed-source solutions such as Manus and OpenAI Agents SDK at zero cost simply by modifying environment variables.
  • Production ValidationBorn from Tencent Cloud's Serverless system, it has handled billions of calls, supported products with hundreds of millions of users such as Tencent Yuanbao, and enabled MiniMax to schedule hundreds of thousands of instances within minutes during Agentic RL training.

The core advantages of Cube Sandbox

  • Safety and speed at the same timeBreaking the paradox of traditional virtual machines being "more secure but slower," it achieves a 60-millisecond cold start under the premise of independent kernel hardware isolation, which is 2.5 to 50 times faster than the industry average.
  • Ultimate resource efficiencySingle-instance memory overhead is less than 5MB, and a single machine can run 2000+ sandboxes simultaneously, reducing the unit cost of large-scale agent deployment to the lowest level in the industry.
  • Zero migration costIt is natively compatible with the E2B SDK. Existing Agent applications only need to modify one environment variable to smoothly integrate from overseas closed-source solutions without changing any business code.
  • Production-grade reliabilityVerified by Tencent Cloud's Serverless system with billions of calls, it supports the stable operation of products with hundreds of millions of users, such as Tencent Yuanbao, and has withstood the extreme test of MiniMax's minute-level scheduling of hundreds of thousands of instances.
  • Kernel-level network isolationCubeVS, driven by eBPF, achieves strict network isolation and fine-grained outbound control between sandboxes, completely eliminating the risk of container escape and lateral movement attacks.

Cube Sandbox project address

  • GitHub repositoryhttps://github.com/TencentCloud/CubeSandbox

Comparison of Cube Sandbox with similar products

Dimension Cube Sandbox E2B (Closed Source) Docker container
Isolation level Extremely high (independent kernel + eBPF network isolation) Medium (depends on specific implementation) Low (Shared kernel namespaces)
Startup speed < 60ms (milliseconds) 150–200ms ~200ms
Memory overhead < 5MB (extreme cropping) medium Low (shared kernel)
Deployment density Extremely high (thousands of instances on a single machine) medium high
Open source status Open source (Apache 2.0) Closed-source commercial services open source
E2B SDK Compatible Native compatibility (Drop-in) native standard Incompatible
Network isolation eBPF kernel-level fine-grained filtering Basic Strategy Depends on CNI/iptables
Applicable Scenarios High-concurrency agent execution and RL training Agent Quick Access Microservices/Conventional Containerization

Application scenarios of Cube Sandbox

  • AI Agent Code ExecutionIt provides a hardware-level isolated secure runtime environment for Python, Shell, and other code generated by LLM, preventing malicious or erroneous code from affecting the host machine.
  • Agent tool call chainIt supports the Agent's "think-execute-feedback" loop (Harness Loop), continuously completing multiple tool calls and state iterations.
  • Agentic reinforcement learning trainingSupports minute-level scheduling of large-scale concurrent sandbox instances, meeting the extreme requirements of high concurrency and low-cost execution environment in RL training.
  • Enterprise-grade AI programming assistantAs the underlying execution platform supporting AI programming scenarios, such as Tencent Yuanbao, resource core consumption was reduced by 95.8% after migration.
  • Browser automationA browser instance can run within the sandbox, supporting the Agent to complete automated tasks such as web browsing, data collection, and form filling.