# Main Features of CubeSandbox: AI-Native Sandboxes with Sub-60ms Cold Start and E2B Compatibility

> Explore CubeSandbox AI-Native sandboxes featuring sub-60ms cold starts hardware isolation and E2B SDK compatibility for instant secure AI agent execution.

- Repository: [Tencent Cloud/CubeSandbox](https://github.com/TencentCloud/CubeSandbox)
- Tags: getting-started
- Published: 2026-07-14

---

**CubeSandbox delivers instant, secure execution environments for AI agents through RustVMM/KVM micro-VMs, offering sub-60ms cold starts, hardware-level isolation, and full compatibility with the E2B SDK.**

CubeSandbox is an open-source AI-native sandbox service designed to run untrusted AI-generated code at scale. According to the TencentCloud/CubeSandbox repository, the platform combines **RustVMM**, **KVM**, and an **eBPF**-based virtual switch to provide micro-virtual machines that boot in under 60 milliseconds while maintaining strict security boundaries. This architecture enables high-density deployments where thousands of sandboxes coexist on a single node.

## Core Architecture and Performance

CubeSandbox's performance characteristics stem from its RustVMM foundation and optimized startup pipeline.

### RustVMM and KVM Foundation

The architecture builds on **RustVMM** and **KVM** to provide true hardware virtualization without traditional VM overhead. The `CubeHypervisor` and `CubeShim` components—referenced in `CubeMaster/pkg/task/*` and `Cubelet/storage/*`—coordinate micro-VM lifecycle management. Each sandbox runs its own Guest OS kernel, eliminating the shared-kernel escape surface common to container-based solutions.

### Sub-60ms Cold Start and Memory Footprint

CubeSandbox achieves **sub-60 ms boot times** with less than 5 MiB memory overhead per sandbox. The startup flow orchestrates between `CubeAPI` (the REST gateway) and `Cubelet` services, with template resolution handled in `CubeMaster/pkg/templatecenter/*` and volume preparation in `Cubelet/storage/*`. This efficiency enables high-density clusters supporting thousands of concurrent sandboxes on commodity hardware.

## Developer Experience and Compatibility

The platform prioritizes migration ease through protocol compatibility and flexible templating.

### E2B SDK Compatibility

CubeSandbox offers **drop-in migration** from existing E2B implementations by conforming to the E2B protocol at the `CubeAPI` layer. Developers can migrate AI agent workloads by changing only the endpoint URL, requiring zero modifications to existing SDK calls.

### Template System and OCI Integration

Any **OCI image** can convert into a reusable sandbox template through the pipeline in `CubeMaster/pkg/templatecenter/*`. The [`template_image.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/template_image.go) and [`store.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/store.go) files handle template conversion, validation, and auto-distribution across cluster nodes, turning standard container images into optimized sandbox templates.

## Advanced Sandbox Lifecycle Management

Sophisticated state management capabilities differentiate CubeSandbox from ephemeral execution environments.

### CubeCoW Snapshot Engine

The **CubeCoW** (Copy-on-Write) engine provides event-level snapshots, instant cloning, and millisecond rollbacks. Core implementation resides in [`Cubelet/storage/cubecow_engine.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/Cubelet/storage/cubecow_engine.go), with snapshot controllers under [`CubeMaster/pkg/templatecenter/snapshot_ops.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/CubeMaster/pkg/templatecenter/snapshot_ops.go). This enables use cases like checkpointing long-running AI assistant states or instantiating multiple sandboxes from a golden master image.

### Auto-Pause and Resume

Idle sandboxes automatically suspend to conserve resources, resuming on demand with minimal latency. The auto-pause logic resides in [`CubeMaster/pkg/templatecenter/auto_pause.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/CubeMaster/pkg/templatecenter/auto_pause.go), allowing the system to maintain high logical concurrency while optimizing actual resource utilization.

## Security and Network Isolation

Defense-in-depth strategies protect both the host infrastructure and sandbox contents.

### CubeVS eBPF Virtual Switch

**CubeVS** provides per-sandbox traffic tokens and policy-based routing through eBPF. Network policy enforcement lives in [`CubeNet/cubevs/netpolicy.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/CubeNet/cubevs/netpolicy.go) and [`reaper.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/reaper.go), creating a high-performance virtual switching layer that isolates traffic without the overhead of traditional bridge networking.

### Credential Vault and Egress Control

The **CubeEgress** component (built on OpenResty) implements domain allow-lists, credential injection, and comprehensive audit logging. Security policies enforced via `CubeVS` in `CubeNet/cubevs/*` ensure that untrusted code accesses external resources only through explicitly permitted channels.

## Infrastructure and Tooling

Operational capabilities extend beyond the runtime to deployment and management interfaces.

### Web Console and Digital Assistant Hub

The **WebUI** dashboard—served by `CubeProxy`—provides browser-based management of nodes, templates, sandboxes, and logs. The **Digital Assistant Hub** in `CubeMaster/pkg/templatecenter/cube_egress_ca/*` enables one-click deployment of OpenClaw-style AI assistants that leverage snapshot publishing and template inheritance.

### Terraform and ARM64 Support

Production deployments support **ARM64** architectures for edge computing environments, with infrastructure-as-code templates available in [`docs/guide/tencentcloud-terraform-deploy.md`](https://github.com/TencentCloud/CubeSandbox/blob/main/docs/guide/tencentcloud-terraform-deploy.md).

## Implementation Examples

Below are minimal Go snippets demonstrating how the repository's libraries create sandboxes, manage snapshots, and handle restoration.

Creating a sandbox from an existing template using the `CubeMaster/pkg/templatecenter` client:

```go
tpl, _ := templatecenter.GetTemplate("ubuntu:latest")
sandboxID, _ := tpl.CreateSandbox(context.Background(), templatecenter.SandboxConfig{
    Name:   "my-sandbox",
    CPU:    2,
    Memory: 1024,
})
fmt.Println("Sandbox started:", sandboxID)

```

Taking a snapshot of a running sandbox via the CubeCoW engine:

```go
snapID, _ := cubecowengine.TakeSnapshot(context.Background(), sandboxID)
fmt.Println("Snapshot taken:", snapID)

```

Restoring a sandbox from a snapshot:

```go
restoredID, _ := cubecowengine.RestoreSnapshot(context.Background(), snapID)
fmt.Println("Sandbox restored from snapshot:", restoredID)

```

These calls wrap the underlying `CubeMaster` and `Cubelet` services, with core logic implemented in [`CubeMaster/pkg/templatecenter/template_image.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/CubeMaster/pkg/templatecenter/template_image.go), [`CubeMaster/pkg/templatecenter/snapshot_ops.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/CubeMaster/pkg/templatecenter/snapshot_ops.go), and [`Cubelet/storage/cubecow_engine.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/Cubelet/storage/cubecow_engine.go).

## Summary

- **Sub-60ms cold starts** with <5 MiB memory overhead per sandbox, implemented in `CubeMaster/pkg/templatecenter/*` and `Cubelet/storage/*`.
- **Hardware-level isolation** via RustVMM/KVM micro-VMs with no shared kernel surface, coordinated through `CubeHypervisor` and `CubeShim`.
- **E2B protocol compatibility** at the `CubeAPI` layer enables zero-friction migration of existing AI agent workloads.
- **CubeCoW snapshot engine** in [`Cubelet/storage/cubecow_engine.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/Cubelet/storage/cubecow_engine.go) provides instant cloning and millisecond rollbacks.
- **eBPF-based networking** via `CubeVS` ([`CubeNet/cubevs/netpolicy.go`](https://github.com/TencentCloud/CubeSandbox/blob/main/CubeNet/cubevs/netpolicy.go)) delivers high-performance isolation and policy enforcement.
- **ARM64 and Terraform support** for edge deployments and infrastructure-as-code provisioning.

## Frequently Asked Questions

### What makes CubeSandbox different from container-based sandboxes?

CubeSandbox utilizes **RustVMM** and **KVM** to provide hardware-level isolation where each sandbox runs its own Guest OS kernel. Unlike containers that share the host kernel—creating potential escape surfaces—CubeSandbox's micro-VM architecture in `CubeMaster/pkg/task/*` ensures complete kernel separation while maintaining faster-than-container startup times through optimized snapshotting.

### How does CubeSandbox achieve sub-60ms cold starts?

The platform achieves **sub-60 ms boot times** through a combination of pre-optimized templates handled in `CubeMaster/pkg/templatecenter/*`, efficient volume preparation in `Cubelet/storage/*`, and the lightweight RustVMM virtualization stack. The template system eliminates container image extraction overhead by maintaining ready-to-boot root filesystem snapshots.

### Can I migrate existing E2B applications to CubeSandbox?

Yes. The `CubeAPI` implements the **E2B protocol** natively, allowing drop-in migration by changing only the endpoint URL. Existing applications using the E2B SDK require no code modifications to run on CubeSandbox infrastructure, as the API layer handles protocol translation to the underlying RustVMM/KVM runtime.

### What hardware architectures does CubeSandbox support?

CubeSandbox supports both **x86_64** and **ARM64** architectures natively. The repository includes Terraform deployment templates in [`docs/guide/tencentcloud-terraform-deploy.md`](https://github.com/TencentCloud/CubeSandbox/blob/main/docs/guide/tencentcloud-terraform-deploy.md) for provisioning ARM64-based clusters, making the platform suitable for edge computing environments and cloud-native deployments alike.