← Back
Cloudflare
Cloudflare launches Dynamic Workers in open beta, enabling on-demand code execution at edge
Cloudflare Workers · releasefeatureapiplatform · developers.cloudflare.com ↗

What's New

Cloudflare has released Dynamic Workers to open beta for all paid Workers users. This feature enables Workers to dynamically spawn and execute other Workers at runtime in a secure, sandboxed environment. Dynamic Workers spin up in milliseconds, making them suitable for fast, secure code execution at scale.

Primary Use Cases

Dynamic Workers are designed for several key scenarios:

  • Code Mode for LLMs: Instead of making multiple tool calls, LLMs can now write and execute code directly, reducing inference tokens and costs by up to 80%
  • AI agent code execution: Run code for data analysis, file transformation, API calls, and chained operations
  • Secure code execution: Execute AI-generated or user-provided code in isolated sandboxed environments
  • Fast prototyping: Load prototypes and previews in milliseconds
  • Custom automations: Create dynamic tools that execute tasks, call integrations, or automate workflows

How It Works

Dynamic Workers support two loading modes:

  • load(code) — One-time code execution without caching
  • get(id, callback) — Caches a Dynamic Worker by ID for subsequent requests, keeping the Worker warm across multiple invocations

The feature integrates with network policies (e.g., blocking outbound access with globalOutbound: null) and supports configurable compatibility dates and module systems.

Developer Tools

Three new npm libraries support Dynamic Workers development:

  • @cloudflare/codemode — Replaces individual tool calls with a single code() tool for orchestrating multiple API calls in one pass
  • @cloudflare/worker-bundler — Resolves npm dependencies and bundles files at runtime for Dynamic Worker loading
  • @cloudflare/shell — Provides a virtual filesystem with persistent SQLite storage and R2 integration

Starter templates and a playground are available to help developers get started immediately.

Pricing

Dynamic Workers pricing is based on three dimensions, though the daily creation charge is not yet active:

Metric Included Additional
Unique workers created daily 1,000/month $0.002 per worker per day
Requests 10 million/month $0.30 per million
CPU time 30 million ms/month $0.02 per million ms

Requests and CPU time use existing Workers Standard rates and count toward your overall Workers plan.