OpenAICloudflare Developer PlatformMar 24, 2026, 12:00 AM

Workers - Dynamic Workers, now in open beta

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

openaienmodel: gpt-5-mini-2025-08-07

Workers - Dynamic Workers, now in open beta

Key Points

  • Spin up sandboxed Dynamic Workers in milliseconds
  • Two load modes: one-time `load` and cached `get(id)`
  • Helper libs: codemode, worker-bundler, shell

Summary

Dynamic Workers are now in open beta for all paid Cloudflare Workers customers. A Worker can dynamically spin up other Workers at runtime (Dynamic Workers) in a secure, sandboxed environment. Dynamic Workers start in milliseconds and are intended for on-demand code execution patterns such as LLM-driven code execution, AI agents, runtime bundling of npm modules, previews, and custom automations.

Key Points

  • Runtime model: create and run ephemeral Workers from a parent Worker using env.LOADER.load(...) and execute via worker.getEntrypoint().fetch(request).
  • Two loading modes:
    • load(code) — one-time execution (equivalent to get() with a null id).
    • get(id, callback) — cache a Dynamic Worker by ID to keep it warm across requests.
  • Use cases: reduce LLM token costs by running code (Code Mode), execute AI agent tasks, run AI-generated prototypes in an isolated sandbox, build fast previews and custom automations.
  • Helper libraries:
    • @cloudflare/codemode — run a single code() tool so an LLM can write/executed TypeScript that calls multiple APIs.
    • @cloudflare/worker-bundler — resolve npm deps and bundle modules at runtime for Dynamic Workers.
    • @cloudflare/shell — virtual filesystem with persistent storage backed by SQLite and R2 inside a Dynamic Worker.
  • Pricing overview (summary): billed by Dynamic Workers created daily, requests, and CPU time; includes monthly allowances (10M requests, 30M CPU ms, 1,000 unique Dynamic Workers per month). The daily-created charge is not active yet; requests and CPU are billed via standard Workers rates.
  • Security: Dynamic Workers run in an isolated sandbox; globalOutbound: null can be used to block outbound network access.

Actionable next steps

  • Try the Dynamic Workers Starter or Playground to prototype and test runtime bundling and execution.
  • Read the Dynamic Workers docs for full API details and production configuration.

Full Translation

Translations

A translation section that keeps the flow of the original article.

openaijamodel: gpt-5-mini-2025-08-07

Workers — Dynamic Workers がオープンベータになりました

Dynamic Workers — オープンベータ開始

公開日: 2026-03-24

Dynamic Workers は、すべての有料 Workers ユーザー向けにオープンベータで利用可能になりました ↗。Worker が実行時にほかの Worker(Dynamic Workers)を起動して、セキュアなサンドボックス環境でオンデマンドにコードを実行できます。Dynamic Workers はミリ秒単位で起動するため、高速かつ安全なコード実行を大規模に行う用途に適しています。

主なユースケース

  • Code Mode: LLMs はコードを書くように訓練されています。多くのツール呼び出しを逐次処理する代わりに、コードで記述した tool-calling ロジックを実行することで、推論トークンとコストを最大で 80% 削減できます。
  • AI エージェントによるコード実行: データ分析、ファイル変換、API 呼び出し、連鎖的アクションなどのタスクでコードを実行します。
  • 生成されたコードの実行: プロトタイプ、プロジェクト、自動化のために生成されたコードをセキュアで隔離されたサンドボックス環境で実行します。
  • 高速な開発とプレビュー: プロトタイプやプレビュー、プレイグラウンドをミリ秒でロードできます。
  • カスタム自動化: タスク実行、統合呼び出し、ワークフロー自動化をその場で実行するカスタムツールを作成します。

Dynamic Workers の実行方法

Dynamic Workers は 2 種類の読み込みモードをサポートします:

  • load(code) — 1 回限りのコード実行(null ID で get() を呼ぶのと同等)。
  • get(id, callback) — ID ごとに Dynamic Worker をキャッシュしてウォームな状態を維持します。同じコードが後続のリクエストを受ける場合はこちらを使用します。

JavaScript 例

export default {
  async fetch(request, env) {
    const worker = env.LOADER.load({
      compatibilityDate: "2026-01-01",
      mainModule: "src/index.js",
      modules: {
        "src/index.js": `

export default { fetch() { return new Response("Hello from a dynamic Worker"); }, }; `, }, // Block all outbound network access from the Dynamic Worker. globalOutbound: null, }); return worker.getEntrypoint().fetch(request); }, };

TypeScript 例

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const worker = env.LOADER.load({
      compatibilityDate: "2026-01-01",
      mainModule: "src/index.js",
      modules: {
        "src/index.js": `

export default { fetch() { return new Response("Hello from a dynamic Worker"); }, }; `, }, // Block all outbound network access from the Dynamic Worker. globalOutbound: null, }); return worker.getEntrypoint().fetch(request); }, };

Dynamic Workers 用ヘルパーライブラリ

ここでは Dynamic Workers の開発を助ける 3 つの新しいライブラリを紹介します:

  • @cloudflare/codemode ↗ : 個別のツール呼び出しを単一の code() ツールに置き換え、LLM が TypeScript を書いて複数の API 呼び出しを一度にオーケストレーションして実行できるようにします。
  • @cloudflare/worker-bundler ↗ : npm 依存関係を解決し、ソースファイルを Dynamic Workers 用の読み込み可能なモジュールにランタイムでバンドルします。
  • @cloudflare/shell ↗ : Dynamic Worker 内に仮想ファイルシステムを提供し、SQLite と R2 による永続ストレージをサポートします。

お試し

  • Dynamic Workers Starter
    • このスターターを使って、Dynamic Workers をロードして実行できる Worker をデプロイできます ↗。
  • Dynamic Workers Playground
    • Dynamic Workers Playground をデプロイして、コードを書いたりインポートしたりし、@cloudflare/worker-bundler でランタイムにバンドルして Dynamic Worker を通じて実行し、リアルタイムのレスポンスと実行ログを確認できます ↗。

完全な API リファレンスと設定オプションについては、Dynamic Workers ドキュメントを参照してください。

料金

Dynamic Workers の料金は次の 3 つの指標に基づきます: Dynamic Workers 作成数(1 日あたり)、リクエスト数、CPU 時間。

  • 含まれる分

    • Dynamic Workers created daily: 1,000 unique Dynamic Workers per month
    • Requests ¹: 10 million per month
    • CPU time ¹: 30 million CPU milliseconds per month
  • 追加利用分

    • Dynamic Workers created daily: +$0.002 per Dynamic Worker per day
    • Requests ¹: +$0.30 per million requests
    • CPU time ¹: +$0.02 per million CPU milliseconds

¹ Uses Workers Standard rates and will appear as part of your existing Workers bill, not as separate Dynamic Workers charges.

注意: Dynamic Workers のリクエストと CPU 時間は既にあなたの Workers プランの一部として課金され、Workers のリクエストおよび CPU 使用量にカウントされます。Dynamic Workers created daily の課金はまだ有効化されていません — 現時点では Dynamic Workers の作成数に対して請求されません。今後のコストを見積もるために価格情報は事前に共有されています。

リソース

公式ドキュメント、スターター、Playground、および上記ライブラリのリンクは記事内の各リンク(↗)を参照してください。

Workers - Dynamic Workers, now in open beta | Cloudflare Developer Platform | DocsDigest