Dynamic Workers Open Beta
Cloudflare has released Dynamic Workers into open beta for all paid Workers users. This capability allows a Worker to spawn additional Workers at runtime, enabling on-demand code execution in isolated, secure environments. Dynamic Workers start in milliseconds, making them suitable for latency-sensitive workloads at scale.
Key Capabilities
Primary use cases include:
- Code Mode for LLMs: Let AI models write and execute code directly rather than making multiple tool calls. This approach can save up to 80% in inference tokens and costs.
- AI agent code execution: Run code for data analysis, file transformations, API calls, and chained operations.
- Secure code sandboxing: Execute AI-generated code in isolated environments for prototypes and automations.
- Fast prototyping: Load previews and playgrounds in milliseconds.
- Custom automations: Build tools on-the-fly for integrations and workflows.
API and Loading Modes
Dynamic Workers support two loading patterns:
load(code)— one-time code executionget(id, callback)— caches a Worker by ID to keep it warm across requests, ideal for repeated invocations
Developers can control network access through the globalOutbound parameter to block outbound connections when needed.
Developer Tools
Three new npm packages support Dynamic Workers development:
@cloudflare/codemode: Consolidates multiple tool calls into a single code execution, improving LLM efficiency.@cloudflare/worker-bundler: Resolves npm dependencies and bundles code at runtime for Dynamic Workers.@cloudflare/shell: Provides a virtual filesystem with SQLite and R2 persistence.
Pricing and Availability
Dynamic Workers pricing covers three dimensions: daily unique Dynamic Workers created ($0.002/day), requests ($0.30/million beyond 10 million/month), and CPU time ($0.02/million milliseconds beyond 30 million/month). Requests and CPU time count toward existing Workers billing. The daily creation charge is not yet active.
Starter templates and a playground are available for immediate experimentation. Full documentation is available in the Dynamic Workers guide.