sandbox-sdk

Build sandboxed code execution environments on Cloudflare Workers using the Sandbox SDK.

1|Updated Jul 16, 2026
One-click install
npx skills add https://github.com/sota411/codex-config --skill sandbox-sdk-sota411
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sandbox-sdk
Source: https://github.com/sota411/codex-config/tree/main/archived-user-skills/2026-08-20/unused/sandbox-sdk
Command: npx skills add https://github.com/sota411/codex-config --skill sandbox-sdk-sota411

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @cloudflare/sandbox, and includes references (resource) components.

What problem does it solve? Running untrusted or LLM-generated code safely requires isolated environments, and this Skill guides you through building secure, containerized code execution on Cloudflare Workers with the Sandbox SDK. ## Core Features & Use Cases - Command and Code Execution: Run shell commands with exec() or execute Python, JavaScript, and TypeScript with rich outputs via runCode() and persistent code contexts. - File and Port Management: Read, write, and list files inside sandboxes, and expose HTTP services through preview URLs with exposePort(). - Use Case: Build an AI code interpreter that executes LLM-generated Python with pandas, keeps state across calls using a code context, and returns charts and tables as rich outputs. ## Quick Start Ask the AI to set up a Cloudflare Worker with the Sandbox SDK that runs Python code in an isolated sandbox and returns the result.

Frequently Asked Questions about sandbox-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run LLM-generated code in a Cloudflare sandbox?▼

Use sandbox.runCode() with a code context created via createCodeContext(). It supports Python, JavaScript, and TypeScript, persists state within the context, and returns rich outputs like text, HTML, and PNG.

What is the difference between exec() and runCode() in the Sandbox SDK?▼

exec() runs shell commands and returns stdout, stderr, and exit codes, suiting scripts and build pipelines. runCode() executes code in an interpreter context with state persistence and rich outputs, suiting AI-generated code and data analysis.

Does the Cloudflare Sandbox SDK require Docker?▼

Yes, Docker is required for local development and docker info must succeed before running the sandbox locally. The base image cloudflare/sandbox includes Python 3.11, Node.js 20, and common tools, and you can extend the Dockerfile with extra packages.

Why does my Worker fail to deploy with the Sandbox SDK?▼

The Worker entry must re-export the Sandbox class with export { Sandbox } from '@cloudflare/sandbox'. You also need the exact wrangler.jsonc configuration with containers, Durable Object bindings, and a migration for the Sandbox class.

Can I expose HTTP services running inside a sandbox?▼

Yes, sandbox.exposePort(port) returns a preview URL for services running in the sandbox. In production, preview URLs require a custom domain with wildcard DNS because the .workers.dev domain does not support preview URL subdomains.