Minor Changes
-
#2071
9620b58Thanks @ben-reitz! - Make durable chat recovery unconditional forAIChatAgentandThink.Every chat turn now runs in a recovery fiber, including WebSocket, programmatic, retry, and continuation paths.
chatRecoveryacceptstrueor a configuration object;falseis no longer supported. Previously compiled JavaScript that still suppliesfalsesafely receives the default recovery configuration.To keep durable bookkeeping while preventing automatic inference after an interruption, return
{ continue: false }fromonChatRecovery(). Use durable cancellation, side-effect, or spend state in that hook and tunechatRecoverybudgets when retries must be bounded. -
#2133
d536067Thanks @mattzcarey! - Vendor the required PartyServer runtime intoagents/lifecycleand add a reusable Durable Object lifecycle for startup, request interception, alarms, and WebSockets.Agentnow directly extends Cloudflare'sDurableObjectand composes the same lifecycle used by standalone objects; standalone hosts use the explicitLifecycle.install(this)factory (or the expandednew ...plusinstallHandlers()form). Both Agent subclasses and standalone hosts use the existingrouteAgentRequest()API and/agentsURL prefix; the lifecycle entry point does not introduce a second public router.Lifecycle WebSockets always use Cloudflare's Hibernation API; the
static options.hibernateswitch and in-memory connection mode are removed. Named Durable Objects use nativectx.id.name, while a read-only__ps_namefallback migrates objects created by older releases without writing new compatibility state. -
#2058
381b9bbThanks @ben-reitz! - Throttle chat UI updates by default inuseAgentChatStreaming writes chat state once per chunk, and each write re-renders. When
chunks arrive in a burst — a resumed stream replaying a long turn, for
example — React reaches its 50-render limit and throws "Maximum update depth
exceeded", which the AI SDK reports as a failed turn even though the server
completed it (#1913).useAgentChatnow coalesces those updates every 50ms, which removes about 78%
of renders on a fast stream and matches the value the AI SDK documents. The
first chunk of a stream is never delayed. Passthrottle: falseto render
every chunk as it arrives, or a number to change the interval. The deprecated
experimental_throttleis still honoured. Message snapshots, functional
updates, and streamed continuations resolve against the current chat store, so
coalescing renders cannot roll assistant content back to an older snapshot. -
#1897
29b0107Thanks @mattzcarey! - AddScheduler, a reusable Lifecycle capability for persistent delayed, dated, cron, and interval callbacks, underagents/schedules. Scheduled callbacks are registered on the Scheduler itself (new Scheduler({ callbacks: { ... } })), andset()/every()type both the callback name and the payload against that registration, so the typed scheduling surface and the runtime dispatch target are the same object.LifecycleCapabilitysupplies every capability with storage, readiness, startup state, alarm coordination, a host invocation boundary, best-effort events, and generic capability routing — Scheduler consumes only that standard surface plus its callbacks and policy options, so any host that installs it configures nothing else. Lifecycle owns the physical Durable Object alarm and routes matching capability messages between Agent facets through one internal transport aperture, preserving existing root-owned facet schedule rows without Scheduler-specific Agent RPC methods or an Agent adapter.Agentuses the same Scheduler behind its existing APIs — name-basedthis.schedule(60, "methodName")keeps dispatching to Agent methods through a composition-root resolver — and preserves callback context, observability, retries, OOM handling, and alarm behavior. MCP now receives storage from Lifecycle when installed. Explicit destruction disposes live capability resources once, then clears shared Durable Object storage withdeleteAll(). Think workflow notifications now contribute their wake time through Lifecycle instead of writing the physical alarm directly. The previousagents/scheduleparser entry point remains as a deprecated compatibility alias. Agent exposes the composition root as experimentalthis.lifecycleandthis.schedulerproperties. Theagents/lifecycleentry point and the capability surfaces built on it (Scheduler, installingMCPClientManagerdirectly as a capability) are experimental and may change between releases; Agent's established APIs are unaffected.Compatibility notes:
MCPClientManagerOptions.storageis removed — the manager receives storage from the Lifecycle it is installed on, so standalone construction with an explicitDurableObjectStorageis no longer supported. Scheduled callbacks now receive the documented parsedScheduleobject as their second argument (previously the raw storage row, whosepayloadwas an unparsed JSON string). The internal_cf_*ForFacetschedule RPC methods are replaced by the generic_cf_routeLifecyclecapability aperture; facets always run the same deployed script, so no coordination is required. -
#2161
ded09c6Thanks @mattzcarey! - Remove the publishedagentscommand-line binary. Its advertisedinit,dev,deploy, andmcpcommands were placeholders that printed "not implemented yet" and exited successfully. Use the documented C3 starter, Vite and Wrangler commands, and MCP APIs instead. -
#1895
4ba9a37Thanks @mattzcarey! - MakeMCPClientManagera reusable Durable Object lifecycle capability. It now owns schema initialization, persisted HTTP and RPC connection restoration, and OAuth callback interception when installed withLifecycle.use(), while preservingAgent.this.mcpand the existing Agent MCP APIs.agents/lifecycleexports theLifecycleObjecthost interface and canonicalgetCurrentAgent()accessor; Lifecycle supplies that context to host hooks while capability hooks remain self-contained.
Patch Changes
-
#2027
e87ad62Thanks @cjol! - Route asynchronous callable and streaming responses through the facet WebSocket frame that originated each RPC. -
#1978
b7c7696Thanks @Ankcorn! - Add Agents SDK instrumentation and agent instance identity attributes to SDK-created spans. -
#2050
3b43c33Thanks @ben-reitz! - Batch replayed chunks during stream resume so long turns do not exceed React's
update limit and report a false error. -
#2120
b038440Thanks @ben-reitz! - Keep Session compaction overlays scoped to their selected conversation branch and preserve deterministic ordering for overlays created in the same second. -
#2090
2f957bcThanks @ben-reitz! - Keep sub-agent WebSocket operations routable and ordered across live and delayed contexts and before broadcasts, report routing failures, and preserve nested sub-agent broadcasts across RPC callbacks. -
#2131
bf94bb2Thanks @ben-reitz! - Fall back to no-op tracing when an older Workers runtime exposes tracing withoutstartActiveSpan, preventing Agent initialization from failing.