Introduction
CubePod is an open-source, cloud-native Persistent Writable RootFS MicroVM Execution Platform for AI Agents, built to power CubePlex and the broader E2B / MCP open-source ecosystem.
Unlike stateless container runners or ephemeral sandboxes that discard installed dependencies, browser state, and system configuration whenever a session pauses or restarts, CubePod gives every AI agent a hardware-isolated sandbox whose entire OS filesystem (/, /usr, /etc, /var/lib) and user project directory (/workspace) both persist independently.
Why Persistent Writable RootFS Matters
Section titled “Why Persistent Writable RootFS Matters”Modern autonomous agents do far more than evaluate isolated Python snippets. Over multi-hour or multi-day tasks they install system packages (apt, pip, npm, Playwright browsers), configure systemd or background daemons, authenticate CLI tools, compile code, and edit repositories.
Standard sandbox platforms leave you with an awkward trade-off:
- Ephemeral MicroVMs offer strong hypervisor isolation, but their RootFS lives only in RAM/scratch layers — pausing or restarting wipes OS packages and system state unless you rebuild custom base images on every mutation.
- Persistent Volume Containers keep
/workspacealive, but lack hardware VM boundaries and force agents to reinstall OS packages or lose system config across pod restarts.
CubePod removes this compromise by booting stock, unmodified OCI images inside Kata Containers MicroVMs backed by dual persistent volumes: one volume holds an OverlayFS writable upperdir for the entire Linux RootFS, while a second volume exclusively stores /workspace.
Platform Comparison
Section titled “Platform Comparison”| Capability | Plain Containers | Ephemeral MicroVMs | CubePod |
|---|---|---|---|
| Compute Isolation | Shared host Linux kernel | Hardware VM (Firecracker / QEMU) |
Hardware VM (Kata QEMU / Cloud Hypervisor) + local Docker loopback |
| OS RootFS Persistence | Ephemeral writable layer | Ephemeral scratch layer | Persistent OverlayFS upperdir (<box>-rootfs-pvc) |
| Workspace Persistence | Optional PVC mount | Optional or lost on stop | Decoupled persistent volume (<box>-workspace-pvc) |
| RootFS Reset / OS Upgrade | Recreate container | Image rebuild | Monotonic rootfsGeneration swap — /workspace stays intact |
| Cold Start Latency | ~1–3 s | ~150 ms | < 50 ms via pre-attached PodWarmPool CAS claims |
| Compute Pause-to-Zero | Deletes state on stop | Snapshot or ephemeral stop | desiredState: Paused tears down compute (0 CPU / 0 RAM), keeps dual PVCs |
| State Cloning (CoW Fork) | Slow image commit | VM snapshot | Crash-consistent CoW fork (FIFREEZE -> CSI clone / reflink -> FITHAW) |
| Secret & Egress Safety | Real env vars inside sandbox | Real env vars inside sandbox | cpodref_ placeholders + selective MITM over per-pod mTLS |
| SDK & Protocol Ecosystem | Custom APIs | E2B REST / Connect-RPC | 100% E2B drop-in compatible + native Python, TS, Go, CLI, MCP |
Core Architectural Pillars
Section titled “Core Architectural Pillars”- Dual-Volume Persistence: Isolates the writable OS RootFS (
<box>-rootfs-pvcor<box>-rootfs-gen<N>-pvc) from user project files (<box>-workspace-pvcmounted at/workspace). IncrementingrootfsGenerationwipes or upgrades OS mutations without losing a byte in/workspace. - Clean OCI Images via
podd-init&podd: Runtime binaries are never baked into user images. AninitContainer(podd-installer) or host bind-mount injects/opt/cubepod/bin/{podd-init,podd}at startup. A single-threaded Rust PID 1 (podd-init) checks/healsext4, mountsOverlayFS, pivots root (pivot_root), and execs intopodd(:49983). - WarmPool, Pause-to-Zero, CoW Fork & Stateless HA:
PodWarmPoolpre-attaches standby MicroVMs claimed atomically in< 50 ms.spec.forkFromperforms crash-consistent cloning (FIFREEZE/FITHAW+ CSI orcp --reflink=auto), andcubepod-gatewayreconstructs state directly from KubernetesPodBoxCRDs for multi-replica HA. - Drop-in E2B Compatibility: Point
E2B_DOMAINorE2B_API_URLatcubepod-gatewayso existinge2b,e2b-code-interpreter,@e2b/code-interpreter, LangChain, LlamaIndex, and OpenHands workflows run unmodified. - Zero-Trust Egress & Secret Vault: Real API keys never enter sandbox memory or disk. Only
cpodref_32-character Base32 placeholders are injected;cubepod-egressintercepts outbound traffic (nftables+ DNS proxy + selective HTTPS MITM) and swaps placeholders over per-pod mTLS againstcubepod-gateway. - Lazy Interactive Desktop & Signed Panel Proxy: GUI images start with ~0 MiB desktop RAM overhead and launch
Xvfb,openbox, Chromium CDP (:9222),x11vnc/noVNC(:8080), andttyd(:7681) on demand, exposed securely via HMAC-SHA256/panel/{token}/URLs.
Dual-Runtime Fidelity
Section titled “Dual-Runtime Fidelity”Every CubePod subsystem runs with behavioral parity across two environments:
- Production Kubernetes (
Kata + CSI Block): Hardware-isolated Pods (kata-qemu/kata-clh) attaching twovolumeMode: BlockPVCs (/dev/cubepod-rootfsand/dev/cubepod-workspace), withvolumeMode: Filesystemfallback when CSI raw block storage is unavailable. - Local Development (
Docker + Loopback ext4): RunningCUBEPOD_RUNTIME_MODE=docker-loopback(including via Docker Compose) backs each sandbox with sparse.ext4loopback files and runs the exact samepodd-init+poddin-guest stack on your laptop.
Next Steps
Section titled “Next Steps”- Launch a local stack and run your first persistent sandbox in the Quickstart.
- Connect existing E2B agents with E2B Drop-in Compatibility.
- Dive into the control and data plane in Platform Architecture.
- Deploy to production clusters with Kubernetes & Helm Deployment.