
Cloudflare Sandbox
Isolated Linux container environments for agents and untrusted code on Cloudflare Workers.
About
Cloudflare Sandbox SDK provides isolated environments for running untrusted code securely on the Cloudflare Workers platform. Sandboxes run as Ubuntu containers attached to Workers through Durable Objects, giving agents a full Linux workspace for code interpretation, git operations, file management, and terminal access.
Containers and the Sandbox SDK reached general availability in 2026 with features including live preview URLs for long-lived agent services, persistent Python, JavaScript, and TypeScript code interpreters, interactive PTY terminals, backup and restore APIs for snapshotting agent sessions, and real-time filesystem watching. Billing follows the Containers model with active-CPU pricing. Local development uses Docker with the npm package @cloudflare/sandbox.
What it can do
- Ubuntu container isolation on the Workers platform
- Persistent code interpreters for Python, JS, and TypeScript
- Interactive PTY terminals with multiple isolated shells
- Backup and restore APIs for agent session snapshots
- Live preview URLs and port exposure
- Real-time filesystem watching for agents
Setup
npm install @cloudflare/sandbox, add a containers binding and Durable Object class to wrangler.jsonc, then call getSandbox in a Worker.
Prerequisites
A Cloudflare account, Wrangler, and Docker for local development.
Use cases
Works with
Trust score — 8/10
Scored 8/10 (verified tier, metrics-v1). Evidence: Verified via vendor site/docs/GitHub and reputable coverage, wave 91; Trending score 80/100 from researcher assessment.
Sources
Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.