Total Pageviews

Tuesday, 15 September 2026

Cloudflare Sandbox-SDK

 Run sandboxed code environments on Cloudflare's edge network.

npm version npm downloads

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.

Getting Started

Prerequisites

  1. Install Node.js (version 16.17.0 or later)
  2. Ensure Docker is running locally (see setup guide)
  3. For deploying to production, sign up for a Cloudflare account

1. Create a new project

Create a new Sandbox SDK project using the minimal template:

npm create cloudflare@latest -- my-sandbox --template=cloudflare/sandbox-sdk/examples/minimal
cd my-sandbox

2. Test locally

Start the development server:

npm run dev

Note: 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/file

3. Deploy to production

Deploy your Worker and container:

npx wrangler deploy

Wait 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