Retry Utilities
Agents v0.5.0 introduces a new this.retry() method for retrying async operations with exponential backoff and jitter. Developers can pass an optional shouldRetry predicate to bail early on non-retryable errors, and configure maxAttempts per operation.
Retry options are available both at the method level and per-task for queue(), schedule(), scheduleEvery(), and addMcpServer(), with configurations persisted in SQLite. Class-level defaults can be set via static options = { retry: { maxAttempts: 3 } }, and invalid values throw immediately at enqueue/schedule time. Internal retries have also been added for workflow operations with Durable Object-aware error detection.
Per-Connection Protocol Message Control
Agents automatically send JSON text frames (identity, state, MCP server lists) to every WebSocket connection. The new shouldSendProtocolMessages() method allows suppression of these messages per-connection for clients that cannot handle them — such as binary-only devices, MQTT clients, or lightweight embedded systems. The isConnectionProtocolEnabled() helper checks a connection's status at any time, and the flag persists across Durable Object hibernation.
@cloudflare/ai-chat v0.1.0
The first stable release ships with a major internal refactor including a new ResumableStream class and simplified SSE parsing, with zero breaking changes. Key new features include:
- Data parts — Attach typed JSON blobs to messages alongside text with support for reconciliation, append, and transient parts
- Tool approval persistence — Approval UI survives page refresh and Durable Object hibernation via SQLite persistence
maxPersistedMessages— Cap SQLite message storage with automatic oldest-message deletionbodyoption onuseAgentChat— Send custom data with every request- Incremental persistence — Hash-based caching to skip redundant SQL writes
- Row size guard — Automatic two-pass compaction when messages approach the 2 MB SQLite limit
autoContinueAfterToolResultdefaults totrue— Client-side tool results now automatically trigger server continuation
Bug Fixes and Other Improvements
Notable fixes include resolved stream resumption race conditions, fixed setMessages functional updater emptying arrays, restored client tool schemas after Durable Object hibernation, resolved InvalidPromptError after tool approval, and fixed reasoning-delta data loss during stream resumption.
Synchronous queue and schedule getters (getQueue(), dequeue(), etc.) no longer return Promises despite performing only synchronous SQL operations, improving usability while maintaining backward compatibility. Additional improvements include a TypeScript depth counter preventing "excessively deep" type errors, POST SSE keepalive pings every 30 seconds, and widened peer dependency ranges to prevent cascading major bumps.