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.