From f59688ac0bfcbaf105da037e5d72dcda8dd4f613 Mon Sep 17 00:00:00 2001 From: katereznykova Date: Mon, 16 Feb 2026 10:24:26 +0000 Subject: [PATCH 1/8] [Agents] Add changelog for Agents SDK v0.5.0 and @cloudflare/ai-chat v0.1.0 --- .../agents/2026-02-16-agents-sdk-v0.5.0.mdx | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx diff --git a/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx b/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx new file mode 100644 index 00000000000..a44c503f192 --- /dev/null +++ b/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx @@ -0,0 +1,87 @@ +--- +title: "Agents SDK v0.5.0: Retry utilities, @cloudflare/ai-chat v0.1.0, and synchronous queue/schedule getters" +description: The Agents SDK v0.5.0 adds built-in retry utilities with exponential backoff, the first stable release of @cloudflare/ai-chat with major bug fixes and new features, synchronous queue and schedule getter methods, and several developer experience improvements. +products: + - agents + - workers +date: 2026-02-16 +--- + +import { TypeScriptExample } from "~/components"; + +The latest release of the [Agents SDK](https://github.com/cloudflare/agents) adds built-in retry utilities, the first stable release of `@cloudflare/ai-chat`, synchronous queue and schedule getters, and several bug fixes. + +## Retry utilities + +A new `this.retry()` method lets you retry any async operation with exponential backoff and jitter. You can pass an optional `shouldRetry` predicate to bail early on non-retryable errors. + + + +```ts +class MyAgent extends Agent { + async onRequest(request: Request) { + const result = await this.retry(() => fetch("https://example.com/api"), { + maxRetries: 3, + shouldRetry: (error) => error.status !== 404, + }); + return result; + } +} +``` + + + +Retry options are also available per-task on `queue()`, `schedule()`, `scheduleEvery()`, and `addMcpServer()`: + + + +```ts +// Per-task retry configuration, persisted in SQLite alongside the task +await this.schedule("sendReport", Date.now() + 60_000, { + retry: { maxRetries: 5 }, +}); + +// Class-level retry defaults +class MyAgent extends Agent { + static options = { + retry: { maxRetries: 3 }, + }; +} +``` + + + +Retry options are validated eagerly at enqueue/schedule time, and invalid values throw immediately. Internal retries have also been added for workflow operations (`terminateWorkflow`, `pauseWorkflow`, and others) with Durable Object-aware error detection. + +## @cloudflare/ai-chat v0.1.0 + +The first stable release of `@cloudflare/ai-chat` ships alongside this release with a major refactor of `AIChatAgent`, including a new `ResumableStream` class, WebSocket `ChatTransport`, and simplified SSE parsing. + +Key new features: + +- **`maxPersistedMessages`** — Cap SQLite message storage with automatic oldest-message deletion. +- **`body` option on `useAgentChat`** — Send custom data with every request (static or dynamic). +- **Incremental persistence** — Hash-based cache to skip redundant SQL writes. +- **Row size guard** — Automatic two-pass compaction when messages approach the SQLite 2 MB limit. +- **`autoContinueAfterToolResult` defaults to `true`** — Client-side tool results and tool approvals now automatically trigger a server continuation, matching server-executed tool behavior. Set `autoContinueAfterToolResult: false` in `useAgentChat` to restore the previous behavior. + +Notable bug fixes include: `setMessages` functional updater sending empty arrays, `CF_AGENT_MESSAGE_UPDATED` not broadcasting for streaming messages, stream resumption race conditions, `clearAll()` not clearing in-memory chunk buffers, and `reasoning-delta` silently dropping data when `reasoning-start` was missed during stream resumption. + +## Synchronous queue and schedule getters + +`getQueue()`, `getQueues()`, `getSchedule()`, `dequeue()`, `dequeueAll()`, and `dequeueAllByCallback()` were unnecessarily `async` despite only performing synchronous SQL operations. They now return values directly instead of wrapping them in Promises. This is backward compatible — existing code using `await` on these methods will continue to work. + +## Other improvements + +- **Fix React hooks exhaustive-deps warning** — `useAgent` no longer triggers the React exhaustive-deps lint warning by correctly referencing `cacheInvalidatedAt` inside the `useMemo` body. +- **Fix TypeScript "excessively deep" error** — A depth counter on `CanSerialize` and `IsSerializableParam` types bails out to `true` after 10 levels of recursion, preventing the "Type instantiation is excessively deep" error with deeply nested types like AI SDK `CoreMessage[]`. +- **POST SSE keepalive** — The POST SSE handler now sends `event: ping` every 30 seconds to keep the connection alive, matching the existing GET SSE handler behavior. This prevents POST response streams from being silently dropped by proxies during long-running tool calls. +- **Widened peer dependency ranges** — Peer dependency ranges across packages have been widened to prevent cascading major bumps during 0.x minor releases. `@cloudflare/ai-chat` and `@cloudflare/codemode` are now marked as optional peer dependencies. + +### Upgrade + +To update to the latest version: + +```sh +npm i agents@latest @cloudflare/ai-chat@latest +``` From e8465526a7df6bf1940aed982fd61c795217c95d Mon Sep 17 00:00:00 2001 From: "ask-bonk[bot]" Date: Mon, 16 Feb 2026 10:30:52 +0000 Subject: [PATCH 2/8] [Agents] Format bug fixes as bulleted list for readability --- .../changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx b/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx index a44c503f192..738cfbaf07e 100644 --- a/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx +++ b/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx @@ -65,7 +65,13 @@ Key new features: - **Row size guard** — Automatic two-pass compaction when messages approach the SQLite 2 MB limit. - **`autoContinueAfterToolResult` defaults to `true`** — Client-side tool results and tool approvals now automatically trigger a server continuation, matching server-executed tool behavior. Set `autoContinueAfterToolResult: false` in `useAgentChat` to restore the previous behavior. -Notable bug fixes include: `setMessages` functional updater sending empty arrays, `CF_AGENT_MESSAGE_UPDATED` not broadcasting for streaming messages, stream resumption race conditions, `clearAll()` not clearing in-memory chunk buffers, and `reasoning-delta` silently dropping data when `reasoning-start` was missed during stream resumption. +Notable bug fixes: + +- `setMessages` functional updater sending empty arrays +- `CF_AGENT_MESSAGE_UPDATED` not broadcasting for streaming messages +- Stream resumption race conditions +- `clearAll()` not clearing in-memory chunk buffers +- `reasoning-delta` silently dropping data when `reasoning-start` was missed during stream resumption ## Synchronous queue and schedule getters From 5f1c0420a7f6a9a494c5a2150446873348928802 Mon Sep 17 00:00:00 2001 From: whoiskatrin Date: Mon, 16 Feb 2026 16:14:31 +0000 Subject: [PATCH 3/8] Update src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx Co-authored-by: Sunil Pai --- src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx b/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx index 738cfbaf07e..9359ac91172 100644 --- a/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx +++ b/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx @@ -9,7 +9,7 @@ date: 2026-02-16 import { TypeScriptExample } from "~/components"; -The latest release of the [Agents SDK](https://github.com/cloudflare/agents) adds built-in retry utilities, the first stable release of `@cloudflare/ai-chat`, synchronous queue and schedule getters, and several bug fixes. +The latest release of the [Agents SDK](https://github.com/cloudflare/agents) adds built-in retry utilities, a fully rewritten `@cloudflare/ai-chat` with zero braking changes, and several bug fixes. ## Retry utilities From ac52f308dff3ec673e57a440c684d85d52e37520 Mon Sep 17 00:00:00 2001 From: whoiskatrin Date: Mon, 16 Feb 2026 16:14:40 +0000 Subject: [PATCH 4/8] Update src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx Co-authored-by: Sunil Pai --- src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx b/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx index 9359ac91172..8b58d37c9bc 100644 --- a/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx +++ b/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx @@ -79,7 +79,6 @@ Notable bug fixes: ## Other improvements -- **Fix React hooks exhaustive-deps warning** — `useAgent` no longer triggers the React exhaustive-deps lint warning by correctly referencing `cacheInvalidatedAt` inside the `useMemo` body. - **Fix TypeScript "excessively deep" error** — A depth counter on `CanSerialize` and `IsSerializableParam` types bails out to `true` after 10 levels of recursion, preventing the "Type instantiation is excessively deep" error with deeply nested types like AI SDK `CoreMessage[]`. - **POST SSE keepalive** — The POST SSE handler now sends `event: ping` every 30 seconds to keep the connection alive, matching the existing GET SSE handler behavior. This prevents POST response streams from being silently dropped by proxies during long-running tool calls. - **Widened peer dependency ranges** — Peer dependency ranges across packages have been widened to prevent cascading major bumps during 0.x minor releases. `@cloudflare/ai-chat` and `@cloudflare/codemode` are now marked as optional peer dependencies. From 60fd52cb2ab973d1bb121ad2be633bade978e17a Mon Sep 17 00:00:00 2001 From: "ask-bonk[bot]" Date: Mon, 16 Feb 2026 16:17:34 +0000 Subject: [PATCH 5/8] Update changelog date to Feb 17th Co-authored-by: whoiskatrin --- ...6-agents-sdk-v0.5.0.mdx => 2026-02-17-agents-sdk-v0.5.0.mdx} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/content/changelog/agents/{2026-02-16-agents-sdk-v0.5.0.mdx => 2026-02-17-agents-sdk-v0.5.0.mdx} (99%) diff --git a/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx similarity index 99% rename from src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx rename to src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx index 8b58d37c9bc..e5691bcc3c7 100644 --- a/src/content/changelog/agents/2026-02-16-agents-sdk-v0.5.0.mdx +++ b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx @@ -4,7 +4,7 @@ description: The Agents SDK v0.5.0 adds built-in retry utilities with exponentia products: - agents - workers -date: 2026-02-16 +date: 2026-02-17 --- import { TypeScriptExample } from "~/components"; From 960a2969f0debdd8b05bcf10bf44a88df30a07f9 Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Mon, 16 Feb 2026 19:59:38 +0000 Subject: [PATCH 6/8] Apply suggestion from @threepointone --- src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx index e5691bcc3c7..3e1f0b899b9 100644 --- a/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx +++ b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx @@ -9,7 +9,7 @@ date: 2026-02-17 import { TypeScriptExample } from "~/components"; -The latest release of the [Agents SDK](https://github.com/cloudflare/agents) adds built-in retry utilities, a fully rewritten `@cloudflare/ai-chat` with zero braking changes, and several bug fixes. +The latest release of the [Agents SDK](https://github.com/cloudflare/agents) adds built-in retry utilities, a fully rewritten `@cloudflare/ai-chat` with zero breaking changes, and several bug fixes. ## Retry utilities From ca7c20664e7fcbc5b15203affdc7781941c85f43 Mon Sep 17 00:00:00 2001 From: whoiskatrin Date: Tue, 17 Feb 2026 09:34:17 +0000 Subject: [PATCH 7/8] Update src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx Co-authored-by: Jun Lee --- .../changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx index 3e1f0b899b9..0a00b0b5b70 100644 --- a/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx +++ b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx @@ -67,11 +67,11 @@ Key new features: Notable bug fixes: -- `setMessages` functional updater sending empty arrays -- `CF_AGENT_MESSAGE_UPDATED` not broadcasting for streaming messages -- Stream resumption race conditions -- `clearAll()` not clearing in-memory chunk buffers -- `reasoning-delta` silently dropping data when `reasoning-start` was missed during stream resumption +- Resolved an issue where `setMessages` functional updater sent empty arrays +- Resolved an issue where `CF_AGENT_MESSAGE_UPDATED` did not broadcast for streaming messages +- Resolved stream resumption race conditions +- Resolved an issue where `clearAll()` did not clear in-memory chunk buffers +- Resolved an issue where `reasoning-delta` silently dropped data when `reasoning-start` was missed during stream resumption ## Synchronous queue and schedule getters From 3cfd7a841623728e0b4eaf7881eea5bbadcc249f Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Tue, 17 Feb 2026 11:51:36 +0000 Subject: [PATCH 8/8] Update Agents SDK v0.5.0 changelog Revise the Agents SDK v0.5.0 changelog to include per-connection protocol message control and data parts. Adds a new 'Per-connection protocol message control' section with a TypeScript example and link to docs, updates the release summary to mention protocol control and data parts, and expands the @cloudflare/ai-chat v0.1.0 notes to include data parts, tool approval persistence, and several bug-fix clarifications and reordering. --- .../agents/2026-02-17-agents-sdk-v0.5.0.mdx | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx index 0a00b0b5b70..c8b7a369404 100644 --- a/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx +++ b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx @@ -1,6 +1,6 @@ --- -title: "Agents SDK v0.5.0: Retry utilities, @cloudflare/ai-chat v0.1.0, and synchronous queue/schedule getters" -description: The Agents SDK v0.5.0 adds built-in retry utilities with exponential backoff, the first stable release of @cloudflare/ai-chat with major bug fixes and new features, synchronous queue and schedule getter methods, and several developer experience improvements. +title: "Agents SDK v0.5.0: Protocol message control, retry utilities, data parts, and @cloudflare/ai-chat v0.1.0" +description: The Agents SDK v0.5.0 adds per-connection protocol message control for binary clients, built-in retry utilities with exponential backoff, data parts for typed JSON in chat messages, the first stable release of `@cloudflare/ai-chat`, and several developer experience improvements. products: - agents - workers @@ -9,7 +9,7 @@ date: 2026-02-17 import { TypeScriptExample } from "~/components"; -The latest release of the [Agents SDK](https://github.com/cloudflare/agents) adds built-in retry utilities, a fully rewritten `@cloudflare/ai-chat` with zero breaking changes, and several bug fixes. +The latest release of the [Agents SDK](https://github.com/cloudflare/agents) adds built-in retry utilities, per-connection protocol message control, and a fully rewritten `@cloudflare/ai-chat` with data parts, tool approval persistence, and zero breaking changes. ## Retry utilities @@ -53,12 +53,36 @@ class MyAgent extends Agent { Retry options are validated eagerly at enqueue/schedule time, and invalid values throw immediately. Internal retries have also been added for workflow operations (`terminateWorkflow`, `pauseWorkflow`, and others) with Durable Object-aware error detection. -## @cloudflare/ai-chat v0.1.0 +## Per-connection protocol message control -The first stable release of `@cloudflare/ai-chat` ships alongside this release with a major refactor of `AIChatAgent`, including a new `ResumableStream` class, WebSocket `ChatTransport`, and simplified SSE parsing. +Agents automatically send JSON text frames (identity, state, MCP server lists) to every WebSocket connection. You can now suppress these per-connection for clients that cannot handle them — binary-only devices, MQTT clients, or lightweight embedded systems. + + + +```ts +class MyAgent extends Agent { + shouldSendProtocolMessages(connection: Connection, ctx: ConnectionContext) { + // Suppress protocol messages for MQTT clients + const subprotocol = ctx.request.headers.get("Sec-WebSocket-Protocol"); + return subprotocol !== "mqtt"; + } +} +``` + + + +Connections with protocol messages disabled still fully participate in RPC and regular messaging. Use `isConnectionProtocolEnabled(connection)` to check a connection's status at any time. The flag persists across Durable Object hibernation. + +See [Protocol messages](/agents/api-reference/protocol-messages/) for full documentation. + +## `@cloudflare/ai-chat` v0.1.0 + +The first stable release of `@cloudflare/ai-chat` ships alongside this release with a major refactor of `AIChatAgent` internals — new `ResumableStream` class, WebSocket `ChatTransport`, and simplified SSE parsing — with zero breaking changes. Existing code using `AIChatAgent` and `useAgentChat` works as-is. Key new features: +- **Data parts** — Attach typed JSON blobs (`data-*`) to messages alongside text. Supports reconciliation (type+id updates in-place), append, and transient parts (ephemeral via `onData` callback). See [Data parts](/agents/api-reference/chat-agents/#data-parts). +- **Tool approval persistence** — The `needsApproval` approval UI now survives page refresh and DO hibernation. The streaming message is persisted to SQLite when a tool enters `approval-requested` state. - **`maxPersistedMessages`** — Cap SQLite message storage with automatic oldest-message deletion. - **`body` option on `useAgentChat`** — Send custom data with every request (static or dynamic). - **Incremental persistence** — Hash-based cache to skip redundant SQL writes. @@ -67,9 +91,11 @@ Key new features: Notable bug fixes: -- Resolved an issue where `setMessages` functional updater sent empty arrays -- Resolved an issue where `CF_AGENT_MESSAGE_UPDATED` did not broadcast for streaming messages - Resolved stream resumption race conditions +- Resolved an issue where `setMessages` functional updater sent empty arrays +- Resolved an issue where client tool schemas were lost after DO hibernation +- Resolved `InvalidPromptError` after tool approval (`approval.id` was dropped) +- Resolved an issue where message metadata was not propagated on broadcast/resume paths - Resolved an issue where `clearAll()` did not clear in-memory chunk buffers - Resolved an issue where `reasoning-delta` silently dropped data when `reasoning-start` was missed during stream resumption