sandbox-next

द्वारा cloudflare

@cloudflare/sandbox@next (Sandbox SDK 1.0 पूर्वावलोकन) पर Cloudflare Sandbox ऐप्स बनाने या बदलने के दौरान उपयोग करें—कोड निष्पादन, AI रनर, इंटरप्रेटर, CI-जैसी सुविधाएँ…

npx skills add https://github.com/cloudflare/skills --skill sandbox-next

Sandbox SDK — @next (1.0 preview)

Isolated Linux environments on Cloudflare Containers, driven from Workers.

Prefer preview docs and installed @next types over memory. APIs change; this skill is a gate, a contract, and a retrieval map—not a full manual.

We recommend new projects on this line. Apps still on the default package use sandbox-stable. Port only when asked, via sandbox-migrate-to-next.

1. Gate — confirm the package line

Before writing code, inspect the app:

CheckMust match
npm dependency@cloudflare/sandbox@next (or another preview tag)
Container imageSame line (e.g. cloudflare/sandbox:next, next-python)
If you find…Action
Default @cloudflare/sandbox (no @next)Stop. Load sandbox-stable. Do not apply this skill’s APIs.
User wants to port stable → @nextStop. Load sandbox-migrate-to-next.
Self-deployed bridge onlyBridge is not on the 1.0 preview line yet. Keep bridge on stable package + image. Bridge (stable)

Never mix an @next Worker package with a stable container image (or the reverse).

Skills install: Agent setup · cloudflare/skills

2. Contract — non-negotiables

  • sandbox.exec(argv) takes an argv list and resolves when the process starts. It returns a handle, not a finished command result.
  • Collect results with handle methods: output(), logs(), waitForExit(), waitForPort(), waitForLog(), kill(signal?).
  • No implicit shell. Shell syntax needs an explicit shell, e.g. ["/bin/bash", "-lc", script].
  • Each launch is independent. A cd / export in one exec is not visible to the next. Pass cwd and env per launch, or one shell script.
  • Process handles have no stdin. Interactive use → terminals (createTerminal + connect).
  • Local wait timeout / AbortSignal cancel the wait only. They do not kill the process. Use kill or exec’s remote timeout.
  • getProcess / listProcesses / getTerminal / listTerminals do not start a container; they return null / [] when none is up.
  • Process and terminal IDs belong to the current container, not forever to a sandbox ID. For work that must survive replace, store the full job (argv, cwd, env, app state)—not only an id.
  • Non-secret config only in setEnvVars / launch env. Live credentials stay in the Worker; use outbound handlers when the sandbox calls external APIs.
  • Do not invent removed stable APIs (gitCheckout on core, string-exec completion, session execution, sandbox.terminal(request)).
  • Do not use one retry loop for every error (see Errors docs).

Minimal shape:

import { getSandbox, proxyToSandbox, Sandbox } from "@cloudflare/sandbox";

export { Sandbox };

const sandbox = getSandbox(env.Sandbox, "user-123");
const process = await sandbox.exec(["python3", "-c", "print(2 + 2)"]);
const result = await process.output({ encoding: "utf8" });
// result.stdout, result.exitCode

Task-specific API documentation: references/api-quick-ref.md

Examples index (next branch): references/examples.md

3. Retrieve — open the doc for the task

Fetch the page before implementing. Installed @next types win over guesses.

You need to…Open
Orient / choose preview1.0 preview overview
First Worker, wrangler, DockerfileGet started
exec, handles, readiness, durabilityProcess execution
Process API signaturesProcesses API
Sandbox ID vs container vs sleep/destroyLifecycle
cwd / env / setEnvVarsEnvironment
Interactive PTY / browser terminalTerminals · Terminals API
Python/JS code interpreterInterpreter · Interpreter API
Extensions modelExtensions
Error classes and recoveryErrors · Errors API
Common failuresTroubleshooting
API hubAPI reference
Files, mounts, backups, ports, tunnels, proxyToSandboxMain docs for shared surfaces (ignore stable-only session/transport/sandbox.terminal): Files · Storage / mounts · Ports · Tunnels · Backups · Outbound traffic · Expose services · Production
Example appsexamples on next
Still on stable packagesandbox-stable · Main Sandbox docs
Porting an existing stable appsandbox-migrate-to-next · Migrate

4. Before you ship

  • Lockfile and Dockerfile on the same @next line
  • Typecheck against installed @next types
  • No live secrets in sandbox env
  • Production preview hostnames need wildcard DNS on a custom domain when using those URL patterns

cloudflare की और Skills

dependabot-review
cloudflare
Dependabot PR का विश्लेषण करता है कि प्रत्येक अपडेटेड पैकेज में वास्तव में क्या बदला और क्या ये बदलाव इस रिपॉजिटरी को प्रभावित करते हैं। बदले गए APIs/मेथड्स की रिपोर्ट करता है,…
module-registry
cloudflare
जब workerd में मॉड्यूल रजिस्ट्री के साथ काम कर रहे हों — मॉड्यूल रिज़ॉल्यूशन, संकलन, मूल्यांकन या पंजीकरण को पढ़ना, संशोधित करना, डीबग करना या समीक्षा करना — तब लोड करें।
reproduce
cloudflare
क्लाउडफ्लेयर/एजेंट्स गिटहब इश्यू को पुनः उत्पन्न करने के लिए एक न्यूनतम एजेंट्स/वर्कर प्रोजेक्ट तैयार करें और इसे एक अस्थायी क्लाउडफ्लेयर खाते में डिप्लॉय करें, फिर रिपोर्ट करें…
local-explorer
cloudflare
स्थानीय एक्सप्लोरर या स्थानीय API में उत्पादों/संसाधनों को कैसे जोड़ें। नए स्थानीय APIs या UI रूट्स को लागू करते समय उपयोग करें...
open-pr
cloudflare
क्लाउडफ्लेयर/एजेंट्स गिटहब इश्यू और किसी भी रिप्रो निष्कर्ष को लेकर एक बार में फिक्स पीआर तैयार करें — ब्रांच, बदलाव, परीक्षण, पुश करें और इश्यू से जुड़ा पीआर खोलें।
write-endpoints
cloudflare
चैनफाना के साथ OpenAPI एंडपॉइंट बनाने के लिए व्यापक गाइड - स्कीमा परिभाषा, अनुरोध सत्यापन, CRUD संचालन, D1 डेटाबेस एकीकरण, और…
agents-sdk
cloudflare
Cloudflare Workers पर Agents SDK का उपयोग करके AI एजेंट बनाएं। स्टेटफुल एजेंट, टिकाऊ वर्कफ़्लो, रीयल-टाइम WebSocket ऐप्स, शेड्यूल किए गए कार्य बनाते समय लोड करें,…
changelog
cloudflare
Cloudflare दस्तावेज़ीकरण साइट के लिए उत्पाद चेंजलॉग प्रविष्टियाँ बनाता है, अपडेट करता है और समीक्षा करता है। चेंजलॉग MDX फ़ाइलें जनरेट करते समय, मौजूदा फ़ाइलों को संपादित करते समय लोड करें…