sandbox-sdk

Execute shell commands and AI-generated code in Cloudflare Workers sandboxes.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/mpsuesser/workspace --skill sandbox-sdk-mpsuesser
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sandbox-sdk
Source: https://github.com/mpsuesser/workspace/tree/main/dotconfig/pi/agent/skills/.deprecated/cloudflare/sandbox-sdk
Command: npx skills add https://github.com/mpsuesser/workspace --skill sandbox-sdk-mpsuesser

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps you execute commands and AI-generated code safely by isolating execution in a Cloudflare-managed sandbox rather than running it directly on your infrastructure.

Core Features & Use Cases

  • Secure isolated execution: Runs shell commands and a code interpreter inside Cloudflare Sandbox containers.
  • Stateful code interpreter: Supports runCode() with reusable code contexts for iterative workflows (e.g., analysis, transformations).
  • File and service interaction: Enables creating directories, reading/writing/listing files, and exposing sandbox ports for temporary preview URLs.
  • Use Case: Build an AI code execution feature where the model generates Python/TypeScript/Python code, writes supporting files, runs the code, and returns rich outputs while keeping the host environment protected.

Quick Start

Configure your worker to re-export the Sandbox class, then use getSandbox() and call exec() or runCode() to run your untrusted command or generated code.

Frequently Asked Questions about sandbox-sdk

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

FAQPage Schema
How do I securely execute untrusted AI-generated code on Cloudflare Workers?

Secure isolated execution on Cloudflare Workers uses Durable Objects to run untrusted code in a sandbox container. This protects your host infrastructure while executing shell commands and code interpreter pipelines for multi-tenant workloads.

Can I run a stateful code interpreter with reusable contexts in a Cloudflare Sandbox?

Yes, the sandbox supports the runCode() function to execute code with reusable contexts. This enables iterative workflows like data analysis and transformations without losing state between executions.

How do I expose temporary preview URLs for services running inside a Cloudflare Sandbox?

You can expose temporary preview URLs by mapping sandbox ports to the containerized service. This allows you to interact with web services or applications running inside the isolated sandbox environment.

What file operations are supported inside Cloudflare Sandbox containers?

Cloudflare Sandbox containers support standard filesystem operations including creating directories, reading files, writing files, and listing directory contents. This allows AI-generated code to write supporting files before execution.

Do I need Dockerfile configuration to run shell commands in a Cloudflare Sandbox?

Yes, Dockerfile-based container configuration is required. You must configure your worker to re-export the Sandbox class and bind it to a Durable Object before using getSandbox() and exec() to run commands.

Is isolated sandbox execution suitable for CI/CD build steps and multi-tenant workloads?

Isolated sandbox execution is designed for CI/CD build steps, interactive developer environments, and multi-tenant workloads. It ensures that untrusted execution remains separated from your underlying infrastructure.