Skip to content

Commit 3279139

Browse files
Add Sessions, Sub-agents, and Think docs (#29882)
Add new API reference pages for Sessions, Sub-agents, and Think (persistent session storage, child Durable Object agents with RPC, and the Think opinionated chat framework). Update the Agents API index to include Sub-agents, Sessions, and Think. Clarify subagent delegation in chat-agents (note about in-process ToolLoopAgent vs Durable Object sub-agents). Rename/standardize chat recovery flag in durable-execution (unstable_chatRecovery → chatRecovery) and update related links/reference text. Also include minor related adjustments in long-running agents documentation.
1 parent 1088dca commit 3279139

7 files changed

Lines changed: 2370 additions & 5 deletions

File tree

src/content/docs/agents/api-reference/agents-api.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ flowchart TD
9191
| **Protocol messages** | `shouldSendProtocolMessages()`, `isConnectionProtocolEnabled()` | [Protocol messages](/agents/api-reference/protocol-messages/) |
9292
| **Context** | `getCurrentAgent()` | [getCurrentAgent()](/agents/api-reference/get-current-agent/) |
9393
| **Observability** | `subscribe()`, diagnostics channels, Tail Workers | [Observability](/agents/api-reference/observability/) |
94+
| **Sub-agents** | `subAgent()`, `abortSubAgent()`, `deleteSubAgent()` | [Sub-agents](/agents/api-reference/sub-agents/) |
95+
| **Sessions** | `Session.create()`, context blocks, compaction, search | [Sessions](/agents/api-reference/sessions/) |
96+
| **Think** | `Think` base class, workspace tools, lifecycle hooks, extensions | [Think](/agents/api-reference/think/) |
9497

9598
## SQL API
9699

src/content/docs/agents/api-reference/chat-agents.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,12 @@ export class ChatAgent extends AIChatAgent {
12451245
12461246
### Subagent delegation
12471247
1248+
:::note
1249+
1250+
This section covers **in-process** subagents using the AI SDK's `ToolLoopAgent`. For **Durable Object sub-agents** with their own isolated storage and typed RPC, refer to [Sub-agents](/agents/api-reference/sub-agents/). For streaming full LLM turns through a child agent, refer to [Think: Sub-agent RPC](/agents/api-reference/think/#sub-agent-rpc-and-programmatic-turns).
1251+
1252+
:::
1253+
12481254
Tools can delegate work to focused sub-calls with their own context. Use [`ToolLoopAgent`](https://ai-sdk.dev/docs/reference/ai-sdk-core/tool-loop-agent) to define a reusable agent, then call it from a tool's `execute`:
12491255
12501256
<TypeScriptExample>

src/content/docs/agents/api-reference/durable-execution.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ Key points:
283283

284284
### Chat recovery
285285

286-
`AIChatAgent` builds on fibers for LLM streaming recovery. When `unstable_chatRecovery` is enabled, each chat turn is wrapped in a fiber automatically. The framework handles the internal recovery path and exposes `onChatRecovery` for provider-specific strategies. Refer to [Long-running agents: Recovering interrupted LLM streams](/agents/concepts/long-running-agents/#recovering-interrupted-llm-streams) for details.
286+
`AIChatAgent` builds on fibers for LLM streaming recovery. When `chatRecovery` is enabled, each chat turn is wrapped in a fiber automatically. The framework handles the internal recovery path and exposes `onChatRecovery` for provider-specific strategies. Refer to [Long-running agents: Recovering interrupted LLM streams](/agents/concepts/long-running-agents/#recovering-interrupted-llm-streams) for details.
287287

288288
## Concurrent fibers
289289

@@ -344,4 +344,4 @@ Run an async function while keeping the DO alive. Heartbeat starts before `fn` a
344344
- [Long-running agents](/agents/concepts/long-running-agents/) — how fibers compose with schedules, plans, and async operations
345345
- [Schedule tasks](/agents/api-reference/schedule-tasks/)`keepAlive` details and the alarm system
346346
- [Workflows](/agents/concepts/workflows/) — durable multi-step execution outside the agent
347-
- [Chat agents](/agents/api-reference/chat-agents/)`unstable_chatRecovery` and `onChatRecovery`
347+
- [Chat agents](/agents/api-reference/chat-agents/)`chatRecovery` and `onChatRecovery`

0 commit comments

Comments
 (0)