Cloudflare Sandbox SDK
A TypeScript SDK for Cloudflare Workers that runs untrusted code in Linux sandboxes backed by Cloudflare Containers and Durable Objects. A strong, programmable option for Workers developers; less suited to Python-first agent stacks.
Overview
Cloudflare’s Sandbox SDK lets a Worker create Linux sandboxes on demand, each a Durable Object paired with a Cloudflare Container. Containers and Sandboxes became generally available in April 2026, and Cloudflare documents each container instance as a microVM with its own kernel.
Its distinctive design is that your Worker sits in the network path: you can run a sandbox with no internet and intercept only the outbound requests you allow, injecting credentials in Worker code. For JavaScript-only workloads, Dynamic Workers (V8 isolates) offer a much lighter option.
Notable
- Containers and Sandboxes generally available since April 13, 2026.
- Docs include guides for running Claude Code, Codex and other coding agents.
- SDK 1.0 in preview; 0.x docs marked legacy.
Cloudflare Sandbox SDK specifications
| Attribute | Details |
|---|---|
| Isolation | Each container instance is a microVM with its own kernel and network (per Cloudflare docs); Dynamic Workers (V8 isolates) available for JavaScript-only code |
| Deployment | Hosted platform |
| Open source | Yes (SDK Apache-2.0 (runs only on Cloudflare)) |
| SDKs and interfaces | TypeScript (Workers) |
| Cold start (vendor claim) | Container cold starts “often in the 1–3 second range” depending on image (vendor docs) |
| Max session length | No fixed cap; runs while its Durable Object is active, then up to a 6-hour inactivity timeout |
| Persistence | Ephemeral disk by default; container snapshots (up to 20 GB, 30 days), directory backups to R2, S3/R2 bucket mounts and Durable Object storage |
| GPU | Not documented |
| Networking | Egress controlled from Worker code: disable internet and intercept outbound HTTP to allow specific hosts and inject credentials; preview URLs routed through your Worker |
| Pricing | Cloudflare Containers rates in 10 ms increments: $0.000020 per vCPU-second (active) + $0.0000025 per GiB-second + disk; requires the $5/month Workers Paid plan |
| Free tier | Workers Paid includes 25 GiB-hours memory, 375 vCPU-minutes and 200 GB-hours disk per month |
| Compliance | Not documented |
| Regions | Cloudflare’s global network |
Facts from Cloudflare Sandbox SDK’s public documentation, verified November 8, 2026. Performance numbers are vendor claims.
Strengths and trade-offs
Strengths
- You build on Cloudflare Workers and Durable Objects
- You want egress and credentials controlled in your own code
- You want global placement on Cloudflare’s network
- You want a lighter isolate option for JS-only code
Trade-offs
- TypeScript/Workers only — no Python SDK
- 1–3 second cold starts are slower than microVM specialists
- Cloudflare-only; no self-hosting
Best for: Teams building on Cloudflare Workers that want per-user sandboxes with egress and credentials controlled in code.
How Cloudflare Sandbox SDK compares
| Sandbox | Isolation | Open source | Self-host / BYOC | Cold start (vendor) | Max session | Snapshots / pause | GPU | SDKs |
|---|---|---|---|---|---|---|---|---|
| Cloudflare Sandbox SDK | MicroVM (Containers) | Yes | No / No | 1–3 s | No fixed cap | Yes / Not documented | Not documented | TypeScript (Workers) |
| Vercel Sandbox | Firecracker microVM | No | No / No | Milliseconds (claim) | 24 h (Pro) | Yes / Yes | Not documented | JavaScript/TypeScript, Python |
| E2B | Firecracker microVM | Yes | Yes / Yes | Not documented | 1 h / 24 h (Pro) | Yes / Yes | No | Python, JavaScript/TypeScript |
| Fly.io Sprites | MicroVM | No | No / No | 0.1–2 s wake | Unlimited | Yes / Yes | No | JavaScript/TypeScript, Go, Python, Elixir |
| Freestyle | VM | No | No / Not documented | 65 ms | Unlimited (paid) | Yes / Yes | Not documented | TypeScript |
| Daytona | Containers or VMs | No | Not documented / Yes | <90 ms | Unlimited | Yes / Yes | Yes | Python, TypeScript, Ruby, Go, Java |
Head-to-head: E2B vs Cloudflare Sandbox SDK · Daytona vs Cloudflare Sandbox SDK · Modal Sandboxes vs Cloudflare Sandbox SDK · Vercel Sandbox vs Cloudflare Sandbox SDK · Cloudflare Sandbox SDK vs Fly.io Sprites
Frequently asked questions
What is Cloudflare Sandbox SDK?
How does Cloudflare Sandbox SDK isolate code?
Is Cloudflare Sandbox SDK open source?
How much does Cloudflare Sandbox SDK cost?
What are the best Cloudflare Sandbox SDK alternatives?
Sources
Cite this page
Agent Sandboxes. (2026). Cloudflare Sandbox SDK. agentsandboxes.org. Last reviewed November 8, 2026. https://agentsandboxes.org/sandboxes/cloudflare-sandbox/
Found an error or a missing sandbox? Submit a correction — every entry links to the sources it relies on.