sandbox-sdk

Creates secure sandboxed Cloudflare Worker environments for executing commands and code via Durable Object binding.

2|Updated Apr 26, 2026
One-click install
npx skills add https://github.com/iadr-dev/colab --skill sandbox-sdk-iadr-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sandbox-sdk
Source: https://github.com/iadr-dev/colab/tree/main/skills/coding/cloudflare-skills/skills/sandbox-sdk
Command: npx skills add https://github.com/iadr-dev/colab --skill sandbox-sdk-iadr-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you build secure, isolated execution environments so you can run commands or LLM-generated code without risking your main system or leaking state across users.

Core Features & Use Cases

  • Isolated sandbox lifecycle: Create sandboxes per user/session and run workloads with predictable startup, sleep behavior, and cleanup via destroy.
  • Command execution and code interpreter: Use exec() for shell-style tasks and runCode() for rich, stateful LLM-generated code execution (Python/JavaScript/TypeScript).
  • File system and service preview: Write/read/list files inside /workspace, and expose HTTP ports to get preview URLs for interactive apps.

Quick Start

Configure your Worker with the required wrangler.jsonc plus an entry that re-exports Sandbox, then ask your AI agent to run a Python snippet by using getSandbox(...).runCode() inside the sandbox and return the rich output.

Frequently Asked Questions about sandbox-sdk

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

FAQPage Schema
How do I run untrusted code safely on Cloudflare?

You can run untrusted code safely on Cloudflare by using a sandboxed execution environment that isolates workloads via Durable Objects. This prevents state leakage across users and protects your main system while executing AI-generated code.

How do I execute Python or JavaScript generated by an AI agent in a secure sandbox?

To execute Python or JavaScript generated by an AI agent, use the runCode() method within an isolated sandbox. This provides rich, stateful code interpreter functionality for executing LLM-generated snippets without risking your host environment.

Can I expose an HTTP port and get a preview URL for an interactive app running in a Cloudflare sandbox?

Yes, you can expose HTTP ports inside the sandbox to generate preview URLs for interactive applications. This allows you to share and view stateful web apps running within your isolated Cloudflare execution environment.

Do I need Durable Objects to manage isolated sandbox lifecycles on Cloudflare?

Yes, Durable Object binding via getSandbox is required to manage isolated sandbox lifecycles on Cloudflare. This mechanism allows you to create sandboxes per user or session and control their startup, sleep, and cleanup behavior.

What file operations are supported inside a Cloudflare sandbox environment?

Inside a Cloudflare sandbox environment, you can write, read, and list files within the /workspace directory. These file system operations allow you to manage scripts and data needed for your isolated command execution or code interpreter workloads.