Cloudflare Dynamic Worker Loader: Sandboxing AI Agents with Isolates

What Dynamic Worker Loader Does
Dynamic Worker Loader is an API that enables a Cloudflare Worker to create a new Worker with code specified at runtime, running in its own secure sandbox. This addresses the security need for executing AI-generated code without exposing your application to vulnerabilities.
Technical Implementation
The feature uses isolates—instances of the V8 JavaScript execution engine—as the underlying sandboxing mechanism. Isolates start in a few milliseconds and use a few megabytes of memory, making them approximately 100x faster and 10x-100x more memory efficient than typical Linux containers.
Here's the basic code pattern from the source:
// Have your LLM generate code like this.
let agentCode: string = `
export default {
async myAgent(param, env, ctx) {
// ...
}
}
`;
// Load a worker to run the code
let worker = env.LOADER.load({
compatibilityDate: "2026-03-01",
mainModule: "agent.js",
modules: {
"agent.js": agentCode
},
env: {
CHAT_ROOM: chatRoomRpcStub
},
globalOutbound: null,
});
// Call RPC methods exported by the agent code
await worker.getEntrypoint().myAgent(param);
Key Capabilities
- No global concurrency limits: Unlike container-based solutions, there are no limits on concurrent sandboxes or creation rate
- Zero latency: Dynamic Workers typically run on the same machine and thread as the creating Worker
- Global deployment: Supported in all of Cloudflare's hundreds of locations worldwide
- Security controls: Can block internet access (globalOutbound: null) or intercept it
- RPC-based API access: Agents can access specific APIs through RPC stubs defined in the env parameter
Context and Limitations
This approach builds on Cloudflare's Code Mode concept where agents write code instead of making tool calls. The main limitation versus containers is that agents need to write JavaScript (though Workers technically support Python and WebAssembly). For small code snippets generated by AI agents, JavaScript loads and runs faster.
📖 Read the full source: HN AI Agents
👀 See Also

Measuring Off-Task Token Spend in Claude Code: The 'Undeclared-Intent' Metric
A developer built a metric to quantify compute spent on unintended execution paths in Claude Code sessions, finding that 22.8% of tokens went to off-task work.

Comparing Multi-Agent AI Systems: Anthropic's Harness vs Agyn's Engineering Org Model
Anthropic published a harness design for long-running application development, while Agyn's multi-agent system for team-based autonomous software engineering was open-sourced last month. Both systems reject monolithic agents in favor of role separation, structured handoffs, and review loops.

Qwen 3.6 27B hits 2.5x speed with MTP speculative decoding on llama.cpp
A Reddit user reports 2.5x faster inference on Qwen 3.6 27B using MTP speculative decoding with a custom llama.cpp PR, achieving 28 tok/s on Mac M2 Max 96GB. Includes pre-converted GGUF quants and fixed chat templates.

LystBot: An MCP Server for Claude to Manage Lists and Tasks
LystBot is a list management app with a native MCP server that allows Claude to directly interact with grocery lists, todos, and packing lists. Built primarily with Claude Code, it includes a Flutter mobile app, REST API, CLI, and open-source Node.js MCP server.