Run sandboxed code environments on Cloudflare's edge network.
Build secure, isolated code execution environments on Cloudflare.
The Sandbox SDK lets you run untrusted code safely in isolated containers. Execute commands, manage files, run background processes, and expose services — all from your Workers applications.
Perfect for AI code execution, interactive development environments, data analysis platforms, CI/CD systems, and any application that needs secure code execution at the edge.
- Install Node.js (version 16.17.0 or later)
- Ensure Docker is running locally (see setup guide)
- For deploying to production, sign up for a Cloudflare account
Create a new Sandbox SDK project using the minimal template:
npm create cloudflare@latest -- my-sandbox --template=cloudflare/sandbox-sdk/examples/minimal
cd my-sandboxStart the development server:
npm run devNote: First run builds the Docker container (2-3 minutes). Subsequent runs are much faster.
Test the endpoints:
# Execute Python code
curl http://localhost:8787/run
# File operations
curl http://localhost:8787/fileDeploy your Worker and container:
npx wrangler deployWait for provisioning: After first deployment, wait 2-3 minutes before making requests.
📖 View the complete getting started guide for detailed instructions and explanations.
from https://github.com/cloudflare/sandbox-sdk
No comments:
Post a Comment