agents@0.13.2

cloudflare/agentsagents@0.13.2May 21, 2026by github-actions[bot]

AI Summary

This patch release introduces `agents/chat-sdk`, a new Chat SDK StateAdapter backed by Agents sub-agents that stores subscriptions, concurrency locks, pending queues, cache entries, and other Chat SDK state in Durable Object SQLite. The adapter uses sub-agent sharding to keep Chat SDK infrastructure state inside child facets instead of requiring separate top-level Durable Object bindings.

Key Highlights

  • New `agents/chat-sdk` package provides Chat SDK StateAdapter backed by sub-agents
  • Adapter stores Chat SDK subscriptions, concurrency locks, pending queues, cache, and message history in Durable Object SQLite
  • State is sharded through `parent.subAgent()` for efficient infrastructure management
  • `createChatSdkState()` now defaults `parent` from `getCurrentAgent()` when called inside Agent lifecycle methods
  • Documentation clarifies that facet-only child classes should not be in `new_sqlite_classes` unless used as top-level Durable Objects

New Features

  • `createChatSdkState()` - convenience factory for Chat SDK state
  • `ChatSdkStateAgent` - default sub-agent for durable Chat SDK state
  • `ChatSdkStateAdapter` - concrete adapter implementation
  • `defaultThreadShard()` and `defaultKeyShard()` - default sharding helpers

Full Release Notes

### Patch Changes

-   [#1570](https://github.com/cloudflare/agents/pull/1570) [`4f14b9c`](https://github.com/cloudflare/agents/commit/4f14b9c7d16c3fe76268b053c2c3bde3b308915c) Thanks [@threepointone](https://github.com/threepointone)! - Add `agents/chat-sdk`, a Chat SDK `StateAdapter` backed by Agents sub-agents.

    This new package entrypoint exports:

    -   `createChatSdkState()`, a convenience factory for Chat SDK `state`.
    -   `ChatSdkStateAdapter`, the concrete adapter implementation.
    -   `ChatSdkStateAgent`, the default sub-agent used for durable Chat SDK state.
    -   `defaultThreadShard()` and `defaultKeyShard()`, the default sharding helpers used by the adapter.

    The adapter stores Chat SDK subscriptions, concurrency locks, pending queues, generic cache entries, callback metadata, thread and channel state, persisted message history, and transcript lists in Durable Object SQLite. State is sharded through `parent.subAgent()` so a messenger ingress Agent can keep Chat SDK infrastructure state inside child facets instead of requiring a separate top-level Durable Object binding for every state shard.

    `createChatSdkState()` now works with the default `ChatSdkStateAgent` class when it is re-exported from the Worker entrypoint. It also defaults `parent` from `getCurrentAgent()` when called inside an Agent lifecycle method or request handler, so the common setup is:

    ```ts
    export { ChatSdkStateAgent } from "agents/chat-sdk";

    const chat = new Chat({
      adapters,
      state: createChatSdkState(),
    });
    ```

    Applications that need custom state behavior can still pass a custom `agent` subclass and explicit `parent`.

    This also documents the sub-agent configuration model more clearly: production Workers should export facet classes, but facet-only child classes do not belong in `new_sqlite_classes` unless they are also used as top-level Durable Objects. Test wrangler configs may still include facet classes as test-only Durable Object bindings for `@cloudflare/vitest-pool-workers` compatibility, while keeping them out of `new_sqlite_classes`.