Cloudflare Sandbox SDK
ActiveDescription
A TypeScript SDK for running sandboxed code environments on Cloudflare's edge network, designed for AI agents and untrusted code execution.
Key Features
- Edge sandboxes - Run lightweight microVM sandboxes on the Cloudflare global network with low cold-start latency
- Multi-language execution - Run Python, Node.js, Java, and Bash code in isolated environments
- Snapshots and restore - Snapshot sandbox state and resume for long-running agents
- File and process APIs - File read/write, command execution, and streaming output
- Agent tool integration - Native @tool decorator to register sandbox actions as AI agent tools
Use Cases
💡 Expose secure code execution tools to LLM-powered agents
💡 Run untrusted user-generated scripts at the edge as a code interpreter backend
💡 Provide isolated execution environments for workflow automation
💡 Plug into RAG and data pipelines for preprocessing and computation
Categories
Quick Start
# Install the Cloudflare Sandbox SDK
npm install @cloudflare/sandbox-sdk
# Create a simple Python executor
import { getSandbox } from '@cloudflare/sandbox-sdk';
const sb = getSandbox('my-agent');
const result = await sb.exec('python', 'print(sum(range(10)))');