feat: add Cloudflare sandbox provider#492
Open
roerohan wants to merge 1 commit intomattpocock:mainfrom
Open
Conversation
Add an isolated sandbox provider that communicates with a user-deployed Cloudflare Worker bridge wrapping the @cloudflare/sandbox SDK. The SDK requires a Worker runtime with Durable Object bindings, so a bridge Worker template is provided in docs/cloudflare-worker-bridge/. Provider features: - exec() with SSE streaming for line-by-line onLine support - copyIn/copyFileOut via base64-encoded uploads and binary downloads - No peer dependency — uses plain fetch to talk to the bridge - Auth via Bearer token (option or CLOUDFLARE_SANDBOX_API_TOKEN env var) Bridge security: - Requires BRIDGE_API_TOKEN (503 if unset) - Path traversal protection (restricts to /home/user/workspace and /tmp/) - Base64 encoding for binary file transfers
|
@roerohan is attempting to deploy a commit to the Matt Pocock's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
That's really needed indeed! |
bbarry
reviewed
May 2, 2026
| agent: claudeCode("claude-opus-4-6"), | ||
| sandbox: cloudflare({ | ||
| workerUrl: "https://sandcastle-sandbox-bridge.<your-subdomain>.workers.dev", | ||
| apiToken: "your-shared-secret", |
There was a problem hiding this comment.
It seems wrong to advocate putting the api token here. These run commands get committed to your repo. The cloudflare api token is supposed to be secret, so this argument should not exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@ai-hero/sandcastle/sandboxes/cloudflare) that runs agents in isolated Linux containers on Cloudflare's edge via the Sandbox SDKdocs/cloudflare-worker-bridge/with deployment instructionsProvider details
createIsolatedSandboxProvider, same pattern as Vercel/Daytona)fetchto communicate with the bridgeexec()supports SSE streaming for line-by-lineonLinecallbacks (matching sandcastle's streaming contract)apiTokenoption orCLOUDFLARE_SANDBOX_API_TOKENenv varWorker bridge security
BRIDGE_API_TOKENis required — returns 503 if not configured (no open bridges)/home/user/workspaceand/tmp/Usage
Files changed
src/sandboxes/cloudflare.tsdocs/cloudflare-worker-bridge/worker.tsdocs/cloudflare-worker-bridge/wrangler.jsoncdocs/cloudflare-worker-bridge/README.mdpackage.json./sandboxes/cloudflareexport pathREADME.md.changeset/add-cloudflare-sandbox.md