Setting the file. One moment.
Subchapter 1.15
references/streaming-chat.mdMarkdown1 KBView on GitHub
Use AIChatAgent for persisted conversations with streaming and tools; use callable streaming RPC for non-chat output. Before adapting an existing app, check its installed agents, @cloudflare/ai-chat, and AI SDK versions against the current docs.
Read the relevant documentation before implementing:
| Task | Documentation |
|---|---|
| Build a chat agent | Chat agent example (opens in a new tab) — setup, provider, server, and UI |
| Implement or customize chat | Chat agents (opens in a new tab) — message format, tools, custom streams, persistence, concurrency, cancellation, and recovery |
| Connect a client | Client guidance — React, vanilla JS, HTTP, and authentication |
| Stream non-chat results | Callable methods (opens in a new tab) — server and client streaming RPC |
| Trigger background turns | Server-driven messages |
| Add approvals | Human-in-the-loop |
Forward the request abort signal to the model call so cancellation stops generation. When customizing streams, verify persistence and completion behavior for the installed version. Treat client reconnection and Durable Object eviction as separate recovery cases.