Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion public/__redirects
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@
/agents/concepts/long-running-agents/ /agents/concepts/agentic-patterns/long-running-agents/ 301
/agents/api-reference/agents-api/ /agents/runtime/agents-api/ 301
/agents/api-reference/ /agents/runtime/ 301
/agents/api-reference/chat-sdk/ /agents/runtime/execution/chat-sdk/ 301
/agents/api-reference/chat-sdk/ /agents/runtime/communication/chat-sdk/ 301
Comment thread
thomasgauvin marked this conversation as resolved.
Comment thread
thomasgauvin marked this conversation as resolved.
/agents/runtime/execution/chat-sdk/ /agents/runtime/communication/chat-sdk/ 301
/agents/api-reference/agent-tools/ /agents/runtime/execution/agent-tools/ 301
/agents/api-reference/browse-the-web/ /agents/tools/browser/ 301
/agents/api-reference/callable-methods/ /agents/runtime/lifecycle/callable-methods/ 301
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ export class ChatAgent extends AIChatAgent {

:::note

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/runtime/execution/sub-agents/). To run Think or `AIChatAgent` sub-agents as retained, streaming tools, refer to [Agent tools](/agents/runtime/execution/agent-tools/).
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/runtime/execution/sub-agents/). To run Think or `AIChatAgent` sub-agents as retained, streaming tools, refer to [Agents as tools](/agents/runtime/execution/agent-tools/).

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ client.addEventListener("message", () => {});

## Agent-tool events

If your chat UI renders retained child runs from [Agent tools](/agents/runtime/execution/agent-tools/), use `useAgentToolEvents()` alongside `useAgent()` and `useAgentChat()`. The hook subscribes to the parent connection, replays retained child timelines, and groups runs by parent tool call ID.
If your chat UI renders retained child runs from [Agents as tools](/agents/runtime/execution/agent-tools/), use `useAgentToolEvents()` alongside `useAgent()` and `useAgentChat()`. The hook subscribes to the parent connection, replays retained child timelines, and groups runs by parent tool call ID.

<TypeScriptExample>

Expand Down
10 changes: 5 additions & 5 deletions src/content/docs/agents/concepts/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Tools enable AI systems to interact with external services and perform actions.

Cloudflare Agents support several tool patterns. Choose the smallest one that fits the job:

| Pattern | Use when | Start here |
| ----------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| Pattern | Use when | Start here |
| ----------------- | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| Server-side tools | The tool can run entirely in the Worker, such as fetching an API or querying SQL | [Chat agents](/agents/communication-channels/chat/chat-agents/#server-side-tools) |
| Client-side tools | The tool needs browser APIs such as geolocation, clipboard, or local storage | [Chat agents](/agents/communication-channels/chat/chat-agents/#client-side-tools) |
| Human approvals | The tool is sensitive and needs a user decision before it runs | [Human-in-the-loop](/agents/concepts/agentic-patterns/human-in-the-loop/) |
| MCP tools | You want to expose or consume tools through the Model Context Protocol | [Model Context Protocol](/agents/model-context-protocol/) |
| Agent tools | You want a chat agent to run another chat-capable sub-agent as a retained, streaming tool | [Agent tools](/agents/runtime/execution/agent-tools/) |
| Human approvals | The tool is sensitive and needs a user decision before it runs | [Human-in-the-loop](/agents/concepts/agentic-patterns/human-in-the-loop/) |
| MCP tools | You want to expose or consume tools through the Model Context Protocol | [Model Context Protocol](/agents/model-context-protocol/) |
| Agents as tools | You want a chat agent to run another chat-capable sub-agent as a retained, streaming tool | [Agents as tools](/agents/runtime/execution/agent-tools/) |

### Understanding tools

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/agents/harnesses/think/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Think has several ways to start or continue a turn. Choose based on who starts t

Use `saveMessages()` when the caller owns the trigger and can wait for the turn to finish. Use [`submitMessages()`](/agents/harnesses/think/programmatic-submissions/) when timeout ambiguity would make retries unsafe.

Use `chat()` for low-level parent-to-child streaming when your code owns forwarding, cancellation, and replay policy. Use [Agent tools](/agents/runtime/execution/agent-tools/) when a parent model or workflow delegates to a child agent and you want retained child runs, event replay, abort bridging, and UI drill-in.
Use `chat()` for low-level parent-to-child streaming when your code owns forwarding, cancellation, and replay policy. Use [Agents as tools](/agents/runtime/execution/agent-tools/) when a parent model or workflow delegates to a child agent and you want retained child runs, event replay, abort bridging, and UI drill-in.

Use [`startFiber()`](/agents/runtime/execution/durable-execution/#startfiber) outside Think when the durable unit is an application job around a turn: accepting a webhook once, restoring a serialized channel or thread target, posting a visible reply, or recording app-level recovery policy. Think submissions own conversation admission and turn serialization; managed fibers own external job acceptance, idempotent side effects, and application recovery.

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/agents/harnesses/think/messengers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@ Every custom messenger must provide `verifyWebhook` or explicitly use `verifyWeb

The `examples/think-chat-sdk` example demonstrates the Think-native `getMessengers()` path with a small Vite dashboard that inspects the root Think conversation over the Agent WebSocket.

The `examples/chat-sdk-messenger` example demonstrates a larger manual ingress agent with an admin dashboard, menu handling, and application-owned reply fibers. Use `getMessengers()` for the simple Think-native path. Use the example when you need to own the Chat SDK runtime and control-plane UI yourself. Refer to [Chat SDK state](/agents/runtime/execution/chat-sdk/) for the underlying state adapter.
The `examples/chat-sdk-messenger` example demonstrates a larger manual ingress agent with an admin dashboard, menu handling, and application-owned reply fibers. Use `getMessengers()` for the simple Think-native path. Use the example when you need to own the Chat SDK runtime and control-plane UI yourself. Refer to [Chat SDK state](/agents/runtime/communication/chat-sdk/) for the underlying state adapter.
2 changes: 1 addition & 1 deletion src/content/docs/agents/harnesses/think/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ On every turn, Think merges tools from multiple sources. Later sources override
6. **MCP tools** — from connected MCP servers
7. **Client tools** — from the browser (refer to [Client tools](/agents/harnesses/think/client-tools/))

Tools belong to the agent running the turn. For parent-child orchestration, use [Agent tools](/agents/runtime/execution/agent-tools/) instead of passing one-off tools through `chat()`.
Tools belong to the agent running the turn. For parent-child orchestration, use [Agents as tools](/agents/runtime/execution/agent-tools/) instead of passing one-off tools through `chat()`.

## Built-in workspace tools

Expand Down
Loading