Examples

September 15, 2026 ยท View on GitHub

Runnable examples demonstrating CubeSandbox features and integrations. Follow each project's README for prerequisites and setup instructions.

Getting Started and Images

ExampleDescription
Code Sandbox QuickstartCreate a sandbox, run Python and shell commands, work with files, and try core E2B-compatible APIs.
Browser Sandbox (Playwright)Run headless Chromium in a MicroVM and control it remotely through Playwright over CDP.
Custom nginx ImageBuild a minimal nginx image on top of cubesandbox-base and test the custom-template-image flow end to end.
Ubuntu Desktop SandboxRun an Ubuntu 22.04 GNOME desktop in the browser via noVNC, with screenshots and scripted GUI automation from the SDK.

Agents and Framework Integrations

ExampleDescription
Claude CodeRedirect Claude Code Bash tool calls into isolated CubeSandbox MicroVMs.
LangChainUse CubeSandbox as a command-execution tool with both LangChain 0.x and 1.x agents.
Pi AgentConnect Pi Agent tool execution to a CubeSandbox environment.
OpenClawConfigure the OpenClaw skill so agents can execute code in isolated MicroVMs.
OpenAI Agents SDKConnect E2BSandboxClient to CubeSandbox, including Shell Agent, pause/resume, and SWE-bench flows.
OpenAI Agents + Code InterpreterRun data-analysis agents using either generic E2B execution or a stateful Jupyter kernel.
SWE-bench with mini-swe-agentAutomate SWE-bench coding tasks in isolated sandboxes with multi-model support and an RL training workflow.

Networking and Ingress

ExampleDescription
Network PolicyTry air-gapped, CIDR allowlist, CIDR denylist, and runtime policy-update scenarios.
Route-Aware EgressVerify sandbox egress through host routes when cube-router is enabled.
gRPC IngressConnect a native gRPC client through CubeProxy's plaintext ingress on port 9090.
E2B Dev SidecarAccess a remote Cube cluster from an E2B SDK development environment without wildcard DNS.

Storage, Memory, and State

ExampleDescription
Host MountMount host directories read-only or read-write into a sandbox at creation time.
Snapshot, Rollback, and CloneRun standalone SDK examples for snapshots, rollback, cloning, state preservation, and concurrency.
ivshmemEnable host/guest shared memory and try a ring-buffer protocol and mmap throughput benchmark.
Tencent Cloud COS Volume PluginDeploy and exercise the binary or RPC COS volume plugin through its complete lifecycle.
S3-Compatible Volume PluginConnect AWS S3, Tencent Cloud COS, Cloudflare R2, MinIO, or another S3-compatible backend.

Benchmarking

ExampleDescription
cube-benchMeasure sandbox creation and deletion latency at configurable concurrency, with a TUI, percentile reports, and JSON export.

::: tip Most SDK examples use the same environment variables (E2B_API_URL, E2B_API_KEY, and CUBE_TEMPLATE_ID). See Quick Start before running them. :::