Examples
Runnable examples demonstrating CubeSandbox features and integrations. Follow each project's README for prerequisites and setup instructions.
Getting Started and Images
| Example | Description |
|---|---|
| Code Sandbox Quickstart | Create 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 Image | Build a minimal nginx image on top of cubesandbox-base and test the custom-template-image flow end to end. |
Agents and Framework Integrations
| Example | Description |
|---|---|
| Claude Code | Redirect Claude Code Bash tool calls into isolated CubeSandbox MicroVMs. |
| LangChain | Use CubeSandbox as a command-execution tool with both LangChain 0.x and 1.x agents. |
| Pi Agent | Connect Pi Agent tool execution to a CubeSandbox environment. |
| OpenClaw | Configure the OpenClaw skill so agents can execute code in isolated MicroVMs. |
| OpenAI Agents SDK | Connect E2BSandboxClient to CubeSandbox, including Shell Agent, pause/resume, and SWE-bench flows. |
| OpenAI Agents + Code Interpreter | Run data-analysis agents using either generic E2B execution or a stateful Jupyter kernel. |
| SWE-bench with mini-swe-agent | Automate SWE-bench coding tasks in isolated sandboxes with multi-model support and an RL training workflow. |
Networking and Ingress
| Example | Description |
|---|---|
| Network Policy | Try air-gapped, CIDR allowlist, CIDR denylist, and runtime policy-update scenarios. |
| Route-Aware Egress | Verify sandbox egress through host routes when cube-router is enabled. |
| gRPC Ingress | Connect a native gRPC client through CubeProxy's plaintext ingress on port 9090. |
| E2B Dev Sidecar | Access a remote Cube cluster from an E2B SDK development environment without wildcard DNS. |
Storage, Memory, and State
| Example | Description |
|---|---|
| Host Mount | Mount host directories read-only or read-write into a sandbox at creation time. |
| Snapshot, Rollback, and Clone | Run standalone SDK examples for snapshots, rollback, cloning, state preservation, and concurrency. |
| ivshmem | Enable host/guest shared memory and try a ring-buffer protocol and mmap throughput benchmark. |
| Tencent Cloud COS Volume Plugin | Deploy and exercise the binary or RPC COS volume plugin through its complete lifecycle. |
| S3-Compatible Volume Plugin | Connect AWS S3, Tencent Cloud COS, Cloudflare R2, MinIO, or another S3-compatible backend. |
Benchmarking
| Example | Description |
|---|---|
| cube-bench | Measure 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.