{"id":39,"date":"2025-11-26T00:00:00","date_gmt":"2025-11-26T00:00:00","guid":{"rendered":"https:\/\/wordpress.securinsight.ca\/index.php\/2025\/11\/26\/agents-workers-agents-sdk-v0-2-24-with-resumable-streaming-mcp-improvements-and-schedule-fixes-2\/"},"modified":"2025-11-26T00:00:00","modified_gmt":"2025-11-26T00:00:00","slug":"agents-workers-agents-sdk-v0-2-24-with-resumable-streaming-mcp-improvements-and-schedule-fixes-2","status":"publish","type":"post","link":"https:\/\/wordpress.securinsight.ca\/index.php\/2025\/11\/26\/agents-workers-agents-sdk-v0-2-24-with-resumable-streaming-mcp-improvements-and-schedule-fixes-2\/","title":{"rendered":"Agents, Workers &#8211; Agents SDK v0.2.24 with resumable streaming, MCP improvements, and schedule fixes"},"content":{"rendered":"<p>The latest release of <a href=\"https:\/\/github.com\/cloudflare\/agents\" target=\"_blank\">@cloudflare\/agents<\/a> brings resumable streaming, significant MCP client improvements, and critical fixes for schedules and Durable Object lifecycle management.<\/p>\n<h4>Resumable streaming<\/h4>\n<p><code>AIChatAgent<\/code> now supports resumable streaming, allowing clients to reconnect and continue receiving streamed responses without losing data. This is useful for:<\/p>\n<ul>\n<li>Long-running AI responses<\/li>\n<li>Users on unreliable networks<\/li>\n<li>Users switching between devices mid-conversation<\/li>\n<li>Background tasks where users navigate away and return<\/li>\n<li>Real-time collaboration where multiple clients need to stay in sync<\/li>\n<\/ul>\n<p>Streams are maintained across page refreshes, broken connections, and syncing across open tabs and devices.<\/p>\n<h4>Other improvements<\/h4>\n<ul>\n<li>Default JSON schema validator added to MCP client<\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/agents\/api-reference\/schedule-tasks\/\" target=\"_blank\">Schedules<\/a> can now safely destroy the agent<\/li>\n<\/ul>\n<h4>MCP client API improvements<\/h4>\n<p>The <code>MCPClientManager<\/code> API has been redesigned for better clarity and control:<\/p>\n<ul>\n<li><strong>New <code>registerServer()<\/code> method<\/strong>: Register MCP servers without immediately connecting<\/li>\n<li><strong>New <code>connectToServer()<\/code> method<\/strong>: Establish connections to registered servers<\/li>\n<li><strong>Improved reconnect logic<\/strong>: <code>restoreConnectionsFromStorage()<\/code> now properly handles failed connections<\/li>\n<\/ul>\n<div>\n<figure>\n<pre data-language=\"ts\"><code class=\"language-ts\"><div><div><span>\/\/ Register a server to Agent<\/span><\/div><\/div><div><div><span>const<\/span><span> <\/span><span>{<\/span><span> <\/span><span>id<\/span><span> <\/span><span>}<\/span><span> <\/span><span>=<\/span><span> <\/span><span>await<\/span><span> <\/span><span>this<\/span><span>.<\/span><span>mcp<\/span><span>.<\/span><span>registerServer<\/span><span>(<\/span><span>{<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>name<\/span><span>:<\/span><span> <\/span><span>\"my-server\"<\/span><span>,<\/span><\/div><\/div><div><div><span><span>  <\/span><\/span><span>url<\/span><span>:<\/span><span> <\/span><span>\"https:\/\/my-mcp-server.example.com\"<\/span><span>,<\/span><\/div><\/div><div><div><span>}<\/span><span>)<\/span><span>;<\/span><\/div><\/div><div><div>\n<\/div><\/div><div><div><span>\/\/ Connect when ready<\/span><\/div><\/div><div><div><span>await<\/span><span> <\/span><span>this<\/span><span>.<\/span><span>mcp<\/span><span>.<\/span><span>connectToServer<\/span><span>(<\/span><span>id<\/span><span>)<\/span><span>;<\/span><\/div><\/div><div><div>\n<\/div><\/div><div><div><span>\/\/ Discover tools, prompts and resources<\/span><\/div><\/div><div><div><span>await<\/span><span> <\/span><span>this<\/span><span>.<\/span><span>mcp<\/span><span>.<\/span><span>discoverIfConnected<\/span><span>(<\/span><span>id<\/span><span>)<\/span><span>;<\/span><\/div><\/div><\/code><\/pre>\n<div><\/div>\n<\/figure>\n<\/div>\n<p>The SDK now includes a formalized <code>MCPConnectionState<\/code> enum with states: <code>idle<\/code>, <code>connecting<\/code>, <code>authenticating<\/code>, <code>connected<\/code>, <code>discovering<\/code>, and <code>ready<\/code>.<\/p>\n<h4>Enhanced MCP discovery<\/h4>\n<p>MCP discovery fetches the available tools, prompts, and resources from an MCP server so your agent knows what capabilities are available. The <code>MCPClientConnection<\/code> class now includes a dedicated <code>discover()<\/code> method with improved reliability:<\/p>\n<ul>\n<li>Supports cancellation via AbortController<\/li>\n<li>Configurable timeout (default 15s)<\/li>\n<li>Discovery failures now throw errors immediately instead of silently continuing<\/li>\n<\/ul>\n<h4>Bug fixes<\/h4>\n<ul>\n<li>Fixed a bug where <a href=\"https:\/\/developers.cloudflare.com\/agents\/api-reference\/schedule-tasks\/\" target=\"_blank\">schedules<\/a> meant to fire immediately with this.schedule(0, &#8230;) or <code>this.schedule(new Date(), ...)<\/code> would not fire<\/li>\n<li>Fixed an issue where schedules that took longer than 30 seconds would occasionally time out<\/li>\n<li>Fixed SSE transport now properly forwards session IDs and request headers<\/li>\n<li>Fixed AI SDK stream events convertion to UIMessageStreamPart<\/li>\n<\/ul>\n<h4>Upgrade<\/h4>\n<p>To update to the latest version:<\/p>\n<div>\n<figure>\n<pre data-language=\"sh\"><code class=\"language-sh\"><div><div><span>npm<\/span><span> <\/span><span>i<\/span><span> <\/span><span>agents@latest<\/span><\/div><\/div><\/code><\/pre>\n<div><\/div>\n<\/figure>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>The latest release of @cloudflare\/agents brings resumable streaming, significant MCP client improvements, and critical fixes for schedules and Durable Object lifecycle management. Resumable streaming AIChatAgent now supports resumable streaming, allowing clients to reconnect and continue receiving streamed responses without losing data. This is useful for: Long-running AI responses Users on unreliable networks Users switching between [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-39","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/posts\/39","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/comments?post=39"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/posts\/39\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/media?parent=39"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/categories?post=39"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.securinsight.ca\/index.php\/wp-json\/wp\/v2\/tags?post=39"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}