← Back
Cloudflare
Cloudflare launches Dynamic Worker Loader in beta, enabling 100x faster AI agent sandboxing
Cloudflare Workers · featureapiplatformrelease · blog.cloudflare.com ↗

Dynamic Worker Loader Now in Open Beta

Cloudflare has moved its experimental Dynamic Worker Loader API to open beta, making it available to all paid Workers users. This new feature addresses a critical bottleneck in deploying AI agents: the need for lightweight, secure sandboxing of dynamically generated code.

The Dynamic Worker Loader allows a Cloudflare Worker to instantiate a new, isolated Worker sandbox at runtime with developer-specified code. Agents can generate JavaScript code on-the-fly that executes within its own sandboxed environment, accessing only explicitly granted APIs through RPC bindings.

Performance and Scalability Advantages

100x faster startup: Dynamic Workers leverage V8 isolates—the same sandboxing mechanism powering Cloudflare Workers for eight years—which boot in milliseconds rather than the hundreds of milliseconds required for containers. Memory footprint is 10-100x more efficient than traditional container approaches.

Unlimited concurrent execution: Unlike container-based sandbox providers with hard limits on concurrent instances, Dynamic Worker Loader scales seamlessly to millions of requests per second. Each request can spawn its own isolated Worker sandbox on-demand.

Global zero-latency execution: Dynamic Workers typically run on the same machine (even the same thread) as the parent Worker, with no need to route requests globally. The technology is available across Cloudflare's hundreds of edge locations worldwide.

JavaScript and TypeScript Integration

The sandbox requires AI-generated code to be in JavaScript—a practical constraint given that LLMs are highly proficient in JavaScript and the language's inherent web-based design makes it naturally suited to sandboxing.

For API definitions, the approach leverages TypeScript interfaces rather than flat tool schemas. This allows developers to concisely specify available APIs with full type information, reducing token overhead when describing capabilities to agents.

Implementation Details

Developers provide agent code as a string, specify a compatibility date and module code, grant RPC bindings for accessible APIs (and can block outbound internet access), then invoke the sandboxed worker via RPC calls. This model complements Cloudflare's earlier Code Mode work, which demonstrated 81% token reduction by having agents write code rather than make tool calls.

Read the full documentation for implementation details and API reference.