OpenAICloudflare Developer PlatformJun 2, 2026, 12:00 AM

Agents, Workers - Agents SDK v0.14.0: Agent Skills, messengers, scheduled tasks, Workflows, and hardened chat recovery

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

Agents SDK v0.14.0 — Agent Skills, Messengers, Scheduled Tasks, Workflows, Hardened Chat Recovery

Key Points

  • Experimental on-demand Agent Skills
  • Telegram messenger integration
  • Hardened durable chat recovery

Summary

This release of Agents SDK v0.14.0 adds four major building blocks and a production hardening pass: experimental on-demand Agent Skills, chat Messengers (Telegram provider included), declarative timezone-aware Scheduled Tasks, and durable reasoning steps inside Think Workflows. It also significantly hardens durable chat recovery (recovering turns, stalled-stream recovery, sub-agent re-attach) and improves MCP transport and runtime tooling behavior.

Key Points

  • Agent Skills (experimental)

    • Load skills from bundled directory, R2, or manifest; skills add on-demand instructions/resources to prompts.
    • API exposes activate_skill, read_skill_resource, and an optional run_skill_script; duplicate or failing sources are skipped with warnings.
    • Script execution is early/experimental — API may change.
  • Messengers

    • Direct chat integration with Think owning webhook routing, conversation mapping, durable replies and streamed delivery.
    • Telegram provided as the first messenger; each chat thread maps to its own Think sub-agent by default.
    • Supports multiple bots, custom routing and custom providers.
  • Scheduled Tasks

    • defineScheduledTasks DSL for recurring, timezone-aware prompts and durable idempotent submissions.
    • Declarations are reconciled on startup and re-armed after each run.
  • Workflows

    • ThinkWorkflow supports step.prompt() with typed structured output, long waits, and approval gates (durable, typed results).
    • Useful for modeled reasoning steps inside Cloudflare Workflows with durable timeouts.
  • Production hardening for durable chat recovery

    • Turns survive deploys and DO evictions without re-running completed work or tools.
    • New isRecovering flag (exposed via useAgentChat) to surface recovering turns in UIs.
    • chatStreamStallTimeoutMs routes hung provider streams into recovery instead of infinite spinners.
    • In-flight agentTool() children re-attach to parent results on recovery to avoid losing long-running work.
  • MCP transport and other improvements

    • Resumable SSE streams with Last-Event-ID support; optional readable server ids for tools; improved correlation of concurrent JSON-RPC requests.
    • Session compaction driven by tokenCounter; worker-bundler createWorker gains virtualModules; client-tool continuation/coalescing fixes.

Upgrade & Practical notes

  • Upgrade packages (example):
    • npm install agents@latest @cloudflare/think@latest @cloudflare/ai-chat@latest
    • (Equivalent yarn / pnpm / bun commands available in the changelog.)
  • Notes for engineers:
    • Treat Agent Skills and script execution as experimental; expect API iteration and provide feedback.
    • Wire isRecovering in UIs (isStreaming || isRecovering) to avoid frozen indicators.
    • Set chatStreamStallTimeoutMs to control stalled provider stream recovery.
    • Use defineScheduledTasks and ThinkWorkflow.step.prompt(...) for durable scheduled and workflow-driven prompts.

Refer to the Agents API reference and Chat agents docs for code examples and migration details.

Full Translation

Translations

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

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

Agents、Workers - Agents SDK v0.14.0:Agent Skills、messengers、scheduled tasks、Workflows、および強化されたチャット復旧

Agents SDK v0.14.0: Agent Skills、messengers、scheduled tasks、Workflows、および強化されたチャット復旧

公開日: 2026-06-02

最新リリースの Agents SDK (v0.14.0) は、@cloudflare/think を使った構築方法を4つ追加します:オンデマンドの Agent Skills、チャット用 messengers(まずは Telegram)、宣言的な scheduled tasks、Workflows 内での耐久的な推論ステップ。また、本リリースでは耐久的チャット復旧の大幅な強化を行っており、本番環境でのデプロイ/オブジェクト追い出し/モデルストリームの停止などの状況下でもターンが確実に継続されるようになりました。

Agent Skills(実験的)

エージェントにオンデマンドの命令、リソース、スクリプトのカタログを与えます。スキルソースはシステムプロンプトにカタログを追加し、タスクが一致したときのみモデルがスキルを有効化するため、膨大な機能ライブラリが常にプロンプトを肥大化させることはありません。

JavaScript 例:

import { Think, skills } from "@cloudflare/think";
import bundledSkills from "agents:skills";
export class SkillsAgent extends Think {
  getSkills() {
    return [
      bundledSkills,
      skills.r2(this.env.SKILLS_BUCKET, { prefix: "skills/" }),
    ];
  }
}

TypeScript 例:

import { Think, skills } from "@cloudflare/think";
import bundledSkills from "agents:skills";
export class SkillsAgent extends Think<Env> {
  getSkills() {
    return [
      bundledSkills,
      skills.r2(this.env.SKILLS_BUCKET, { prefix: "skills/" }),
    ];
  }
}

agents:skills の import は Agents Vite プラグインを通じてローカルの ./skills ディレクトリをバンドルします(スキルごとに1つのディレクトリ、各ディレクトリに SKILL.md)。スキルは R2 やマニフェストからも読み込めます。スキルが利用可能な場合、Think は activate_skillread_skill_resource、およびオプションの run_skill_script ツールを公開します。スキルの読み込みは堅牢で、重複や読み込み失敗したソースは警告を出してスキップされ、エージェント全体を壊すことはありません。

Agent Skills は実験的です。特にスクリプト実行はまだ初期段階であり、API は将来のリリースで変更される可能性があります。フィードバック歓迎 — 何を作っているか、何が不足しているかを Agents リポジトリ ↗ に教えてください。

Messengers

Think エージェントをチャットプラットフォームに直接接続します。Think は webhook ルート、会話ルーティング、耐久的な返信ファイバー、プロバイダーへのストリーミング配信を管理します。最初のプロバイダーとして Telegram を提供します。

JavaScript 例:

import { Think } from "@cloudflare/think";
import { defineMessengers, ThinkMessengerStateAgent } from "@cloudflare/think/messengers";
import telegramMessenger from "@cloudflare/think/messengers/telegram";
export { ThinkMessengerStateAgent };
export class SupportAgent extends Think {
  getMessengers() {
    return defineMessengers({
      telegram: telegramMessenger({
        token: this.env.TELEGRAM_BOT_TOKEN,
        userName: "support_bot",
        secretToken: this.env.TELEGRAM_WEBHOOK_SECRET_TOKEN,
      }),
    });
  }
}

TypeScript 例:

import { Think } from "@cloudflare/think";
import { defineMessengers, ThinkMessengerStateAgent } from "@cloudflare/think/messengers";
import telegramMessenger from "@cloudflare/think/messengers/telegram";
export { ThinkMessengerStateAgent };
export class SupportAgent extends Think<Env> {
  getMessengers() {
    return defineMessengers({
      telegram: telegramMessenger({
        token: this.env.TELEGRAM_BOT_TOKEN,
        userName: "support_bot",
        secretToken: this.env.TELEGRAM_WEBHOOK_SECRET_TOKEN,
      }),
    });
  }
}

各チャット SDK スレッドはデフォルトで独自の Think サブエージェントにマップされるため、グループチャットとダイレクトメッセージはメモリを共有しません。複数ボットのサポート、カスタム会話ルーティング、カスタムプロバイダーもサポートされています。

Scheduled tasks(宣言的スケジュール)

型付き DSL を使って、繰り返しのタイムゾーン対応プロンプトとハンドラを宣言できます。Think は起動時に宣言を整合し、各実行後に次回発生時刻を再設定します。バックエンドは耐久的で冪等なサブミッションです。

JavaScript 例:

import { Think, defineScheduledTasks } from "@cloudflare/think";
export class DigestAgent extends Think {
  getScheduledTasks() {
    return defineScheduledTasks({
      weeklyCommitReport: {
        schedule: "every week on monday at 09:00",
        prompt: "Compile my GitHub commits for the last week and summarize them.",
      },
      workout: {
        schedule: "every day at 08:00 in Europe/London",
        prompt: "Start my workout.",
      },
    });
  }
}

TypeScript 例:

import { Think, defineScheduledTasks } from "@cloudflare/think";
export class DigestAgent extends Think<Env> {
  getScheduledTasks() {
    return defineScheduledTasks({
      weeklyCommitReport: {
        schedule: "every week on monday at 09:00",
        prompt: "Compile my GitHub commits for the last week and summarize them.",
      },
      workout: {
        schedule: "every day at 08:00 in Europe/London",
        prompt: "Start my workout.",
      },
    });
  }
}

Think Workflows

Cloudflare Workflow 内でモデル駆動の推論ステップを実行できます。ThinkWorkflowstep.prompt() を使い、耐久的で型付きの構造化出力、長時間待機、承認ゲートをサポートします。

JavaScript 例:

import { z } from "zod";
import { ThinkWorkflow } from "@cloudflare/think/workflows";

const draftSchema = z.object({
  title: z.string(),
  summary: z.string(),
  labels: z.array(z.string()),
});

export class TriageWorkflow extends ThinkWorkflow {
  async run(event, step) {
    const draft = await step.prompt("triage-issue", {
      prompt: `Triage issue #${event.payload.issueNumber}`,
      output: draftSchema,
      timeout: "3 days",
    });

    await step.do("apply-labels", async () => {
      await this.agent.applyLabels(draft.labels);
    });
  }
}

TypeScript 例:

import { z } from "zod";
import { ThinkWorkflow } from "@cloudflare/think/workflows";
import type { ThinkWorkflowStep } from "@cloudflare/think/workflows";
import type { AgentWorkflowEvent } from "agents/workflows";

const draftSchema = z.object({
  title: z.string(),
  summary: z.string(),
  labels: z.array(z.string()),
});

export class TriageWorkflow extends ThinkWorkflow<TriageAgent, Params> {
  async run(event: AgentWorkflowEvent<Params>, step: ThinkWorkflowStep) {
    const draft = await step.prompt("triage-issue", {
      prompt: `Triage issue #${event.payload.issueNumber}`,
      output: draftSchema,
      timeout: "3 days",
    });

    await step.do("apply-labels", async () => {
      await this.agent.applyLabels(draft.labels);
    });
  }
}

本番向けの耐久的チャット復旧の強化

耐久的チャットターン(durable chat turns)は、以前からターン中のデプロイや Durable Object の追い出しに耐える設計でした。本リリースはその仕組みを本番向けに大幅に強化しています。

  • デプロイ中の回復性の向上
    • ターンは継続的なデプロイや追い出しをまたいで完了済みの作業を失わず、既に実行されたツールを再実行しません。
  • ライブでの "recovering…" シグナル
    • useAgentChat は新しい isRecovering フラグを公開します。回復中のターンはフリーズしているように見えず進行状況を表示できます。多くの UI は isStreaming || isRecovering を "busy" としてレンダリングします。
  • 停止したストリームの回復
    • chatStreamStallTimeoutMs を設定すると、プロバイダーストリームがハングした場合でも無限スピナーを残すのではなく同じ回復経路にルーティングされます。
  • サブエージェントの再アタッチ
    • 親の回復時に、実行中の agentTool() 子が放棄されて再実行されるのではなく、その結果に再アタッチされるため、長時間実行される子がデプロイ時に作業を失うことがなくなります。

MCP トランスポートの改善

  • 再開可能なストリーム
    • SSE(Server-Sent Events)上の実行中ツール呼び出しは、接続が切断されても生き残ります。クライアントは Last-Event-ID で再接続し、見逃したイベントを再生します。
  • 読みやすいサーバー ID
    • addMcpServer はオプションの id を受け付けるようになり、ツールは読みやすいキー(例: tool_github_create_pull_request)として表示できます。接続 ID のような不透明な値ではありません。
  • 同時リクエストのハンドリング向上
    • オーバーラップする JSON-RPC リクエストは、HTTP と RPC の両トランスポート上で正しくレスポンスと対応付けられるようになりました。

その他の改善

  • コンパクション
    • SessiontokenCounter が、単にトリガーするかどうかだけでなくコンパクション境界("何を圧縮するか")の決定にも使われるようになりました。
  • @cloudflare/worker-bundler
    • createWorkervirtualModules オプションを追加し、バンドル時にインメモリのモジュールソースを提供できるようになりました。
  • クライアント-ツールの継続処理
    • 並列のツール結果は単一の継続にまとまり、即時のリジューム要求は保留中の継続にアタッチされ、サーバー側の needsApproval 継続は承認後に確実に再開されます。

アップグレード

最新バージョンに更新するには、パッケージマネージャーに応じて次を実行してください。

  • npm:

    npm i agents@latest @cloudflare/think@latest @cloudflare/ai-chat@latest

  • yarn:

    yarn add agents@latest @cloudflare/think@latest @cloudflare/ai-chat@latest

  • pnpm:

    pnpm add agents@latest @cloudflare/think@latest @cloudflare/ai-chat@latest

  • bun:

    bun add agents@latest @cloudflare/think@latest @cloudflare/ai-chat@latest

詳しくは Agents API リファレンスと Chat agents ドキュメントを参照してください。


フィードバックや詳細については Agents リポジトリ ↗ をご確認ください。