Sandboxes
Secure code execution for AI agents and developer tools
Run untrusted code in isolated environments. Give your AI agents, code interpreters, and developer tools a secure place to execute code, install packages, and interact with the filesystem.
Fully isolated
Fast spin-up
Bring your own images
How Sandboxes work

SDK-driven control
Import `@cloudflare/sandbox` and manage the entire sandbox lifecycle from your Worker. Clone repos, execute commands, read/write files — all via simple async methods.

Built on Containers
Sandboxes run on Cloudflare Containers, so you get the same global placement, automatic scaling, and pay-per-use pricing.

Real-time streaming
Stream stdout and stderr live from long-running commands. Get immediate feedback without polling.

Code interpreter built-in
Run Python or JavaScript code directly with `runCode()`. Rich outputs like charts, tables, and images are parsed automatically.
AI agent code execution
Interactive development environments
Code interpreters
Simple APIs for complex workloads
Clone repos, execute commands, manage files, and run code — all with a few lines of TypeScript.

import { getSandbox } from "@cloudflare/sandbox"; export { Sandbox } from "@cloudflare/sandbox"; export default { async fetch(request: Request, env: Env) { const sandbox = getSandbox(env.Sandbox, "test-runner"); await sandbox.gitCheckout("https://github.com/cloudflare/agents"); const result = await sandbox.exec("npm test"); return Response.json({ passed: result.exitCode === 0, output: result.stdout, }); }, };
Containers Pricing
Run any language in secure, global containers (also applies to Sandboxes). View Compute pricing details
Memory
25 GiB-hrs included
$0.0000025 / GiB-second
CPU
375 vCPU-min included
$0.000020 / vCPU-second
Disk
200 GB-hrs included
$0.00000007 / GB-second
Network Egress (NA/EU)
1 TB included
$0.025 / GB
Powerful primitives, seamlessly integrated
Built on systems powering 20% of the Internet, Sandboxes run on the same infrastructure Cloudflare uses to build Cloudflare. Enterprise-grade reliability, security, and performance are standard.
Compute
Storage
AI
Media
Build without boundaries
Join thousands of developers who've eliminated infrastructure complexity and deployed globally with Cloudflare. Start building for free — no credit card required.