Sandbox 2026 deprecation

From try-works/role-model · View interactive version

Sandbox 2026 deprecation is an AI agent skill from the GitHub repository try-works/role-model. Migrate Cloudflare Sandbox SDK codebases away from features deprecated in June 2026 (HTTP and WebSocket transports, desktop, exposePort, default sessions, and stream-specific file and command APIs).

How to use this skill

Skill file

Sandbox SDK 2026 deprecation migration

Use this skill when migrating a codebase that depends on the Cloudflare Sandbox SDK away from features deprecated in June 2026.

For the announcement, refer to the changelog entry. For detailed documentation, refer to the migration guide.

Migration checklist

  1. Update @cloudflare/sandbox and the sandbox container image before changing runtime configuration.
  2. Search the codebase for deprecated configuration and APIs:

```sh

rg 'SANDBOX_TRANSPORT|transport:|exposePort\(|enableDefaultSession|execStream\(|readFileStream|writeFileStream'

```

  1. Switch every sandbox to RPC transport with SANDBOX_TRANSPORT=rpc or getSandbox(..., { transport: "rpc" }).
  2. Replace Sandbox SDK desktop APIs with Cloudflare Browser Run where browser automation is required.
  3. Replace exposePort() with sandbox.tunnels.get(). Use quick tunnels for development and named tunnels for stable production hostnames.
  4. Set enableDefaultSession: false on getSandbox().
  5. Replace workflows that depend on persisted shell state with explicit sessions from sandbox.createSession().
  6. Move stream-specific file and command logic to the base readFile(), writeFile(), and exec() APIs where streaming behavior is supported.
  7. Deploy the Worker and smoke-test command execution, file operations, public URLs, and stateful session workflows.

API replacements

| Deprecated feature | Replacement |

| ---------------------------------------- | ---------------------------------------------------- |

| HTTP or WebSocket transport | RPC transport |

| Sandbox SDK desktop | Cloudflare Browser Run |

| exposePort() | sandbox.tunnels.get() |

| Default sessions | enableDefaultSession: false with explicit sessions |

| Stream-specific command and file helpers | Base command and file APIs with streaming support |

Notes for agents

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.