From 53d1651c1c93abc4ebcc6bf51942bcd264319608 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Tue, 27 Oct 2026 11:10:55 +0000 Subject: [PATCH 1/2] [Agents] Move the Agent class docs under /agents/agent-class/ --- public/__redirects | 115 +++++++++++------- src/components/cf/AgentsPlatformDiagram.astro | 24 ++-- .../agents/2025-03-18-npm-i-agents.mdx | 6 +- ...5-04-07-mcp-servers-agents-sdk-updates.mdx | 2 +- .../2025-11-26-agents-resumable-streaming.mdx | 4 +- ...026-02-03-agents-workflows-integration.mdx | 2 +- .../agents/2026-02-17-agents-sdk-v0.5.0.mdx | 4 +- .../agents/2026-03-02-agents-sdk-v0.7.0.mdx | 2 +- .../agents/2026-05-13-agents-sdk-v0.12.4.mdx | 2 +- .../agents/2026-06-02-agents-sdk-v0.14.0.mdx | 2 +- .../agents/2026-06-16-agents-sdk-v0.16.1.mdx | 2 +- ...6-09-11-voice-diagnostics-turn-metrics.mdx | 2 +- .../execution => agent-class}/agent-tools.mdx | 6 +- .../callable-methods.mdx | 8 +- .../communication-channels}/chat-sdk.mdx | 0 .../chat/autonomous-responses.mdx | 12 +- .../chat/chat-agents.mdx | 10 +- .../chat/client-sdk.mdx | 8 +- .../communication-channels/chat/index.mdx | 0 .../communication-channels/email.mdx | 0 .../communication-channels/index.mdx | 2 +- .../communication-channels/slack.mdx | 0 .../communication-channels/voice.mdx | 0 .../communication-channels/webhooks/index.mdx | 8 +- .../webhooks/push-notifications.mdx | 6 +- .../durable-execution.mdx | 10 +- .../http-sse.mdx | 12 +- .../agents-api.mdx => agent-class/index.mdx} | 54 ++++---- .../internals.mdx} | 8 +- .../protocol-messages.mdx | 16 +-- .../execution => agent-class}/queue-tasks.mdx | 16 +-- .../readonly-connections.mdx | 12 +- .../execution => agent-class}/retries.mdx | 8 +- .../communication => agent-class}/routing.mdx | 8 +- .../run-workflows.mdx | 6 +- .../schedule-tasks.mdx | 14 +-- .../lifecycle => agent-class}/state.mdx | 16 +-- .../execution => agent-class}/sub-agents.mdx | 12 +- .../using-ai-models.mdx | 10 +- .../websockets.mdx | 14 +-- .../agentic-patterns/human-in-the-loop.mdx | 2 +- .../agentic-patterns/long-running-agents.mdx | 32 ++--- .../docs/agents/concepts/calling-llms.mdx | 14 +-- .../conversation-state-and-memory.mdx | 4 +- src/content/docs/agents/concepts/tools.mdx | 6 +- .../docs/agents/concepts/what-are-agents.mdx | 4 +- .../docs/agents/concepts/workflows.mdx | 2 +- .../docs/agents/examples/browser-agent.mdx | 2 +- .../docs/agents/examples/chat-agent.mdx | 6 +- .../docs/agents/examples/email-agent.mdx | 6 +- .../docs/agents/examples/slack-agent.mdx | 2 +- .../docs/agents/examples/voice-agent.mdx | 6 +- src/content/docs/agents/harnesses/index.mdx | 8 +- .../docs/agents/harnesses/think/channels.mdx | 2 +- .../agents/harnesses/think/client-tools.mdx | 2 +- .../docs/agents/harnesses/think/index.mdx | 12 +- .../agents/harnesses/think/messengers.mdx | 2 +- .../docs/agents/harnesses/think/recovery.mdx | 6 +- .../docs/agents/harnesses/think/tools.mdx | 2 +- .../docs/agents/harnesses/think/workflows.mdx | 2 +- src/content/docs/agents/index.mdx | 6 +- .../model-context-protocol/apis/agent-api.mdx | 14 +-- .../apis/client-api.mdx | 12 +- .../guides/connect-mcp-client.mdx | 2 +- src/content/docs/agents/platform/limits.mdx | 2 +- .../agents/runtime/communication/index.mdx | 12 -- .../agents/runtime/execution/agent-skills.mdx | 2 +- .../runtime/lifecycle/get-current-agent.mdx | 6 +- .../agents/runtime/lifecycle/sessions.mdx | 4 +- .../runtime/operations/configuration.mdx | 8 +- .../cross-domain-authentication.mdx | 6 +- .../operations/observability/tracing.mdx | 2 +- src/content/docs/agents/tools/ai-search.mdx | 2 +- .../docs/agents/tools/codemode/browser.mdx | 2 +- src/content/docs/agents/tools/mcp.mdx | 2 +- src/content/docs/agents/tools/sandbox.mdx | 2 +- .../docs/ai-search/agent-sdks/agents-sdk.mdx | 2 +- .../human-in-the-loop-knowledge-base.mdx | 2 +- .../how-to/talk-to-your-knowledge-base.mdx | 8 +- .../docs/workers/demos/chatgpt-app.mdx | 2 +- .../workflows/get-started/durable-agents.mdx | 2 +- .../agents/common-integration-patterns.mdx | 2 +- src/content/partials/agents/next-steps.mdx | 20 +-- 83 files changed, 353 insertions(+), 334 deletions(-) rename src/content/docs/agents/{runtime/execution => agent-class}/agent-tools.mdx (99%) rename src/content/docs/agents/{runtime/lifecycle => agent-class}/callable-methods.mdx (99%) rename src/content/docs/agents/{runtime/communication => agent-class/communication-channels}/chat-sdk.mdx (100%) rename src/content/docs/agents/{ => agent-class}/communication-channels/chat/autonomous-responses.mdx (96%) rename src/content/docs/agents/{ => agent-class}/communication-channels/chat/chat-agents.mdx (99%) rename src/content/docs/agents/{ => agent-class}/communication-channels/chat/client-sdk.mdx (97%) rename src/content/docs/agents/{ => agent-class}/communication-channels/chat/index.mdx (100%) rename src/content/docs/agents/{ => agent-class}/communication-channels/email.mdx (100%) rename src/content/docs/agents/{ => agent-class}/communication-channels/index.mdx (95%) rename src/content/docs/agents/{ => agent-class}/communication-channels/slack.mdx (100%) rename src/content/docs/agents/{ => agent-class}/communication-channels/voice.mdx (100%) rename src/content/docs/agents/{ => agent-class}/communication-channels/webhooks/index.mdx (98%) rename src/content/docs/agents/{ => agent-class}/communication-channels/webhooks/push-notifications.mdx (98%) rename src/content/docs/agents/{runtime/execution => agent-class}/durable-execution.mdx (96%) rename src/content/docs/agents/{runtime/communication => agent-class}/http-sse.mdx (92%) rename src/content/docs/agents/{runtime/agents-api.mdx => agent-class/index.mdx} (84%) rename src/content/docs/agents/{runtime/lifecycle/agent-class.mdx => agent-class/internals.mdx} (97%) rename src/content/docs/agents/{runtime/communication => agent-class}/protocol-messages.mdx (89%) rename src/content/docs/agents/{runtime/execution => agent-class}/queue-tasks.mdx (94%) rename src/content/docs/agents/{runtime/communication => agent-class}/readonly-connections.mdx (97%) rename src/content/docs/agents/{runtime/execution => agent-class}/retries.mdx (98%) rename src/content/docs/agents/{runtime/communication => agent-class}/routing.mdx (99%) rename src/content/docs/agents/{runtime/execution => agent-class}/run-workflows.mdx (99%) rename src/content/docs/agents/{runtime/execution => agent-class}/schedule-tasks.mdx (98%) rename src/content/docs/agents/{runtime/lifecycle => agent-class}/state.mdx (95%) rename src/content/docs/agents/{runtime/execution => agent-class}/sub-agents.mdx (95%) rename src/content/docs/agents/{runtime/operations => agent-class}/using-ai-models.mdx (92%) rename src/content/docs/agents/{runtime/communication => agent-class}/websockets.mdx (97%) delete mode 100644 src/content/docs/agents/runtime/communication/index.mdx diff --git a/public/__redirects b/public/__redirects index 3a2dc01fa39..fae3f3de5b3 100644 --- a/public/__redirects +++ b/public/__redirects @@ -240,69 +240,98 @@ /aegis/analytics/ /smart-shield/configuration/dedicated-egress-ips/ips-utilization/ 301 # agents +/agents/communication-channels/ /agents/agent-class/communication-channels/ 301 +/agents/communication-channels/chat/ /agents/agent-class/communication-channels/chat/ 301 +/agents/communication-channels/chat/autonomous-responses/ /agents/agent-class/communication-channels/chat/autonomous-responses/ 301 +/agents/communication-channels/chat/chat-agents/ /agents/agent-class/communication-channels/chat/chat-agents/ 301 +/agents/communication-channels/chat/client-sdk/ /agents/agent-class/communication-channels/chat/client-sdk/ 301 +/agents/communication-channels/email/ /agents/agent-class/communication-channels/email/ 301 +/agents/communication-channels/slack/ /agents/agent-class/communication-channels/slack/ 301 +/agents/communication-channels/voice/ /agents/agent-class/communication-channels/voice/ 301 +/agents/communication-channels/webhooks/ /agents/agent-class/communication-channels/webhooks/ 301 +/agents/communication-channels/webhooks/push-notifications/ /agents/agent-class/communication-channels/webhooks/push-notifications/ 301 +/agents/runtime/agents-api/ /agents/agent-class/ 301 +/agents/runtime/communication/ /agents/agent-class/ 301 +/agents/runtime/communication/chat-sdk/ /agents/agent-class/communication-channels/chat-sdk/ 301 +/agents/runtime/communication/http-sse/ /agents/agent-class/http-sse/ 301 +/agents/runtime/communication/protocol-messages/ /agents/agent-class/protocol-messages/ 301 +/agents/runtime/communication/readonly-connections/ /agents/agent-class/readonly-connections/ 301 +/agents/runtime/communication/routing/ /agents/agent-class/routing/ 301 +/agents/runtime/communication/websockets/ /agents/agent-class/websockets/ 301 +/agents/runtime/execution/agent-tools/ /agents/agent-class/agent-tools/ 301 +/agents/runtime/execution/durable-execution/ /agents/agent-class/durable-execution/ 301 +/agents/runtime/execution/queue-tasks/ /agents/agent-class/queue-tasks/ 301 +/agents/runtime/execution/retries/ /agents/agent-class/retries/ 301 +/agents/runtime/execution/run-workflows/ /agents/agent-class/run-workflows/ 301 +/agents/runtime/execution/schedule-tasks/ /agents/agent-class/schedule-tasks/ 301 +/agents/runtime/execution/sub-agents/ /agents/agent-class/sub-agents/ 301 +/agents/runtime/lifecycle/agent-class/ /agents/agent-class/internals/ 301 +/agents/runtime/lifecycle/callable-methods/ /agents/agent-class/callable-methods/ 301 +/agents/runtime/lifecycle/state/ /agents/agent-class/state/ 301 +/agents/runtime/operations/using-ai-models/ /agents/agent-class/using-ai-models/ 301 /agents/api-reference/think/ /agents/harnesses/think/ 301 /agents/think/ /agents/harnesses/think/ 301 /agents/build/prompts/ /workers/get-started/prompting/ 301 /agents/getting-started/build-a-chat-agent/ /agents/examples/chat-agent/ 301 /agents/examples/browse-the-web/ /agents/tools/browser/ 301 -/agents/examples/manage-and-sync-state/ /agents/runtime/lifecycle/state/ 301 +/agents/examples/manage-and-sync-state/ /agents/agent-class/state/ 301 /agents/examples/rag/ /agents/tools/ai-search/ 301 /agents/tools/rag/ /agents/tools/ai-search/ 301 -/agents/examples/run-workflows/ /agents/runtime/execution/run-workflows/ 301 -/agents/examples/schedule-tasks/ /agents/runtime/execution/schedule-tasks/ 301 -/agents/examples/using-ai-models/ /agents/runtime/operations/using-ai-models/ 301 -/agents/examples/websockets/ /agents/runtime/communication/websockets/ 301 -/agents/examples/sdk/ /agents/runtime/agents-api/ 301 +/agents/examples/run-workflows/ /agents/agent-class/run-workflows/ 301 +/agents/examples/schedule-tasks/ /agents/agent-class/schedule-tasks/ 301 +/agents/examples/using-ai-models/ /agents/agent-class/using-ai-models/ 301 +/agents/examples/websockets/ /agents/agent-class/websockets/ 301 +/agents/examples/sdk/ /agents/agent-class/ 301 /agents/examples/build-mcp-server/ /agents/model-context-protocol/guides/remote-mcp-server/ 301 /agents/api-reference/build-mcp-server/ /agents/model-context-protocol/guides/remote-mcp-server/ 301 -/agents/api-reference/sdk/ /agents/runtime/agents-api/ 301 +/agents/api-reference/sdk/ /agents/agent-class/ 301 /agents/guides/build-mcp-server/ /agents/model-context-protocol/guides/remote-mcp-server/ 301 /agents/capabilities/mcp-server/ /agents/model-context-protocol/ 301 /agents/model-context-protocol/mcp-agent-api/ /agents/model-context-protocol/apis/agent-api/ 301 /agents/model-context-protocol/mcp-client-api/ /agents/model-context-protocol/apis/client-api/ 301 /agents/model-context-protocol/mcp-handler-api/ /agents/model-context-protocol/apis/handler-api/ 301 -/agents/api-reference/calling-agents/ /agents/runtime/communication/routing/ 301 +/agents/api-reference/calling-agents/ /agents/agent-class/routing/ 301 /agents/community-mcp-server/ /agents/model-context-protocol/cloudflare/servers-for-cloudflare/community-mcp-server/ 301 /agents/patterns/ /agents/concepts/agentic-patterns/ 301 /agents/concepts/patterns/ /agents/concepts/agentic-patterns/ 301 /agents/concepts/anthropic-agent-patterns/ /agents/concepts/agentic-patterns/ 301 /agents/concepts/human-in-the-loop/ /agents/concepts/agentic-patterns/human-in-the-loop/ 301 /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-api/ /agents/agent-class/ 301 /agents/api-reference/ /agents/runtime/ 301 -/agents/api-reference/chat-sdk/ /agents/runtime/communication/chat-sdk/ 301 -/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/chat-sdk/ /agents/agent-class/communication-channels/chat-sdk/ 301 +/agents/runtime/execution/chat-sdk/ /agents/agent-class/communication-channels/chat-sdk/ 301 +/agents/api-reference/agent-tools/ /agents/agent-class/agent-tools/ 301 /agents/api-reference/browse-the-web/ /agents/tools/browser/ 301 -/agents/api-reference/callable-methods/ /agents/runtime/lifecycle/callable-methods/ 301 -/agents/api-reference/chat-agents/ /agents/communication-channels/chat/chat-agents/ 301 -/agents/api-reference/client-sdk/ /agents/communication-channels/chat/client-sdk/ 301 +/agents/api-reference/callable-methods/ /agents/agent-class/callable-methods/ 301 +/agents/api-reference/chat-agents/ /agents/agent-class/communication-channels/chat/chat-agents/ 301 +/agents/api-reference/client-sdk/ /agents/agent-class/communication-channels/chat/client-sdk/ 301 /agents/api-reference/codemode/ /agents/tools/codemode/api-reference/ 301 /agents/api-reference/configuration/ /agents/runtime/operations/configuration/ 301 -/agents/api-reference/durable-execution/ /agents/runtime/execution/durable-execution/ 301 -/agents/api-reference/email/ /agents/communication-channels/email/ 301 +/agents/api-reference/durable-execution/ /agents/agent-class/durable-execution/ 301 +/agents/api-reference/email/ /agents/agent-class/communication-channels/email/ 301 /agents/api-reference/get-current-agent/ /agents/runtime/lifecycle/get-current-agent/ 301 -/agents/api-reference/http-sse/ /agents/runtime/communication/http-sse/ 301 +/agents/api-reference/http-sse/ /agents/agent-class/http-sse/ 301 /agents/api-reference/mcp-agent-api/ /agents/model-context-protocol/apis/agent-api/ 301 /agents/api-reference/mcp-client-api/ /agents/model-context-protocol/apis/client-api/ 301 /agents/api-reference/mcp-handler-api/ /agents/model-context-protocol/apis/handler-api/ 301 /agents/api-reference/observability/ /agents/runtime/operations/observability/ 301 -/agents/api-reference/protocol-messages/ /agents/runtime/communication/protocol-messages/ 301 -/agents/api-reference/queue-tasks/ /agents/runtime/execution/queue-tasks/ 301 +/agents/api-reference/protocol-messages/ /agents/agent-class/protocol-messages/ 301 +/agents/api-reference/queue-tasks/ /agents/agent-class/queue-tasks/ 301 /agents/api-reference/rag/ /agents/tools/ai-search/ 301 -/agents/api-reference/readonly-connections/ /agents/runtime/communication/readonly-connections/ 301 -/agents/api-reference/retries/ /agents/runtime/execution/retries/ 301 -/agents/api-reference/routing/ /agents/runtime/communication/routing/ 301 -/agents/api-reference/run-workflows/ /agents/runtime/execution/run-workflows/ 301 -/agents/api-reference/schedule-tasks/ /agents/runtime/execution/schedule-tasks/ 301 +/agents/api-reference/readonly-connections/ /agents/agent-class/readonly-connections/ 301 +/agents/api-reference/retries/ /agents/agent-class/retries/ 301 +/agents/api-reference/routing/ /agents/agent-class/routing/ 301 +/agents/api-reference/run-workflows/ /agents/agent-class/run-workflows/ 301 +/agents/api-reference/schedule-tasks/ /agents/agent-class/schedule-tasks/ 301 /agents/api-reference/sessions/ /agents/runtime/lifecycle/sessions/ 301 -/agents/api-reference/store-and-sync-state/ /agents/runtime/lifecycle/state/ 301 -/agents/api-reference/sub-agents/ /agents/runtime/execution/sub-agents/ 301 -/agents/api-reference/using-ai-models/ /agents/runtime/operations/using-ai-models/ 301 -/agents/api-reference/voice/ /agents/communication-channels/voice/ 301 -/agents/api-reference/websockets/ /agents/runtime/communication/websockets/ 301 +/agents/api-reference/store-and-sync-state/ /agents/agent-class/state/ 301 +/agents/api-reference/sub-agents/ /agents/agent-class/sub-agents/ 301 +/agents/api-reference/using-ai-models/ /agents/agent-class/using-ai-models/ 301 +/agents/api-reference/voice/ /agents/agent-class/communication-channels/voice/ 301 +/agents/api-reference/websockets/ /agents/agent-class/websockets/ 301 /agents/guides/anthropic-agent-patterns/ /agents/concepts/agentic-patterns/ 301 -/agents/guides/autonomous-responses/ /agents/communication-channels/chat/autonomous-responses/ 301 +/agents/guides/autonomous-responses/ /agents/agent-class/communication-channels/chat/autonomous-responses/ 301 /agents/guides/build-a-voice-agent/ /agents/examples/voice-agent/ 301 /agents/guides/build-mcp-client/ /agents/model-context-protocol/guides/build-mcp-client/ 301 /agents/guides/chatgpt-app/ /workers/demos/chatgpt-app/ 301 @@ -311,12 +340,12 @@ /agents/guides/cross-domain-authentication/ /agents/runtime/operations/cross-domain-authentication/ 301 /agents/guides/human-in-the-loop/ /agents/concepts/agentic-patterns/human-in-the-loop/ 301 /agents/guides/oauth-mcp-client/ /agents/model-context-protocol/guides/oauth-mcp-client/ 301 -/agents/guides/push-notifications/ /agents/communication-channels/webhooks/push-notifications/ 301 +/agents/guides/push-notifications/ /agents/agent-class/communication-channels/webhooks/push-notifications/ 301 /agents/guides/remote-mcp-server/ /agents/model-context-protocol/guides/remote-mcp-server/ 301 /agents/guides/securing-mcp-server/ /agents/model-context-protocol/guides/securing-mcp-server/ 301 /agents/guides/slack-agent/ /agents/examples/slack-agent/ 301 /agents/guides/test-remote-mcp-server/ /agents/model-context-protocol/guides/test-remote-mcp-server/ 301 -/agents/guides/webhooks/ /agents/communication-channels/webhooks/ 301 +/agents/guides/webhooks/ /agents/agent-class/communication-channels/webhooks/ 301 /agents/model-context-protocol/authorization/ /agents/model-context-protocol/protocol/authorization/ 301 /agents/model-context-protocol/protocol/codemode/ /agents/tools/codemode/ 301 /agents/model-context-protocol/codemode/ /agents/model-context-protocol/guides/build-codemode-mcp-server/ 301 @@ -335,23 +364,23 @@ /agents/agentic-payments/x402/pay-with-tool-plugins/ /agents/tools/payments/x402/pay-with-tool-plugins/ 301 /agents/agentic-payments/mpp/ /agents/tools/payments/mpp/ 301 /agents/guides/ /agents/model-context-protocol/guides/ 301 -/agents/concepts/agent-class/ /agents/runtime/lifecycle/agent-class/ 301 +/agents/concepts/agent-class/ /agents/agent-class/internals/ 301 /agents/concepts/memory/ /agents/concepts/conversation-state-and-memory/ 301 /agents/getting-started/prompting/ /workers/get-started/prompting/ 301 /agents/platform/prompting/ /workers/get-started/prompting/ 301 /agents/platform/prompt.txt/ /workers/prompt.txt 301 -/agents/channels/chat/ /agents/communication-channels/chat/ 301 -/agents/channels/chat/chat-agents/ /agents/communication-channels/chat/chat-agents/ 301 -/agents/channels/chat/client-sdk/ /agents/communication-channels/chat/client-sdk/ 301 -/agents/channels/chat/autonomous-responses/ /agents/communication-channels/chat/autonomous-responses/ 301 +/agents/channels/chat/ /agents/agent-class/communication-channels/chat/ 301 +/agents/channels/chat/chat-agents/ /agents/agent-class/communication-channels/chat/chat-agents/ 301 +/agents/channels/chat/client-sdk/ /agents/agent-class/communication-channels/chat/client-sdk/ 301 +/agents/channels/chat/autonomous-responses/ /agents/agent-class/communication-channels/chat/autonomous-responses/ 301 /agents/channels/chat/chatgpt-app/ /workers/demos/chatgpt-app/ 301 -/agents/channels/voice/ /agents/communication-channels/voice/ 301 +/agents/channels/voice/ /agents/agent-class/communication-channels/voice/ 301 /agents/channels/voice/build-a-voice-agent/ /agents/examples/voice-agent/ 301 -/agents/channels/email/ /agents/communication-channels/email/ 301 -/agents/channels/slack/ /agents/communication-channels/slack/ 301 +/agents/channels/email/ /agents/agent-class/communication-channels/email/ 301 +/agents/channels/slack/ /agents/agent-class/communication-channels/slack/ 301 /agents/channels/slack/slack-agent/ /agents/examples/slack-agent/ 301 -/agents/channels/webhooks/ /agents/communication-channels/webhooks/ 301 -/agents/channels/webhooks/push-notifications/ /agents/communication-channels/webhooks/push-notifications/ 301 +/agents/channels/webhooks/ /agents/agent-class/communication-channels/webhooks/ 301 +/agents/channels/webhooks/push-notifications/ /agents/agent-class/communication-channels/webhooks/push-notifications/ 301 /agents/communication-channels/voice/build-a-voice-agent/ /agents/examples/voice-agent/ 301 /agents/communication-channels/slack/slack-agent/ /agents/examples/slack-agent/ 301 /agents/tools/browser/browse-the-web/ /agents/tools/browser/ 301 diff --git a/src/components/cf/AgentsPlatformDiagram.astro b/src/components/cf/AgentsPlatformDiagram.astro index c8a45711807..44394f8359f 100644 --- a/src/components/cf/AgentsPlatformDiagram.astro +++ b/src/components/cf/AgentsPlatformDiagram.astro @@ -3,37 +3,37 @@ const channels = [ { type: "Chat", name: "AIChatAgent", - href: "/agents/communication-channels/chat/", + href: "/agents/agent-class/communication-channels/chat/", }, { type: "Email", name: "onEmail", - href: "/agents/communication-channels/email/", + href: "/agents/agent-class/communication-channels/email/", }, { type: "Voice", name: "withVoice", - href: "/agents/communication-channels/voice/", + href: "/agents/agent-class/communication-channels/voice/", }, { type: "Slack", name: "Events", - href: "/agents/communication-channels/slack/", + href: "/agents/agent-class/communication-channels/slack/", }, { type: "Webhook", name: "HTTP", - href: "/agents/communication-channels/webhooks/", + href: "/agents/agent-class/communication-channels/webhooks/", }, ]; const runtime = [ - { label: "State", href: "/agents/runtime/lifecycle/state/" }, + { label: "State", href: "/agents/agent-class/state/" }, { label: "Sessions", href: "/agents/runtime/lifecycle/sessions/" }, - { label: "Routing", href: "/agents/runtime/communication/routing/" }, - { label: "WebSockets", href: "/agents/runtime/communication/websockets/" }, - { label: "Scheduling", href: "/agents/runtime/execution/schedule-tasks/" }, - { label: "Fibers", href: "/agents/runtime/execution/durable-execution/" }, + { label: "Routing", href: "/agents/agent-class/routing/" }, + { label: "WebSockets", href: "/agents/agent-class/websockets/" }, + { label: "Scheduling", href: "/agents/agent-class/schedule-tasks/" }, + { label: "Fibers", href: "/agents/agent-class/durable-execution/" }, ]; const tools = [ @@ -95,7 +95,7 @@ const tools = [
Pi harness - Build-your-own agent + Build-your-own agent
@@ -106,7 +106,7 @@ const tools = [ Durable identity, state, connections, scheduling, and recovery.

- + Agent class
diff --git a/src/content/changelog/agents/2025-03-18-npm-i-agents.mdx b/src/content/changelog/agents/2025-03-18-npm-i-agents.mdx index eaead553cf1..3bd3242dead 100644 --- a/src/content/changelog/agents/2025-03-18-npm-i-agents.mdx +++ b/src/content/changelog/agents/2025-03-18-npm-i-agents.mdx @@ -67,7 +67,7 @@ export default { #### Call Agent methods from your client code -We've added a new [`@unstable_callable()`](/agents/runtime/agents-api/) decorator for defining methods that can be called directly from clients. This allows you call methods from within your client code: you can call methods (with arguments) and get native JavaScript objects back. +We've added a new [`@unstable_callable()`](/agents/agent-class/) decorator for defining methods that can be called directly from clients. This allows you call methods from within your client code: you can call methods (with arguments) and get native JavaScript objects back. @@ -127,8 +127,8 @@ You can use the starter as a template for your own Agents projects: open up `src We've heard your feedback on the Agents SDK documentation, and we're shipping more API reference material and usage examples, including: - Expanded [API reference documentation](/agents/runtime/), covering the methods and properties exposed by the Agents SDK, as well as more usage examples. -- More [Client API](/agents/runtime/agents-api/#client-api) documentation that documents `useAgent`, `useAgentChat` and the new `@unstable_callable` RPC decorator exposed by the SDK. -- New documentation on how to [route requests to agents](/agents/runtime/communication/routing/) and (optionally) authenticate clients before they connect to your Agents. +- More [Client API](/agents/agent-class/#client-api) documentation that documents `useAgent`, `useAgentChat` and the new `@unstable_callable` RPC decorator exposed by the SDK. +- New documentation on how to [route requests to agents](/agents/agent-class/routing/) and (optionally) authenticate clients before they connect to your Agents. Note that the Agents SDK is continually growing: the type definitions included in the SDK will always include the latest APIs exposed by the `agents` package. diff --git a/src/content/changelog/agents/2025-04-07-mcp-servers-agents-sdk-updates.mdx b/src/content/changelog/agents/2025-04-07-mcp-servers-agents-sdk-updates.mdx index d2c50c347ac..1ef97d617d7 100644 --- a/src/content/changelog/agents/2025-04-07-mcp-servers-agents-sdk-updates.mdx +++ b/src/content/changelog/agents/2025-04-07-mcp-servers-agents-sdk-updates.mdx @@ -52,7 +52,7 @@ We've made a number of improvements to the [Agents SDK](/agents/), including: - Support for building MCP servers with the new `MCPAgent` class. - The ability to export the current agent, request and WebSocket connection context using `import { context } from "agents"`, allowing you to minimize or avoid direct dependency injection when calling tools. - Fixed a bug that prevented query parameters from being sent to the Agent server from the `useAgent` React hook. -- Automatically converting the `agent` name in `useAgent` or `useAgentChat` to kebab-case to ensure it matches the naming convention expected by [`routeAgentRequest`](/agents/runtime/communication/routing/). +- Automatically converting the `agent` name in `useAgent` or `useAgentChat` to kebab-case to ensure it matches the naming convention expected by [`routeAgentRequest`](/agents/agent-class/routing/). To install or update the Agents SDK, run `npm i agents@latest` in an existing project, or explore the `agents-starter` project: diff --git a/src/content/changelog/agents/2025-11-26-agents-resumable-streaming.mdx b/src/content/changelog/agents/2025-11-26-agents-resumable-streaming.mdx index 2416eca0da8..560b2eeac6d 100644 --- a/src/content/changelog/agents/2025-11-26-agents-resumable-streaming.mdx +++ b/src/content/changelog/agents/2025-11-26-agents-resumable-streaming.mdx @@ -24,7 +24,7 @@ Streams are maintained across page refreshes, broken connections, and syncing ac ### Other improvements - Default JSON schema validator added to MCP client -- [Schedules](https://developers.cloudflare.com/agents/runtime/execution/schedule-tasks/) can now safely destroy the agent +- [Schedules](https://developers.cloudflare.com/agents/agent-class/schedule-tasks/) can now safely destroy the agent ### MCP client API improvements @@ -60,7 +60,7 @@ MCP discovery fetches the available tools, prompts, and resources from an MCP se ### Bug fixes -- Fixed a bug where [schedules](https://developers.cloudflare.com/agents/runtime/execution/schedule-tasks/) meant to fire immediately with this.schedule(0, ...) or `this.schedule(new Date(), ...)` would not fire +- Fixed a bug where [schedules](https://developers.cloudflare.com/agents/agent-class/schedule-tasks/) meant to fire immediately with this.schedule(0, ...) or `this.schedule(new Date(), ...)` would not fire - Fixed an issue where schedules that took longer than 30 seconds would occasionally time out - Fixed SSE transport now properly forwards session IDs and request headers - Fixed AI SDK stream events conversion to UIMessageStreamPart diff --git a/src/content/changelog/agents/2026-02-03-agents-workflows-integration.mdx b/src/content/changelog/agents/2026-02-03-agents-workflows-integration.mdx index 501893ccad7..7fd6157f3c0 100644 --- a/src/content/changelog/agents/2026-02-03-agents-workflows-integration.mdx +++ b/src/content/changelog/agents/2026-02-03-agents-workflows-integration.mdx @@ -175,4 +175,4 @@ To update to the latest version: npm i agents@latest ``` -For the complete Workflows API reference and patterns, see [Run Workflows](/agents/runtime/execution/run-workflows/). +For the complete Workflows API reference and patterns, see [Run Workflows](/agents/agent-class/run-workflows/). diff --git a/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx index 8ecfba40a59..01093055962 100644 --- a/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx +++ b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx @@ -73,7 +73,7 @@ class MyAgent extends Agent { Connections with protocol messages disabled still fully participate in RPC and regular messaging. Use `isConnectionProtocolEnabled(connection)` to check a connection's status at any time. The flag persists across Durable Object hibernation. -See [Protocol messages](/agents/runtime/communication/protocol-messages/) for full documentation. +See [Protocol messages](/agents/agent-class/protocol-messages/) for full documentation. ## `@cloudflare/ai-chat` v0.1.0 @@ -81,7 +81,7 @@ The first stable release of `@cloudflare/ai-chat` ships alongside this release w Key new features: -- **Data parts** — Attach typed JSON blobs (`data-*`) to messages alongside text. Supports reconciliation (type+id updates in-place), append, and transient parts (ephemeral via `onData` callback). See [Data parts](/agents/communication-channels/chat/chat-agents/#data-parts). +- **Data parts** — Attach typed JSON blobs (`data-*`) to messages alongside text. Supports reconciliation (type+id updates in-place), append, and transient parts (ephemeral via `onData` callback). See [Data parts](/agents/agent-class/communication-channels/chat/chat-agents/#data-parts). - **Tool approval persistence** — The `needsApproval` approval UI now survives page refresh and DO hibernation. The streaming message is persisted to SQLite when a tool enters `approval-requested` state. - **`maxPersistedMessages`** — Cap SQLite message storage with automatic oldest-message deletion. - **`body` option on `useAgentChat`** — Send custom data with every request (static or dynamic). diff --git a/src/content/changelog/agents/2026-03-02-agents-sdk-v0.7.0.mdx b/src/content/changelog/agents/2026-03-02-agents-sdk-v0.7.0.mdx index 1f34c6070b5..0c4750f999a 100644 --- a/src/content/changelog/agents/2026-03-02-agents-sdk-v0.7.0.mdx +++ b/src/content/changelog/agents/2026-03-02-agents-sdk-v0.7.0.mdx @@ -117,7 +117,7 @@ Key details: `keepAlive()` is marked `@experimental` and may change between releases. ::: -For the full API reference and when-to-use guidance, refer to [Schedule tasks — Keeping the agent alive](/agents/runtime/execution/schedule-tasks/#keeping-the-agent-alive). +For the full API reference and when-to-use guidance, refer to [Schedule tasks — Keeping the agent alive](/agents/agent-class/schedule-tasks/#keeping-the-agent-alive). ## `waitForMcpConnections` diff --git a/src/content/changelog/agents/2026-05-13-agents-sdk-v0.12.4.mdx b/src/content/changelog/agents/2026-05-13-agents-sdk-v0.12.4.mdx index 7e7d969103c..6af6f993359 100644 --- a/src/content/changelog/agents/2026-05-13-agents-sdk-v0.12.4.mdx +++ b/src/content/changelog/agents/2026-05-13-agents-sdk-v0.12.4.mdx @@ -125,4 +125,4 @@ To update to the latest version: npm i agents@latest @cloudflare/ai-chat@latest @cloudflare/think@latest @cloudflare/voice@latest ``` -Refer to the [Agents API reference](/agents/runtime/) and [Chat agents documentation](/agents/communication-channels/chat/chat-agents/) for more information. +Refer to the [Agents API reference](/agents/runtime/) and [Chat agents documentation](/agents/agent-class/communication-channels/chat/chat-agents/) for more information. diff --git a/src/content/changelog/agents/2026-06-02-agents-sdk-v0.14.0.mdx b/src/content/changelog/agents/2026-06-02-agents-sdk-v0.14.0.mdx index 55a22f00a9d..78abe7f2913 100644 --- a/src/content/changelog/agents/2026-06-02-agents-sdk-v0.14.0.mdx +++ b/src/content/changelog/agents/2026-06-02-agents-sdk-v0.14.0.mdx @@ -160,4 +160,4 @@ To update to the latest version: -Refer to the [Agents API reference](/agents/runtime/) and [Chat agents documentation](/agents/communication-channels/chat/chat-agents/) for more information. +Refer to the [Agents API reference](/agents/runtime/) and [Chat agents documentation](/agents/agent-class/communication-channels/chat/chat-agents/) for more information. diff --git a/src/content/changelog/agents/2026-06-16-agents-sdk-v0.16.1.mdx b/src/content/changelog/agents/2026-06-16-agents-sdk-v0.16.1.mdx index daf03a0d6d5..3de364dca52 100644 --- a/src/content/changelog/agents/2026-06-16-agents-sdk-v0.16.1.mdx +++ b/src/content/changelog/agents/2026-06-16-agents-sdk-v0.16.1.mdx @@ -119,4 +119,4 @@ To update to the latest version: -Refer to the [Code Mode documentation](/agents/tools/codemode/), [Browser tools documentation](/agents/tools/browser/), [Think tools documentation](/agents/harnesses/think/tools/), and [Voice documentation](/agents/communication-channels/voice/) for more information. +Refer to the [Code Mode documentation](/agents/tools/codemode/), [Browser tools documentation](/agents/tools/browser/), [Think tools documentation](/agents/harnesses/think/tools/), and [Voice documentation](/agents/agent-class/communication-channels/voice/) for more information. diff --git a/src/content/changelog/agents/2026-09-11-voice-diagnostics-turn-metrics.mdx b/src/content/changelog/agents/2026-09-11-voice-diagnostics-turn-metrics.mdx index 57b60631e2b..01946d4df05 100644 --- a/src/content/changelog/agents/2026-09-11-voice-diagnostics-turn-metrics.mdx +++ b/src/content/changelog/agents/2026-09-11-voice-diagnostics-turn-metrics.mdx @@ -69,4 +69,4 @@ Install the release with a compatible Agents SDK version: -Refer to the [Voice pipeline metrics](/agents/communication-channels/voice/#pipeline-metrics) and [Voice Agent example](https://github.com/cloudflare/agents/tree/main/examples/voice-agent) to get started. +Refer to the [Voice pipeline metrics](/agents/agent-class/communication-channels/voice/#pipeline-metrics) and [Voice Agent example](https://github.com/cloudflare/agents/tree/main/examples/voice-agent) to get started. diff --git a/src/content/docs/agents/runtime/execution/agent-tools.mdx b/src/content/docs/agents/agent-class/agent-tools.mdx similarity index 99% rename from src/content/docs/agents/runtime/execution/agent-tools.mdx rename to src/content/docs/agents/agent-class/agent-tools.mdx index 05fefda79f8..a60435e0d39 100644 --- a/src/content/docs/agents/runtime/execution/agent-tools.mdx +++ b/src/content/docs/agents/agent-class/agent-tools.mdx @@ -3,7 +3,7 @@ title: Agents as tools description: Run Think and AIChatAgent sub-agents as retained, streaming tools from a parent agent. pcx_content_type: reference sidebar: - order: 16 + order: 15 products: - agents --- @@ -510,12 +510,12 @@ Raw `diagnostics_channel` subscribers should use the channel name `agents:agent_ diff --git a/src/content/docs/agents/runtime/lifecycle/callable-methods.mdx b/src/content/docs/agents/agent-class/callable-methods.mdx similarity index 99% rename from src/content/docs/agents/runtime/lifecycle/callable-methods.mdx rename to src/content/docs/agents/agent-class/callable-methods.mdx index 4a398a7706a..a4037002264 100644 --- a/src/content/docs/agents/runtime/lifecycle/callable-methods.mdx +++ b/src/content/docs/agents/agent-class/callable-methods.mdx @@ -3,7 +3,7 @@ title: Callable methods description: Expose Agent methods to external clients over WebSocket RPC using the @callable() decorator. pcx_content_type: concept sidebar: - order: 6 + order: 3 products: - agents --- @@ -743,18 +743,18 @@ Do not set `"experimentalDecorators": true` in your `tsconfig.json`. The Agents diff --git a/src/content/docs/agents/runtime/communication/chat-sdk.mdx b/src/content/docs/agents/agent-class/communication-channels/chat-sdk.mdx similarity index 100% rename from src/content/docs/agents/runtime/communication/chat-sdk.mdx rename to src/content/docs/agents/agent-class/communication-channels/chat-sdk.mdx diff --git a/src/content/docs/agents/communication-channels/chat/autonomous-responses.mdx b/src/content/docs/agents/agent-class/communication-channels/chat/autonomous-responses.mdx similarity index 96% rename from src/content/docs/agents/communication-channels/chat/autonomous-responses.mdx rename to src/content/docs/agents/agent-class/communication-channels/chat/autonomous-responses.mdx index 69eef060c82..52768f99752 100644 --- a/src/content/docs/agents/communication-channels/chat/autonomous-responses.mdx +++ b/src/content/docs/agents/agent-class/communication-channels/chat/autonomous-responses.mdx @@ -66,7 +66,7 @@ return Response.json({ `submitMessages()` stores pending work first and appends the messages to the conversation Session only when the submission starts executing. It accepts serializable `UIMessage[]` values, not the function form supported by `saveMessages((messages) => ...)`. -Use [`startFiber()`](/agents/runtime/execution/durable-execution/#startfiber) outside Think when the durable unit is a surrounding application job, such as accepting a webhook once, restoring provider state, posting a visible reply, and recording recovery policy. `submitMessages()` owns Think's conversation admission; managed fibers own external side effects around that turn. +Use [`startFiber()`](/agents/agent-class/durable-execution/#startfiber) outside Think when the durable unit is a surrounding application job, such as accepting a webhook once, restoring provider state, posting a visible reply, and recording recovery policy. `submitMessages()` owns Think's conversation admission; managed fibers own external side effects around that turn. For the full Think API, refer to [`submitMessages()`](/agents/harnesses/think/programmatic-submissions/#submitmessages). ### When to use `saveMessages` vs `onChatResponse` @@ -152,7 +152,7 @@ export class DigestAgent extends AIChatAgent { -The function form of `saveMessages` — `saveMessages((messages) => [...])` — reads the latest persisted messages at execution time. This avoids stale baselines when multiple calls queue up (for example, rapid webhook arrivals). Refer to [Schedule tasks](/agents/runtime/execution/schedule-tasks/) for more on `schedule()` and cron syntax. +The function form of `saveMessages` — `saveMessages((messages) => [...])` — reads the latest persisted messages at execution time. This avoids stale baselines when multiple calls queue up (for example, rapid webhook arrivals). Refer to [Schedule tasks](/agents/agent-class/schedule-tasks/) for more on `schedule()` and cron syntax. ### Processing a queue @@ -528,24 +528,24 @@ Use `cancelFiber(fiberId)` when the durable unit was accepted with `startFiber() diff --git a/src/content/docs/agents/communication-channels/chat/chat-agents.mdx b/src/content/docs/agents/agent-class/communication-channels/chat/chat-agents.mdx similarity index 99% rename from src/content/docs/agents/communication-channels/chat/chat-agents.mdx rename to src/content/docs/agents/agent-class/communication-channels/chat/chat-agents.mdx index 9d7cb6d392c..7484f56c58b 100644 --- a/src/content/docs/agents/communication-channels/chat/chat-agents.mdx +++ b/src/content/docs/agents/agent-class/communication-channels/chat/chat-agents.mdx @@ -579,7 +579,7 @@ Use `abortRequest()` when you know the request ID. Use `abortAllRequests()` for Automatic stream resumption (the `resume` option on `useAgentChat`) is **client reconnect recovery** — it resumes an active stream when a client disconnects and reconnects. It does not cover Durable Object eviction. If the Worker process or Durable Object is evicted while the model call is in flight, the stream itself is gone. Durable chat recovery handles that case. -A mid-stream Durable Object eviction permanently severs the LLM connection. Durable recovery wraps every `AIChatAgent` and [`Think`](/agents/harnesses/think/) chat turn in a [`runFiber()`](/agents/runtime/execution/durable-execution/). The fiber provides automatic `keepAlive` during streaming and a recovery hook on restart. +A mid-stream Durable Object eviction permanently severs the LLM connection. Durable recovery wraps every `AIChatAgent` and [`Think`](/agents/harnesses/think/) chat turn in a [`runFiber()`](/agents/agent-class/durable-execution/). The fiber provides automatic `keepAlive` during streaming and a recovery hook on restart. The fiber row survives in SQLite after an eviction. On the next activation, the framework detects the interrupted fiber. It reconstructs the partial response from buffered stream chunks and calls `onChatRecovery`. @@ -833,7 +833,7 @@ While a turn is being recovered, the agent broadcasts a `cf_agent_chat_recoverin Transcript repairs — healing orphaned tool calls (preserved as errored results rather than deleted, so the record survives and the model does not silently re-run the tool) and normalizing malformed or missing tool inputs before a provider call — are emitted on the `transcript` observability channel. -For how chat recovery fits into the broader long-running agents story, refer to [Long-running agents: Recovering interrupted LLM streams](/agents/concepts/agentic-patterns/long-running-agents/#recovering-interrupted-llm-streams). For the underlying fiber API, refer to [Durable Execution](/agents/runtime/execution/durable-execution/). +For how chat recovery fits into the broader long-running agents story, refer to [Long-running agents: Recovering interrupted LLM streams](/agents/concepts/agentic-patterns/long-running-agents/#recovering-interrupted-llm-streams). For the underlying fiber API, refer to [Durable Execution](/agents/agent-class/durable-execution/). ## Client API @@ -1616,7 +1616,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 [Agents as 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/agent-class/sub-agents/). To run Think or `AIChatAgent` sub-agents as retained, streaming tools, refer to [Agents as tools](/agents/agent-class/agent-tools/). ::: @@ -1778,7 +1778,7 @@ If you are upgrading from an earlier version, replace deprecated calls with thei @@ -1796,7 +1796,7 @@ If you are upgrading from an earlier version, replace deprecated calls with thei diff --git a/src/content/docs/agents/communication-channels/chat/client-sdk.mdx b/src/content/docs/agents/agent-class/communication-channels/chat/client-sdk.mdx similarity index 97% rename from src/content/docs/agents/communication-channels/chat/client-sdk.mdx rename to src/content/docs/agents/agent-class/communication-channels/chat/client-sdk.mdx index e061391c6b6..32340fabe03 100644 --- a/src/content/docs/agents/communication-channels/chat/client-sdk.mdx +++ b/src/content/docs/agents/agent-class/communication-channels/chat/client-sdk.mdx @@ -638,11 +638,11 @@ const transport = new WebSocketChatTransport({ -Refer to [Non-React clients](/agents/communication-channels/chat/chat-agents/#non-react-clients) for the behaviors this transport does and does not cover. +Refer to [Non-React clients](/agents/agent-class/communication-channels/chat/chat-agents/#non-react-clients) for the behaviors this transport does and does not cover. ## Agent-tool events -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. +If your chat UI renders retained child runs from [Agents as tools](/agents/agent-class/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. @@ -661,13 +661,13 @@ const agentTools = useAgentToolEvents({ agent }); diff --git a/src/content/docs/agents/communication-channels/chat/index.mdx b/src/content/docs/agents/agent-class/communication-channels/chat/index.mdx similarity index 100% rename from src/content/docs/agents/communication-channels/chat/index.mdx rename to src/content/docs/agents/agent-class/communication-channels/chat/index.mdx diff --git a/src/content/docs/agents/communication-channels/email.mdx b/src/content/docs/agents/agent-class/communication-channels/email.mdx similarity index 100% rename from src/content/docs/agents/communication-channels/email.mdx rename to src/content/docs/agents/agent-class/communication-channels/email.mdx diff --git a/src/content/docs/agents/communication-channels/index.mdx b/src/content/docs/agents/agent-class/communication-channels/index.mdx similarity index 95% rename from src/content/docs/agents/communication-channels/index.mdx rename to src/content/docs/agents/agent-class/communication-channels/index.mdx index 935c15443eb..c90e2973369 100644 --- a/src/content/docs/agents/communication-channels/index.mdx +++ b/src/content/docs/agents/agent-class/communication-channels/index.mdx @@ -2,7 +2,7 @@ title: Communication channels pcx_content_type: navigation sidebar: - order: 3 + order: 20 group: hideIndex: true --- diff --git a/src/content/docs/agents/communication-channels/slack.mdx b/src/content/docs/agents/agent-class/communication-channels/slack.mdx similarity index 100% rename from src/content/docs/agents/communication-channels/slack.mdx rename to src/content/docs/agents/agent-class/communication-channels/slack.mdx diff --git a/src/content/docs/agents/communication-channels/voice.mdx b/src/content/docs/agents/agent-class/communication-channels/voice.mdx similarity index 100% rename from src/content/docs/agents/communication-channels/voice.mdx rename to src/content/docs/agents/agent-class/communication-channels/voice.mdx diff --git a/src/content/docs/agents/communication-channels/webhooks/index.mdx b/src/content/docs/agents/agent-class/communication-channels/webhooks/index.mdx similarity index 98% rename from src/content/docs/agents/communication-channels/webhooks/index.mdx rename to src/content/docs/agents/agent-class/communication-channels/webhooks/index.mdx index ca43097d33f..794a82189bb 100644 --- a/src/content/docs/agents/communication-channels/webhooks/index.mdx +++ b/src/content/docs/agents/agent-class/communication-channels/webhooks/index.mdx @@ -518,7 +518,7 @@ return Response.json( -If the webhook owns application side effects around a turn, such as restoring a provider thread and posting a visible reply, use [`startFiber()`](/agents/runtime/execution/durable-execution/#startfiber) around that job. Managed fibers retain status, dedupe provider retries, and let `onFiberRecovered()` or `resolveFiber()` record the app-level recovery outcome. +If the webhook owns application side effects around a turn, such as restoring a provider thread and posting a visible reply, use [`startFiber()`](/agents/agent-class/durable-execution/#startfiber) around that job. Managed fibers retain status, dedupe provider retries, and let `onFiberRecovered()` or `resolveFiber()` record the app-level recovery outcome. ### Multi-provider routing @@ -647,18 +647,18 @@ const secret = this.env.GITHUB_WEBHOOK_SECRET; diff --git a/src/content/docs/agents/communication-channels/webhooks/push-notifications.mdx b/src/content/docs/agents/agent-class/communication-channels/webhooks/push-notifications.mdx similarity index 98% rename from src/content/docs/agents/communication-channels/webhooks/push-notifications.mdx rename to src/content/docs/agents/agent-class/communication-channels/webhooks/push-notifications.mdx index 30fd5bad7ab..5b79b0a329d 100644 --- a/src/content/docs/agents/communication-channels/webhooks/push-notifications.mdx +++ b/src/content/docs/agents/agent-class/communication-channels/webhooks/push-notifications.mdx @@ -405,18 +405,18 @@ try { diff --git a/src/content/docs/agents/runtime/execution/durable-execution.mdx b/src/content/docs/agents/agent-class/durable-execution.mdx similarity index 96% rename from src/content/docs/agents/runtime/execution/durable-execution.mdx rename to src/content/docs/agents/agent-class/durable-execution.mdx index ee2ca4213a0..5d93b1eff4c 100644 --- a/src/content/docs/agents/runtime/execution/durable-execution.mdx +++ b/src/content/docs/agents/agent-class/durable-execution.mdx @@ -60,7 +60,7 @@ When eviction happens mid-work, the upstream HTTP connection (to an LLM provider `keepAlive()` reduces the chance of eviction. `runFiber()` makes eviction survivable. -For work that should run independently of the agent with per-step retries and multi-step orchestration, use [Workflows](/agents/runtime/execution/run-workflows/) instead. Fibers are for work that is part of the agent's own execution. Refer to [Long-running agents: Workflows vs agent-internal patterns](/agents/concepts/agentic-patterns/long-running-agents/#when-to-use-workflows-vs-agent-internal-patterns) for a comparison. +For work that should run independently of the agent with per-step retries and multi-step orchestration, use [Workflows](/agents/agent-class/run-workflows/) instead. Fibers are for work that is part of the agent's own execution. Refer to [Long-running agents: Workflows vs agent-internal patterns](/agents/concepts/agentic-patterns/long-running-agents/#when-to-use-workflows-vs-agent-internal-patterns) for a comparison. ## keepAlive @@ -495,7 +495,7 @@ Run an async function while keeping the DO alive. Heartbeat starts before `fn` a ## Related - [Long-running agents](/agents/concepts/agentic-patterns/long-running-agents/) — how fibers compose with schedules, plans, and async operations -- [Schedule tasks](/agents/runtime/execution/schedule-tasks/) — `keepAlive` details and the alarm system -- [Sub-agents](/agents/runtime/execution/sub-agents/) — durable execution and schedules inside sub-agents -- [Workflows](/agents/runtime/execution/run-workflows/) — durable multi-step execution outside the agent -- [Chat agents](/agents/communication-channels/chat/chat-agents/) — `chatRecovery` and `onChatRecovery` +- [Schedule tasks](/agents/agent-class/schedule-tasks/) — `keepAlive` details and the alarm system +- [Sub-agents](/agents/agent-class/sub-agents/) — durable execution and schedules inside sub-agents +- [Workflows](/agents/agent-class/run-workflows/) — durable multi-step execution outside the agent +- [Chat agents](/agents/agent-class/communication-channels/chat/chat-agents/) — `chatRecovery` and `onChatRecovery` diff --git a/src/content/docs/agents/runtime/communication/http-sse.mdx b/src/content/docs/agents/agent-class/http-sse.mdx similarity index 92% rename from src/content/docs/agents/runtime/communication/http-sse.mdx rename to src/content/docs/agents/agent-class/http-sse.mdx index 860023ce43c..f8a8daf0ced 100644 --- a/src/content/docs/agents/runtime/communication/http-sse.mdx +++ b/src/content/docs/agents/agent-class/http-sse.mdx @@ -3,7 +3,7 @@ title: HTTP and Server-Sent Events description: Handle HTTP requests and stream responses with Server-Sent Events (SSE) from Cloudflare Agents. pcx_content_type: reference sidebar: - order: 9 + order: 5 products: - agents --- @@ -146,8 +146,8 @@ export class ChatAgent extends Agent { SSE connections can be long-lived. Handle client disconnects gracefully: -- **Persist progress** — Write to [agent state](/agents/runtime/lifecycle/state/) so clients can resume -- **Use agent routing** — Clients can [reconnect to the same agent instance](/agents/runtime/communication/routing/) without session stores +- **Persist progress** — Write to [agent state](/agents/agent-class/state/) so clients can resume +- **Use agent routing** — Clients can [reconnect to the same agent instance](/agents/agent-class/routing/) without session stores - **No timeout limits** — Cloudflare Workers have no effective limit on SSE response duration @@ -190,19 +190,19 @@ export class ResumeAgent extends Agent { **Recommendation:** Use WebSockets for interactive applications. Use SSE for streaming AI responses or server-push notifications. -Refer to [WebSockets](/agents/runtime/communication/websockets/) for WebSocket documentation. +Refer to [WebSockets](/agents/agent-class/websockets/) for WebSocket documentation. ## Next steps diff --git a/src/content/docs/agents/runtime/agents-api.mdx b/src/content/docs/agents/agent-class/index.mdx similarity index 84% rename from src/content/docs/agents/runtime/agents-api.mdx rename to src/content/docs/agents/agent-class/index.mdx index bede1c78b73..bf96338ed85 100644 --- a/src/content/docs/agents/runtime/agents-api.mdx +++ b/src/content/docs/agents/agent-class/index.mdx @@ -1,9 +1,11 @@ --- -title: Agents API -description: Reference for the Agent base class, lifecycle hooks, SQL storage, and error handling in the Agents SDK. +title: Agent class +description: Reference for the Agent base class, its hooks, SQL storage, and error handling in the Agents SDK. pcx_content_type: reference sidebar: - order: 1 + order: 8 + group: + hideIndex: false products: - agents --- @@ -65,7 +67,7 @@ flowchart TD | Method | When it runs | | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `onStart(props?)` | When the instance starts, or wakes from hibernation. Receives optional [initialization props](/agents/runtime/communication/routing/#props) passed via `getAgentByName` or `routeAgentRequest`. | +| `onStart(props?)` | When the instance starts, or wakes from hibernation. Receives optional [initialization props](/agents/agent-class/routing/#props) passed via `getAgentByName` or `routeAgentRequest`. | | `onRequest(request)` | For each HTTP request to the instance | | `onConnect(connection, ctx)` | When a WebSocket connection is established | | `onMessage(connection, message)` | For each WebSocket message received | @@ -87,27 +89,27 @@ flowchart TD | Feature | Methods | Documentation | | ------------------------ | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | -| **State** | `setState()`, `onStateChanged()`, `initialState` | [Store and sync state](/agents/runtime/lifecycle/state/) | -| **Callable methods** | `@callable()` decorator | [Callable methods](/agents/runtime/lifecycle/callable-methods/) | -| **Scheduling** | `schedule()`, `scheduleEvery()`, `getScheduleById()`, `listSchedules()` | [Schedule tasks](/agents/runtime/execution/schedule-tasks/) | -| **Durable execution** | `runFiber()`, `startFiber()`, `stash()`, `onFiberRecovered()`, `keepAlive()`, `keepAliveWhile()` | [Durable execution](/agents/runtime/execution/durable-execution/) | -| **Queue** | `queue()`, `dequeue()`, `dequeueAll()`, `getQueue()` | [Queue tasks](/agents/runtime/execution/queue-tasks/) | -| **WebSockets** | `onConnect()`, `onMessage()`, `onClose()`, `broadcast()` | [WebSockets](/agents/runtime/communication/websockets/) | -| **HTTP/SSE** | `onRequest()` | [HTTP and SSE](/agents/runtime/communication/http-sse/) | -| **Email** | `onEmail()`, `replyToEmail()` | [Email routing](/agents/communication-channels/email/) | -| **Workflows** | `runWorkflow()`, `waitForApproval()` | [Run Workflows](/agents/runtime/execution/run-workflows/) | +| **State** | `setState()`, `onStateChanged()`, `initialState` | [Store and sync state](/agents/agent-class/state/) | +| **Callable methods** | `@callable()` decorator | [Callable methods](/agents/agent-class/callable-methods/) | +| **Scheduling** | `schedule()`, `scheduleEvery()`, `getScheduleById()`, `listSchedules()` | [Schedule tasks](/agents/agent-class/schedule-tasks/) | +| **Durable execution** | `runFiber()`, `startFiber()`, `stash()`, `onFiberRecovered()`, `keepAlive()`, `keepAliveWhile()` | [Durable execution](/agents/agent-class/durable-execution/) | +| **Queue** | `queue()`, `dequeue()`, `dequeueAll()`, `getQueue()` | [Queue tasks](/agents/agent-class/queue-tasks/) | +| **WebSockets** | `onConnect()`, `onMessage()`, `onClose()`, `broadcast()` | [WebSockets](/agents/agent-class/websockets/) | +| **HTTP/SSE** | `onRequest()` | [HTTP and SSE](/agents/agent-class/http-sse/) | +| **Email** | `onEmail()`, `replyToEmail()` | [Email routing](/agents/agent-class/communication-channels/email/) | +| **Workflows** | `runWorkflow()`, `waitForApproval()` | [Run Workflows](/agents/agent-class/run-workflows/) | | **MCP Client** | `addMcpServer()`, `removeMcpServer()`, `getMcpServers()` | [MCP Client API](/agents/model-context-protocol/apis/client-api/) | -| **AI Models** | Workers AI, OpenAI, Anthropic bindings | [Using AI models](/agents/runtime/operations/using-ai-models/) | -| **Protocol messages** | `shouldSendProtocolMessages()`, `isConnectionProtocolEnabled()` | [Protocol messages](/agents/runtime/communication/protocol-messages/) | +| **AI Models** | Workers AI, OpenAI, Anthropic bindings | [Using AI models](/agents/agent-class/using-ai-models/) | +| **Protocol messages** | `shouldSendProtocolMessages()`, `isConnectionProtocolEnabled()` | [Protocol messages](/agents/agent-class/protocol-messages/) | | **Context** | `getCurrentAgent()` | [getCurrentAgent()](/agents/runtime/lifecycle/get-current-agent/) | | **Tracing** | `wrapAISDK()` | [Tracing](/agents/runtime/operations/observability/tracing/) | | **Diagnostics channels** | `subscribe()`, diagnostics channels | [Diagnostics channels](/agents/runtime/operations/observability/diagnostics-channels/) | -| **Sub-agents** | `subAgent()`, `abortSubAgent()`, `deleteSubAgent()` | [Sub-agents](/agents/runtime/execution/sub-agents/) | -| **Agents as tools** | `runAgentTool()`, `clearAgentToolRuns()`, `hasAgentToolRun()` | [Agents as tools](/agents/runtime/execution/agent-tools/) | +| **Sub-agents** | `subAgent()`, `abortSubAgent()`, `deleteSubAgent()` | [Sub-agents](/agents/agent-class/sub-agents/) | +| **Agents as tools** | `runAgentTool()`, `clearAgentToolRuns()`, `hasAgentToolRun()` | [Agents as tools](/agents/agent-class/agent-tools/) | | **Agent Skills** | `skills` registry, bundled skill sources, script runners | [Agent Skills](/agents/runtime/execution/agent-skills/) | | **Sessions** | `Session.create()`, context blocks, compaction, search | [Sessions](/agents/runtime/lifecycle/sessions/) | | **Think** | `Think` base class, workspace tools, lifecycle hooks, extensions | [Think](/agents/harnesses/think/) | -| **Chat SDK** | `createChatSdkState()`, `ChatSdkStateAgent` | [Chat SDK](/agents/runtime/communication/chat-sdk/) | +| **Chat SDK** | `createChatSdkState()`, `ChatSdkStateAgent` | [Chat SDK](/agents/agent-class/communication-channels/chat-sdk/) | ## SQL API @@ -124,17 +126,17 @@ this.sql`INSERT INTO users (id, name) VALUES (${id}, ${name})`; const users = this.sql`SELECT * FROM users WHERE id = ${id}`; ``` -For state that needs to sync with clients, use the [State API](/agents/runtime/lifecycle/state/) instead. +For state that needs to sync with clients, use the [State API](/agents/agent-class/state/) instead. ## Client-side API reference | Feature | Methods | Documentation | | --------------------- | ---------------------- | ------------------------------------------------------------------------------------------- | -| **WebSocket client** | `AgentClient` | [Client SDK](/agents/communication-channels/chat/client-sdk/) | -| **HTTP client** | `agentFetch()` | [Client SDK](/agents/communication-channels/chat/client-sdk/#http-requests-with-agentfetch) | -| **React hook** | `useAgent()` | [Client SDK](/agents/communication-channels/chat/client-sdk/#react) | -| **Chat hook** | `useAgentChat()` | [Client SDK](/agents/communication-channels/chat/client-sdk/) | -| **Agent tool events** | `useAgentToolEvents()` | [Agents as tools](/agents/runtime/execution/agent-tools/#render-child-timelines-in-react) | +| **WebSocket client** | `AgentClient` | [Client SDK](/agents/agent-class/communication-channels/chat/client-sdk/) | +| **HTTP client** | `agentFetch()` | [Client SDK](/agents/agent-class/communication-channels/chat/client-sdk/#http-requests-with-agentfetch) | +| **React hook** | `useAgent()` | [Client SDK](/agents/agent-class/communication-channels/chat/client-sdk/#react) | +| **Chat hook** | `useAgentChat()` | [Client SDK](/agents/agent-class/communication-channels/chat/client-sdk/) | +| **Agent tool events** | `useAgentToolEvents()` | [Agents as tools](/agents/agent-class/agent-tools/#render-child-timelines-in-react) | Module-level helper exports include `agentTool()` from `agents/agent-tools`, which converts a Think or `AIChatAgent` subclass into an AI SDK tool definition. @@ -204,7 +206,7 @@ export default { } satisfies ExportedHandler; ``` -Refer to [Routing](/agents/runtime/communication/routing/) for custom paths, CORS, and instance naming patterns. +Refer to [Routing](/agents/agent-class/routing/) for custom paths, CORS, and instance naming patterns. ## Next steps @@ -222,7 +224,7 @@ Refer to [Routing](/agents/runtime/communication/routing/) for custom paths, COR diff --git a/src/content/docs/agents/runtime/lifecycle/agent-class.mdx b/src/content/docs/agents/agent-class/internals.mdx similarity index 97% rename from src/content/docs/agents/runtime/lifecycle/agent-class.mdx rename to src/content/docs/agents/agent-class/internals.mdx index 21d34f97c5e..27bf5913a3a 100644 --- a/src/content/docs/agents/runtime/lifecycle/agent-class.mdx +++ b/src/content/docs/agents/agent-class/internals.mdx @@ -3,7 +3,7 @@ title: Agent class internals description: Explore how the Agent class extends Durable Objects to provide state, WebSockets, scheduling, and RPC. pcx_content_type: concept sidebar: - order: 5 + order: 1 products: - agents --- @@ -210,7 +210,7 @@ class MyAgent extends Agent { } ``` -State is stored in the `cf_agents_state` SQL table. State messages are sent with `type: "cf_agent_state"` (both from the client and the server). Since `agents` provides [JS and React clients](/agents/runtime/lifecycle/state/#synchronizing-state), real-time state updates are available out of the box. +State is stored in the `cf_agents_state` SQL table. State messages are sent with `type: "cf_agent_state"` (both from the client and the server). Since `agents` provides [JS and React clients](/agents/agent-class/state/#synchronizing-state), real-time state updates are available out of the box. ### `this.sql` @@ -507,7 +507,7 @@ class MyAgent extends Agent { } ``` -`AIChatAgent` uses `keepAliveWhile` internally to keep the agent alive during streaming LLM responses. For more details, refer to [Schedule tasks — Keeping the agent alive](/agents/runtime/execution/schedule-tasks/#keeping-the-agent-alive). +`AIChatAgent` uses `keepAliveWhile` internally to keep the agent alive during streaming LLM responses. For more details, refer to [Schedule tasks — Keeping the agent alive](/agents/agent-class/schedule-tasks/#keeping-the-agent-alive). ### Routing @@ -525,7 +525,7 @@ return new Response("Not found", { status: 404 }); ## Layer 3: `AIChatAgent` -The [`AIChatAgent`](/agents/communication-channels/chat/chat-agents/) class from `@cloudflare/ai-chat` extends `Agent` with an opinionated layer for AI chat. It adds automatic message persistence to SQLite, resumable streaming, tool support (server-side, client-side, and human-in-the-loop), and a React hook (`useAgentChat`) for building chat UIs. +The [`AIChatAgent`](/agents/agent-class/communication-channels/chat/chat-agents/) class from `@cloudflare/ai-chat` extends `Agent` with an opinionated layer for AI chat. It adds automatic message persistence to SQLite, resumable streaming, tool support (server-side, client-side, and human-in-the-loop), and a React hook (`useAgentChat`) for building chat UIs. The full hierarchy is: **DurableObject** > **Server** > **Agent** > **AIChatAgent**. diff --git a/src/content/docs/agents/runtime/communication/protocol-messages.mdx b/src/content/docs/agents/agent-class/protocol-messages.mdx similarity index 89% rename from src/content/docs/agents/runtime/communication/protocol-messages.mdx rename to src/content/docs/agents/agent-class/protocol-messages.mdx index 1097bf4606a..67ed33ead38 100644 --- a/src/content/docs/agents/runtime/communication/protocol-messages.mdx +++ b/src/content/docs/agents/agent-class/protocol-messages.mdx @@ -3,7 +3,7 @@ title: Protocol messages description: Control the identity, state, and MCP protocol messages sent to WebSocket clients on Agent connect. pcx_content_type: concept sidebar: - order: 27 + order: 8 products: - agents --- @@ -24,7 +24,7 @@ On every new connection, the Agent sends three protocol messages: State and MCP messages are also broadcast to all connections whenever they change. -For most web clients this is fine — the [Client SDK](/agents/communication-channels/chat/client-sdk/) and `useAgent` hook consume these messages automatically. However, some clients cannot handle JSON text frames: +For most web clients this is fine — the [Client SDK](/agents/agent-class/communication-channels/chat/client-sdk/) and `useAgent` hook consume these messages automatically. However, some clients cannot handle JSON text frames: - **Binary-only clients** — MQTT devices, IoT sensors, custom binary protocols - **Lightweight clients** — Embedded systems with minimal WebSocket stacks @@ -173,7 +173,7 @@ An overridable hook that determines if a connection should receive protocol mess Default: returns `true` (all connections receive protocol messages). -This hook is evaluated once on connect. The result is persisted in the connection's WebSocket attachment and survives [hibernation](/agents/runtime/communication/websockets/#hibernation). +This hook is evaluated once on connect. The result is persisted in the connection's WebSocket attachment and survives [hibernation](/agents/agent-class/websockets/#hibernation). ### `isConnectionProtocolEnabled` @@ -188,18 +188,18 @@ Safe to call at any time, including after the agent wakes from hibernation. ## How it works -Protocol status is stored as an internal flag in the connection's WebSocket attachment — the same mechanism used by [readonly connections](/agents/runtime/communication/readonly-connections/). This means: +Protocol status is stored as an internal flag in the connection's WebSocket attachment — the same mechanism used by [readonly connections](/agents/agent-class/readonly-connections/). This means: - **Survives hibernation** — the flag is serialized and restored when the agent wakes up - **No cleanup needed** — connection state is automatically discarded when the connection closes - **Zero overhead** — no database tables or queries, just the connection's built-in attachment - **Safe from user code** — `connection.state` and `connection.setState()` never expose or overwrite the flag -Unlike [readonly](/agents/runtime/communication/readonly-connections/) which can be toggled dynamically with `setConnectionReadonly()`, protocol status is set once on connect and cannot be changed afterward. To change a connection's protocol status, the client must disconnect and reconnect. +Unlike [readonly](/agents/agent-class/readonly-connections/) which can be toggled dynamically with `setConnectionReadonly()`, protocol status is set once on connect and cannot be changed afterward. To change a connection's protocol status, the client must disconnect and reconnect. ## Related resources -- [Readonly connections](/agents/runtime/communication/readonly-connections/) -- [WebSockets](/agents/runtime/communication/websockets/) -- [Store and sync state](/agents/runtime/lifecycle/state/) +- [Readonly connections](/agents/agent-class/readonly-connections/) +- [WebSockets](/agents/agent-class/websockets/) +- [Store and sync state](/agents/agent-class/state/) - [MCP Client API](/agents/model-context-protocol/apis/client-api/) diff --git a/src/content/docs/agents/runtime/execution/queue-tasks.mdx b/src/content/docs/agents/agent-class/queue-tasks.mdx similarity index 94% rename from src/content/docs/agents/runtime/execution/queue-tasks.mdx rename to src/content/docs/agents/agent-class/queue-tasks.mdx index bedead7d6ac..ce6e7dfabc1 100644 --- a/src/content/docs/agents/runtime/execution/queue-tasks.mdx +++ b/src/content/docs/agents/agent-class/queue-tasks.mdx @@ -3,7 +3,7 @@ title: Queue tasks description: Add background tasks to a built-in FIFO queue for asynchronous processing within Cloudflare Agents. pcx_content_type: concept sidebar: - order: 12 + order: 10 products: - agents --- @@ -47,7 +47,7 @@ async queue( - `callback` - The name of the method to call when processing the task - `payload` - Data to pass to the callback method - `options` - Optional configuration: - - `retry` - Retry options for the callback execution. If the callback throws, it is retried with exponential backoff. Refer to [Retries](/agents/runtime/execution/retries/) for details on `RetryOptions` + - `retry` - Retry options for the callback execution. If the callback throws, it is retried with exponential backoff. Refer to [Retries](/agents/agent-class/retries/) for details on `RetryOptions` **Returns:** The unique ID of the queued task @@ -338,7 +338,7 @@ class RobustAgent extends Agent { -If no `retry` option is provided, the class-level defaults from `static options.retry` are used (3 attempts, 100ms base delay, 3s max delay). Refer to [Retries](/agents/runtime/execution/retries/) for full details. +If no `retry` option is provided, the class-level defaults from `static options.retry` are used (3 attempts, 100ms base delay, 3s max delay). Refer to [Retries](/agents/agent-class/retries/) for full details. ## Best practices @@ -353,7 +353,7 @@ If no `retry` option is provided, the class-level defaults from `static options. The queue system works with other Agent SDK features: - **State management**: Access agent state within queued callbacks. -- **Scheduling**: Combine with [`schedule()`](/agents/runtime/execution/schedule-tasks/) for time-based queue processing. +- **Scheduling**: Combine with [`schedule()`](/agents/agent-class/schedule-tasks/) for time-based queue processing. - **Context**: Queued tasks maintain the original request context. - **Database**: Uses the same database as other agent data. @@ -365,7 +365,7 @@ The queue system works with other Agent SDK features: ## Queue vs Schedule -Use **queue** when you want tasks to execute as soon as possible in order. Use [**schedule**](/agents/runtime/execution/schedule-tasks/) when you need tasks to run at specific times or on a recurring basis. +Use **queue** when you want tasks to execute as soon as possible in order. Use [**schedule**](/agents/agent-class/schedule-tasks/) when you need tasks to run at specific times or on a recurring basis. | Feature | Queue | Schedule | | ---------------- | ------------------------ | --------------------------- | @@ -377,18 +377,18 @@ Use **queue** when you want tasks to execute as soon as possible in order. Use [ diff --git a/src/content/docs/agents/runtime/communication/readonly-connections.mdx b/src/content/docs/agents/agent-class/readonly-connections.mdx similarity index 97% rename from src/content/docs/agents/runtime/communication/readonly-connections.mdx rename to src/content/docs/agents/agent-class/readonly-connections.mdx index 35e683a7e6f..7936d4b3a31 100644 --- a/src/content/docs/agents/runtime/communication/readonly-connections.mdx +++ b/src/content/docs/agents/agent-class/readonly-connections.mdx @@ -3,7 +3,7 @@ title: Readonly connections description: Restrict WebSocket clients to view-only access so they receive state updates without modifying Agent state. pcx_content_type: concept sidebar: - order: 28 + order: 7 products: - agents --- @@ -455,7 +455,7 @@ function GameComponent() { ## How it works -Readonly status is stored in the connection's WebSocket attachment, which persists through the WebSocket Hibernation API. The flag is namespaced internally so it cannot be accidentally overwritten by `connection.setState()`. The same mechanism is used by [protocol message control](/agents/runtime/communication/protocol-messages/) — both flag coexist safely in the attachment. This means: +Readonly status is stored in the connection's WebSocket attachment, which persists through the WebSocket Hibernation API. The flag is namespaced internally so it cannot be accidentally overwritten by `connection.setState()`. The same mechanism is used by [protocol message control](/agents/agent-class/protocol-messages/) — both flag coexist safely in the attachment. This means: - **Survives hibernation** — the flag is serialized and restored when the agent wakes up - **No cleanup needed** — connection state is automatically discarded when the connection closes @@ -627,7 +627,7 @@ export class AuditedAgent extends Agent { ## Related resources -- [Store and sync state](/agents/runtime/lifecycle/state/) -- [Protocol messages](/agents/runtime/communication/protocol-messages/) — suppress JSON protocol frames for binary-only clients (can be combined with readonly) -- [WebSockets](/agents/runtime/communication/websockets/) -- [Callable methods](/agents/runtime/lifecycle/callable-methods/) +- [Store and sync state](/agents/agent-class/state/) +- [Protocol messages](/agents/agent-class/protocol-messages/) — suppress JSON protocol frames for binary-only clients (can be combined with readonly) +- [WebSockets](/agents/agent-class/websockets/) +- [Callable methods](/agents/agent-class/callable-methods/) diff --git a/src/content/docs/agents/runtime/execution/retries.mdx b/src/content/docs/agents/agent-class/retries.mdx similarity index 98% rename from src/content/docs/agents/runtime/execution/retries.mdx rename to src/content/docs/agents/agent-class/retries.mdx index 3cd350f13f8..b9ed5201c2f 100644 --- a/src/content/docs/agents/runtime/execution/retries.mdx +++ b/src/content/docs/agents/agent-class/retries.mdx @@ -3,7 +3,7 @@ title: Retries description: Retry failed operations with exponential backoff and jitter using the built-in retry system in the Agents SDK. pcx_content_type: reference sidebar: - order: 13 + order: 12 products: - agents --- @@ -507,18 +507,18 @@ class MyAgent extends Agent { diff --git a/src/content/docs/agents/runtime/communication/routing.mdx b/src/content/docs/agents/agent-class/routing.mdx similarity index 99% rename from src/content/docs/agents/runtime/communication/routing.mdx rename to src/content/docs/agents/agent-class/routing.mdx index 07756e8227b..231edc4fa6a 100644 --- a/src/content/docs/agents/runtime/communication/routing.mdx +++ b/src/content/docs/agents/agent-class/routing.mdx @@ -3,7 +3,7 @@ title: Routing description: Route HTTP and WebSocket requests to Agents SDK instances using routeAgentRequest() and getAgentByName(). pcx_content_type: reference sidebar: - order: 2 + order: 4 products: - agents --- @@ -100,7 +100,7 @@ buildAgentUrl("https://app.example.com", address, { Inside an Agent, `this.selfPath` provides the required root-first identity. If the root Durable Object binding name differs from its class name, pass the binding name as `rootBinding`. The pathname supports both HTTP requests and WebSocket connections. -For a custom route prefix, pass the same `prefix` to `buildAgentPath()` and `routeAgentRequest()`. Refer to [Sub-agents](/agents/runtime/execution/sub-agents/#direct-http-and-websocket-urls) for callback and webhook examples. +For a custom route prefix, pass the same `prefix` to `buildAgentPath()` and `routeAgentRequest()`. Refer to [Sub-agents](/agents/agent-class/sub-agents/#direct-http-and-websocket-urls) for callback and webhook examples. ## Instance naming patterns @@ -903,7 +903,7 @@ class SecureAgent extends Agent { @@ -915,7 +915,7 @@ class SecureAgent extends Agent { diff --git a/src/content/docs/agents/runtime/execution/run-workflows.mdx b/src/content/docs/agents/agent-class/run-workflows.mdx similarity index 99% rename from src/content/docs/agents/runtime/execution/run-workflows.mdx rename to src/content/docs/agents/agent-class/run-workflows.mdx index 69589f8ef15..04960a3c463 100644 --- a/src/content/docs/agents/runtime/execution/run-workflows.mdx +++ b/src/content/docs/agents/agent-class/run-workflows.mdx @@ -3,7 +3,7 @@ title: Run Workflows description: Integrate Cloudflare Workflows with Agents for durable, multi-step background processing and failure recovery. pcx_content_type: concept sidebar: - order: 14 + order: 13 products: - agents --- @@ -902,13 +902,13 @@ Workflows cannot open WebSocket connections directly. Use `broadcastToClients()` diff --git a/src/content/docs/agents/runtime/execution/schedule-tasks.mdx b/src/content/docs/agents/agent-class/schedule-tasks.mdx similarity index 98% rename from src/content/docs/agents/runtime/execution/schedule-tasks.mdx rename to src/content/docs/agents/agent-class/schedule-tasks.mdx index 94bb7158614..60d23b0f490 100644 --- a/src/content/docs/agents/runtime/execution/schedule-tasks.mdx +++ b/src/content/docs/agents/agent-class/schedule-tasks.mdx @@ -3,7 +3,7 @@ title: Schedule tasks description: Schedule delayed, date-based, cron, and interval tasks on Agents with persistent SQLite-backed execution. pcx_content_type: reference sidebar: - order: 10 + order: 9 products: - agents --- @@ -704,7 +704,7 @@ Schedule a task for future execution. - `when` - When to execute: `number` (seconds delay), `Date` (specific time), or `string` (cron expression) - `callback` - Name of the method to call - `payload` - Data to pass to the callback (must be JSON-serializable) -- `options.retry` - Optional retry configuration. Refer to [Retries](/agents/runtime/execution/retries/) for details +- `options.retry` - Optional retry configuration. Refer to [Retries](/agents/agent-class/retries/) for details - `options.idempotent` - Deduplicate by callback + payload. Defaults to `true` for cron schedules, `false` for delayed and Date-based schedules **Returns:** A `Schedule` object with the task details @@ -752,7 +752,7 @@ Schedule a task to run repeatedly at a fixed interval. - `intervalSeconds` - Number of seconds between executions (must be greater than 0) - `callback` - Name of the method to call - `payload` - Data to pass to the callback (must be JSON-serializable) -- `options.retry` - Optional retry configuration. Refer to [Retries](/agents/runtime/execution/retries/) for details. +- `options.retry` - Optional retry configuration. Refer to [Retries](/agents/agent-class/retries/) for details. **Returns:** A `Schedule` object with `type: "interval"` @@ -916,24 +916,24 @@ dispose2(); // Now the agent can go idle diff --git a/src/content/docs/agents/runtime/lifecycle/state.mdx b/src/content/docs/agents/agent-class/state.mdx similarity index 95% rename from src/content/docs/agents/runtime/lifecycle/state.mdx rename to src/content/docs/agents/agent-class/state.mdx index 903b195108c..0936d83ba9e 100644 --- a/src/content/docs/agents/runtime/lifecycle/state.mdx +++ b/src/content/docs/agents/agent-class/state.mdx @@ -3,7 +3,7 @@ title: Store and sync state description: Persist and sync Agent state across clients in real time using setState, SQL storage, and bidirectional updates. pcx_content_type: concept sidebar: - order: 7 + order: 2 products: - agents --- @@ -27,7 +27,7 @@ State within an Agent is: Agent state is stored in a SQL database embedded within each individual Agent instance. You can interact with it using the higher-level `this.setState` API (recommended), which allows you to sync state and trigger events on state changes, or by directly querying the database with `this.sql`. :::note[State vs Props] -**State** is persistent data that survives restarts and syncs across clients. **[Props](/agents/runtime/communication/routing/#props)** are one-time initialization arguments passed when an agent is instantiated - use props for configuration that does not need to persist. +**State** is persistent data that survives restarts and syncs across clients. **[Props](/agents/agent-class/routing/#props)** are one-time initialization arguments passed when an agent is instantiated - use props for configuration that does not need to persist. ::: @@ -186,7 +186,7 @@ export class MinimalAgent extends Agent { Use `setState()` to update state. This: 1. Saves to SQLite (persistent) -2. Broadcasts to all connected clients (excluding connections where [`shouldSendProtocolMessages`](/agents/runtime/communication/protocol-messages/) returned `false`) +2. Broadcasts to all connected clients (excluding connections where [`shouldSendProtocolMessages`](/agents/agent-class/protocol-messages/) returned `false`) 3. Triggers `onStateChanged()` (after broadcast; best-effort) @@ -426,7 +426,7 @@ flowchart TD ## State from Workflows -When using [Workflows](/agents/runtime/execution/run-workflows/), you can update agent state from workflow steps: +When using [Workflows](/agents/agent-class/run-workflows/), you can update agent state from workflow steps: @@ -642,7 +642,7 @@ onStateChanged(state: State, source: Connection | "server") { ## Use Agent state as model context -You can combine the state and SQL APIs in your Agent with its ability to [call AI models](/agents/runtime/operations/using-ai-models/) to include historical context within your prompts to a model. Modern Large Language Models (LLMs) often have very large context windows (up to millions of tokens), which allows you to pull relevant context into your prompt directly. +You can combine the state and SQL APIs in your Agent with its ability to [call AI models](/agents/agent-class/using-ai-models/) to include historical context within your prompts to a model. Modern Large Language Models (LLMs) often have very large context windows (up to millions of tokens), which allows you to pull relevant context into your prompt directly. For example, you can use an Agent's built-in SQL database to pull history, query a model with it, and append to that history ahead of the next call to the model: @@ -719,7 +719,7 @@ This works because each instance of an Agent has its own database, and the state @@ -731,12 +731,12 @@ This works because each instance of an Agent has its own database, and the state diff --git a/src/content/docs/agents/runtime/execution/sub-agents.mdx b/src/content/docs/agents/agent-class/sub-agents.mdx similarity index 95% rename from src/content/docs/agents/runtime/execution/sub-agents.mdx rename to src/content/docs/agents/agent-class/sub-agents.mdx index e17ef6cea9e..be931102bc2 100644 --- a/src/content/docs/agents/runtime/execution/sub-agents.mdx +++ b/src/content/docs/agents/agent-class/sub-agents.mdx @@ -5,7 +5,7 @@ description: Spawn child agents with isolated storage and typed RPC using subAge tags: - AI sidebar: - order: 5 + order: 14 products: - agents --- @@ -16,7 +16,7 @@ Spawn child agents as co-located Durable Objects with their own isolated SQLite Use sub-agents when a single user or entity owns an open-ended set of long-lived agents, such as chats, documents, sessions, shards, or projects. Each sub-agent runs in parallel with its own state while the parent coordinates discovery, access control, and lifecycle. -If you want a parent chat agent to dispatch another chat-capable agent during a single turn and render that child's progress inline, use [Agents as tools](/agents/runtime/execution/agent-tools/). Agents as tools are built on sub-agents, but add a parent-side run registry, streaming `agent-tool-event` frames, replay, cancellation, and cleanup. +If you want a parent chat agent to dispatch another chat-capable agent during a single turn and render that child's progress inline, use [Agents as tools](/agents/agent-class/agent-tools/). Agents as tools are built on sub-agents, but add a parent-side run registry, streaming `agent-tool-event` frames, replay, cancellation, and cleanup. ## Quick start @@ -561,7 +561,7 @@ Calling `this.destroy()` inside a sub-agent delegates cleanup to the parent. The ### Workflows from sub-agents -Sub-agents can also start [Workflows](/agents/runtime/execution/run-workflows/) with `this.runWorkflow()`. Workflow tracking is local to the sub-agent's SQLite database, and `AgentWorkflow.agent` routes RPC, callbacks, state updates, and broadcasts back to the originating sub-agent. Parent agents do not automatically list or control child-started workflows. +Sub-agents can also start [Workflows](/agents/agent-class/run-workflows/) with `this.runWorkflow()`. Workflow tracking is local to the sub-agent's SQLite database, and `AgentWorkflow.agent` routes RPC, callbacks, state updates, and broadcasts back to the originating sub-agent. Parent agents do not automatically list or control child-started workflows. Because `SubAgentStub` only exposes user-defined child methods, add child wrapper methods for controls such as `getWorkflow()`, `approveWorkflow()`, or `terminateWorkflow()`, then call those wrappers through `await this.subAgent(Child, name)`. If you pass `runWorkflow(..., { agentBinding })` from a sub-agent, use the root Agent binding name, not a child binding name. @@ -579,6 +579,6 @@ For sub-agent workflow origins, `AgentWorkflow.agent` is RPC-only. Use it to cal - [Think](/agents/harnesses/think/) — `chat()` method for streaming AI turns through sub-agents - [Long-running agents](/agents/concepts/agentic-patterns/long-running-agents/) — sub-agent delegation in the context of multi-week agent lifetimes -- [Callable methods](/agents/runtime/lifecycle/callable-methods/) — RPC via `@callable` and service bindings -- [Agents as tools](/agents/runtime/execution/agent-tools/) — run Think or `AIChatAgent` sub-agents as retained, streaming tools -- [Schedule tasks](/agents/runtime/execution/schedule-tasks/) — scheduling primitives for top-level agents and sub-agents +- [Callable methods](/agents/agent-class/callable-methods/) — RPC via `@callable` and service bindings +- [Agents as tools](/agents/agent-class/agent-tools/) — run Think or `AIChatAgent` sub-agents as retained, streaming tools +- [Schedule tasks](/agents/agent-class/schedule-tasks/) — scheduling primitives for top-level agents and sub-agents diff --git a/src/content/docs/agents/runtime/operations/using-ai-models.mdx b/src/content/docs/agents/agent-class/using-ai-models.mdx similarity index 92% rename from src/content/docs/agents/runtime/operations/using-ai-models.mdx rename to src/content/docs/agents/agent-class/using-ai-models.mdx index 9e5d8ff5066..411b32412c8 100644 --- a/src/content/docs/agents/runtime/operations/using-ai-models.mdx +++ b/src/content/docs/agents/agent-class/using-ai-models.mdx @@ -5,7 +5,7 @@ pcx_content_type: concept tags: - AI sidebar: - order: 19 + order: 16 products: - agents --- @@ -26,13 +26,13 @@ The [AI SDK](https://ai-sdk.dev/docs/introduction) provides a unified interface ## Calling AI Models -You can call models from any method within an Agent, including from HTTP requests using the [`onRequest`](/agents/runtime/agents-api/) handler, when a [scheduled task](/agents/runtime/execution/schedule-tasks/) runs, when handling a WebSocket message in the [`onMessage`](/agents/runtime/communication/websockets/) handler, or from any of your own methods. +You can call models from any method within an Agent, including from HTTP requests using the [`onRequest`](/agents/agent-class/) handler, when a [scheduled task](/agents/agent-class/schedule-tasks/) runs, when handling a WebSocket message in the [`onMessage`](/agents/agent-class/websockets/) handler, or from any of your own methods. Agents can call AI models on their own — autonomously — and can handle long-running responses that take minutes (or longer) to respond in full. If a client disconnects mid-stream, the Agent keeps running and can catch the client up when it reconnects. ### Streaming over WebSockets {/* long-running-model-requests */} -Modern reasoning models can take some time to both generate a response _and_ stream the response back to the client. Instead of buffering the entire response, you can stream it back over [WebSockets](/agents/runtime/communication/websockets/). +Modern reasoning models can take some time to both generate a response _and_ stream the response back to the client. Instead of buffering the entire response, you can stream it back over [WebSockets](/agents/agent-class/websockets/). @@ -79,7 +79,7 @@ export class MyAgent extends Agent { -You can also persist AI model responses back to [Agent state](/agents/runtime/lifecycle/state/) using `this.setState`. If a user disconnects, read the message history back and send it to the user when they reconnect. +You can also persist AI model responses back to [Agent state](/agents/agent-class/state/) using `this.setState`. If a user disconnects, read the message history back and send it to the user when they reconnect. ## Workers AI @@ -242,7 +242,7 @@ export class MyAgent extends Agent { Agents can call models across any service that supports the OpenAI API. For example, you can use the OpenAI SDK to call one of [Google's Gemini models](https://ai.google.dev/gemini-api/docs/openai#node.js) directly from your Agent. -Agents can stream responses back over HTTP using Server-Sent Events (SSE) from within an `onRequest` handler, or by using the native [WebSocket API](/agents/runtime/communication/websockets/) to stream responses back to a client. +Agents can stream responses back over HTTP using Server-Sent Events (SSE) from within an `onRequest` handler, or by using the native [WebSocket API](/agents/agent-class/websockets/) to stream responses back to a client. diff --git a/src/content/docs/agents/runtime/communication/websockets.mdx b/src/content/docs/agents/agent-class/websockets.mdx similarity index 97% rename from src/content/docs/agents/runtime/communication/websockets.mdx rename to src/content/docs/agents/agent-class/websockets.mdx index 077ab9f6687..8a71e008561 100644 --- a/src/content/docs/agents/runtime/communication/websockets.mdx +++ b/src/content/docs/agents/agent-class/websockets.mdx @@ -3,14 +3,14 @@ title: WebSockets description: Handle real-time WebSocket connections, messages, broadcasts, and lifecycle hooks in the Agents SDK. pcx_content_type: reference sidebar: - order: 8 + order: 6 products: - agents --- import { TypeScriptExample, LinkCard } from "~/components"; -Agents support WebSocket connections for real-time, bi-directional communication. This page covers server-side WebSocket handling. For client-side connection, refer to the [Client SDK](/agents/communication-channels/chat/client-sdk/). +Agents support WebSocket connections for real-time, bi-directional communication. This page covers server-side WebSocket handling. For client-side connection, refer to the [Client SDK](/agents/agent-class/communication-channels/chat/client-sdk/). ## Lifecycle hooks @@ -224,7 +224,7 @@ export class ChatAgent extends Agent { | `getConnection` | `(id: string) => Connection \| undefined` | Get connection by ID | | `getConnectionTags` | `(connection, ctx) => string[]` | Override to tag connections | | `broadcast` | `(message, without?: string[]) => void` | Send to all connections | -| `isConnectionReadonly` | `(connection) => boolean` | Check if a connection is [readonly](/agents/runtime/communication/readonly-connections/) | +| `isConnectionReadonly` | `(connection) => boolean` | Check if a connection is [readonly](/agents/agent-class/readonly-connections/) | | `isConnectionProtocolEnabled` | `(connection) => boolean` | Check if protocol messages are enabled for this connection | ## Handling binary data @@ -255,7 +255,7 @@ export class FileAgent extends Agent { :::note -Agents automatically send JSON text frames (identity, state, MCP servers) to every connection. If your client only handles binary data and cannot process these frames, use [`shouldSendProtocolMessages`](/agents/runtime/communication/protocol-messages/) to suppress them. +Agents automatically send JSON text frames (identity, state, MCP servers) to every connection. If your client only handles binary data and cannot process these frames, use [`shouldSendProtocolMessages`](/agents/agent-class/protocol-messages/) to suppress them. ::: ## Error and close handling @@ -554,19 +554,19 @@ For browser connections, use the Agents client SDK: - **Vanilla JS**: `AgentClient` from `agents/client` - **React**: `useAgent` hook from `agents/react` -Refer to [Client SDK](/agents/communication-channels/chat/client-sdk/) for full documentation. +Refer to [Client SDK](/agents/agent-class/communication-channels/chat/client-sdk/) for full documentation. ## Next steps diff --git a/src/content/docs/agents/concepts/agentic-patterns/human-in-the-loop.mdx b/src/content/docs/agents/concepts/agentic-patterns/human-in-the-loop.mdx index bddc68dd5f4..69499d5b5a4 100644 --- a/src/content/docs/agents/concepts/agentic-patterns/human-in-the-loop.mdx +++ b/src/content/docs/agents/concepts/agentic-patterns/human-in-the-loop.mdx @@ -576,7 +576,7 @@ class MultiApprovalAgent extends Agent { diff --git a/src/content/docs/agents/concepts/agentic-patterns/long-running-agents.mdx b/src/content/docs/agents/concepts/agentic-patterns/long-running-agents.mdx index 494be30db9e..32a33b9c9af 100644 --- a/src/content/docs/agents/concepts/agentic-patterns/long-running-agents.mdx +++ b/src/content/docs/agents/concepts/agentic-patterns/long-running-agents.mdx @@ -124,7 +124,7 @@ A hibernated agent can be woken by any of these sources: | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------- | | **HTTP request** | Any request to the agent's URL triggers `onRequest()` | A webhook from GitHub | | **WebSocket connection** | A client connects, triggering `onConnect()` | A team member opens the dashboard | -| **RPC call** | Another Worker or agent calls a method via [service binding](/workers/runtime-apis/bindings/service-bindings/) or [`@callable`](/agents/runtime/lifecycle/callable-methods/) | A coordinator agent delegates a task | +| **RPC call** | Another Worker or agent calls a method via [service binding](/workers/runtime-apis/bindings/service-bindings/) or [`@callable`](/agents/agent-class/callable-methods/) | A coordinator agent delegates a task | | **Scheduled alarm** | A stored schedule fires, triggering your callback | Daily standup reminder at 9am | | **Email** | An inbound email triggers `onEmail()` | A team member replies to a status email | @@ -220,16 +220,16 @@ try { | Seconds | Normal request handling | | Minutes | `keepAlive()` / `keepAliveWhile()` | | Minutes | `startFiber()` when retryable acceptance matters | -| Minutes to hours | [Workflows](/agents/runtime/execution/run-workflows/) | +| Minutes to hours | [Workflows](/agents/agent-class/run-workflows/) | | Hours to days | Async pattern: start job, hibernate, wake on completion | ## Surviving crashes: fibers and recovery An agent can be evicted at any time — a deploy, a platform restart, or hitting resource limits. If the agent was mid-task, that work is lost unless it was checkpointed. -[`runFiber()`](/agents/runtime/execution/durable-execution/) provides crash-recoverable execution. It persists a row in SQLite for the duration of the work, and lets you `stash()` intermediate state. If the agent is evicted, the fiber row survives, and `onFiberRecovered()` is called on the next activation. +[`runFiber()`](/agents/agent-class/durable-execution/) provides crash-recoverable execution. It persists a row in SQLite for the duration of the work, and lets you `stash()` intermediate state. If the agent is evicted, the fiber row survives, and `onFiberRecovered()` is called on the next activation. -Use [`startFiber()`](/agents/runtime/execution/durable-execution/#startfiber) when the important boundary is durable acceptance. It adds an idempotency key, retained status records, inspection, cancellation, and cleanup on top of the same fiber machinery. By default it returns after acceptance; pass `waitForCompletion: true` when the request should stay open until the accepted job reaches a terminal status. This is a good fit for webhooks where the provider may retry delivery and the agent must avoid starting duplicate visible side effects. +Use [`startFiber()`](/agents/agent-class/durable-execution/#startfiber) when the important boundary is durable acceptance. It adds an idempotency key, retained status records, inspection, cancellation, and cleanup on top of the same fiber machinery. By default it returns after acceptance; pass `waitForCompletion: true` when the request should stay open until the accepted job reaches a terminal status. This is a good fit for webhooks where the provider may retry delivery and the agent must avoid starting duplicate visible side effects. ```ts export class ProjectManager extends Agent { @@ -270,7 +270,7 @@ In `wrangler dev`, fiber recovery works identically to production. Kill the wran ::: -For the full API reference — `FiberContext`, `FiberRecoveryContext`, concurrent fibers, inline vs fire-and-forget patterns — refer to [Durable Execution](/agents/runtime/execution/durable-execution/). +For the full API reference — `FiberContext`, `FiberRecoveryContext`, concurrent fibers, inline vs fire-and-forget patterns — refer to [Durable Execution](/agents/agent-class/durable-execution/). ## Handling long async operations @@ -362,7 +362,7 @@ export class ProjectManager extends Agent { ### Pattern: workflow delegation -A production deployment involves multiple steps that must each retry independently — build, test, stage, promote. The project manager should not manage these steps internally; it delegates to a [Workflow](/agents/runtime/execution/run-workflows/) that handles retries and step sequencing: +A production deployment involves multiple steps that must each retry independently — build, test, stage, promote. The project manager should not manage these steps internally; it delegates to a [Workflow](/agents/agent-class/run-workflows/) that handles retries and step sequencing: ```ts export class ProjectManager extends Agent { @@ -535,7 +535,7 @@ Sub-agents have their own state, schedules, durable fibers, and lifecycle. They Because facets do not have independent alarm slots, the top-level parent owns the physical Durable Object alarm. The Agents SDK records which sub-agent owns each schedule or fiber recovery lease, wakes the parent, and routes the callback back into the child. The parent does not need to stay active while the sub-agent works — it can start the work, hibernate, and be woken by the child-owned schedule or recovery check. -For the full `subAgent()` API — typed RPC stubs, client routing, access control, storage isolation, and alarm-backed APIs — refer to [Sub-agents](/agents/runtime/execution/sub-agents/). For AI-specific sub-agent streaming (running full LLM turns through a child agent), refer to [Think: Sub-agent RPC](/agents/harnesses/think/sub-agents/). +For the full `subAgent()` API — typed RPC stubs, client routing, access control, storage isolation, and alarm-backed APIs — refer to [Sub-agents](/agents/agent-class/sub-agents/). For AI-specific sub-agent streaming (running full LLM turns through a child agent), refer to [Think: Sub-agent RPC](/agents/harnesses/think/sub-agents/). ## Recovering interrupted LLM streams The patterns above handle the project manager's coordination work — scheduling, delegating, polling. But the project manager also uses an LLM directly: generating plans, summarizing progress, drafting status emails. Those LLM calls stream tokens over a connection that cannot be resumed if the agent is evicted mid-response. @@ -695,13 +695,13 @@ The agent does not need to run continuously to do any of this. It just needs to ## Related -- [Durable Execution](/agents/runtime/execution/durable-execution/) — `runFiber()`, `startFiber()`, `stash()`, and crash recovery -- [Schedule tasks](/agents/runtime/execution/schedule-tasks/) — delayed, cron, and interval tasks -- [Retries](/agents/runtime/execution/retries/) — retry options and patterns -- [Workflows](/agents/runtime/execution/run-workflows/) — durable multi-step processing -- [Store and sync state](/agents/runtime/lifecycle/state/) — `setState()` and persistence -- [WebSockets](/agents/runtime/communication/websockets/) — lifecycle hooks and hibernation -- [Callable methods](/agents/runtime/lifecycle/callable-methods/) — RPC via `@callable` and service bindings -- [Email routing](/agents/communication-channels/email/) — receiving inbound email -- [Webhooks](/agents/communication-channels/webhooks/) — receiving external events +- [Durable Execution](/agents/agent-class/durable-execution/) — `runFiber()`, `startFiber()`, `stash()`, and crash recovery +- [Schedule tasks](/agents/agent-class/schedule-tasks/) — delayed, cron, and interval tasks +- [Retries](/agents/agent-class/retries/) — retry options and patterns +- [Workflows](/agents/agent-class/run-workflows/) — durable multi-step processing +- [Store and sync state](/agents/agent-class/state/) — `setState()` and persistence +- [WebSockets](/agents/agent-class/websockets/) — lifecycle hooks and hibernation +- [Callable methods](/agents/agent-class/callable-methods/) — RPC via `@callable` and service bindings +- [Email routing](/agents/agent-class/communication-channels/email/) — receiving inbound email +- [Webhooks](/agents/agent-class/communication-channels/webhooks/) — receiving external events - [Human in the loop](/agents/concepts/agentic-patterns/human-in-the-loop/) — approval flows diff --git a/src/content/docs/agents/concepts/calling-llms.mdx b/src/content/docs/agents/concepts/calling-llms.mdx index 45d48faf6ac..c44b532585b 100644 --- a/src/content/docs/agents/concepts/calling-llms.mdx +++ b/src/content/docs/agents/concepts/calling-llms.mdx @@ -14,11 +14,11 @@ import { TypeScriptExample, LinkCard } from "~/components"; Agents change how you work with LLMs. In a stateless Worker, every request starts from scratch — you reconstruct context, call a model, return the response, and forget everything. An Agent keeps state between calls, stays connected to clients over WebSocket, and can call models on its own schedule without a user present. -This page covers the patterns that become possible when your LLM calls happen inside a stateful Agent. For provider setup and code examples, refer to [Using AI Models](/agents/runtime/operations/using-ai-models/). +This page covers the patterns that become possible when your LLM calls happen inside a stateful Agent. For provider setup and code examples, refer to [Using AI Models](/agents/agent-class/using-ai-models/). ## State as context -Every Agent has a built-in [SQL database](/agents/runtime/lifecycle/state/) and key-value state. Instead of passing an entire conversation history from the client on every request, the Agent stores it and builds prompts from its own storage. +Every Agent has a built-in [SQL database](/agents/agent-class/state/) and key-value state. Instead of passing an entire conversation history from the client on every request, the Agent stores it and builds prompts from its own storage. @@ -82,7 +82,7 @@ export class MyAgent extends Agent { -With [`AIChatAgent`](/agents/communication-channels/chat/chat-agents/), this is handled automatically — messages are persisted to SQLite and streams resume on reconnect. +With [`AIChatAgent`](/agents/agent-class/communication-channels/chat/chat-agents/), this is handled automatically — messages are persisted to SQLite and streams resume on reconnect. ## Autonomous model calls @@ -202,24 +202,24 @@ For provider-level caching and rate limit management across multiple agents, use diff --git a/src/content/docs/agents/concepts/conversation-state-and-memory.mdx b/src/content/docs/agents/concepts/conversation-state-and-memory.mdx index ecd002751b1..7c4c0220643 100644 --- a/src/content/docs/agents/concepts/conversation-state-and-memory.mdx +++ b/src/content/docs/agents/concepts/conversation-state-and-memory.mdx @@ -16,7 +16,7 @@ Agents need memory to be useful over time. Without it, every conversation starts The [Session API](/agents/runtime/lifecycle/sessions/) provides the memory layer for agents built on the Cloudflare Agents SDK. It manages two kinds of memory: **conversation history** (the messages and tool calls that make up a session) and **context memory** (persistent blocks injected into the system prompt that the agent can read, write, search, and load). -Use this page when you need more than simple synced state or flat chat history. For small UI state, use [Store and sync state](/agents/runtime/lifecycle/state/). For basic chat persistence, `AIChatAgent` stores messages for you. For opinionated long-term memory, Think builds on Session and context blocks. +Use this page when you need more than simple synced state or flat chat history. For small UI state, use [Store and sync state](/agents/agent-class/state/). For basic chat persistence, `AIChatAgent` stores messages for you. For opinionated long-term memory, Think builds on Session and context blocks. :::caution[Experimental] @@ -562,7 +562,7 @@ const truncated = truncateOlderMessages(history); diff --git a/src/content/docs/agents/concepts/tools.mdx b/src/content/docs/agents/concepts/tools.mdx index 560a09fbd7f..f3e4adc0309 100644 --- a/src/content/docs/agents/concepts/tools.mdx +++ b/src/content/docs/agents/concepts/tools.mdx @@ -51,9 +51,9 @@ Execution location describes where a tool implementation runs. It is independent | Location | Use when | Start here | | ------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------- | -| Worker | The tool calls an API, queries SQL, or uses server-side bindings and secrets. | [Server-side tools](/agents/communication-channels/chat/chat-agents/#server-side-tools) | -| Browser | The tool needs geolocation, clipboard, local storage, or other browser APIs. | [Client-side tools](/agents/communication-channels/chat/chat-agents/#client-side-tools) | -| Another Agent | A chat-capable Agent should execute as a retained, streaming tool. | [Agents as tools](/agents/runtime/execution/agent-tools/) | +| Worker | The tool calls an API, queries SQL, or uses server-side bindings and secrets. | [Server-side tools](/agents/agent-class/communication-channels/chat/chat-agents/#server-side-tools) | +| Browser | The tool needs geolocation, clipboard, local storage, or other browser APIs. | [Client-side tools](/agents/agent-class/communication-channels/chat/chat-agents/#client-side-tools) | +| Another Agent | A chat-capable Agent should execute as a retained, streaming tool. | [Agents as tools](/agents/agent-class/agent-tools/) | With direct tool calls, the model calls the tool and the framework routes execution to the configured location. diff --git a/src/content/docs/agents/concepts/what-are-agents.mdx b/src/content/docs/agents/concepts/what-are-agents.mdx index 0e6ab0ca45f..2784b2271c9 100644 --- a/src/content/docs/agents/concepts/what-are-agents.mdx +++ b/src/content/docs/agents/concepts/what-are-agents.mdx @@ -97,12 +97,12 @@ The Cloudflare Agents SDK provides the infrastructure for building production ag diff --git a/src/content/docs/agents/concepts/workflows.mdx b/src/content/docs/agents/concepts/workflows.mdx index df4a47df04f..2a15c661ae2 100644 --- a/src/content/docs/agents/concepts/workflows.mdx +++ b/src/content/docs/agents/concepts/workflows.mdx @@ -187,7 +187,7 @@ A Workflow updates Agent state at key milestones using `step.updateAgentState()` diff --git a/src/content/docs/agents/examples/browser-agent.mdx b/src/content/docs/agents/examples/browser-agent.mdx index bfd90b3d310..aa453eb9e1c 100644 --- a/src/content/docs/agents/examples/browser-agent.mdx +++ b/src/content/docs/agents/examples/browser-agent.mdx @@ -144,7 +144,7 @@ async () => { ## Use with an Agent -The typical pattern is to create browser tools inside an [`AIChatAgent`](/agents/communication-channels/chat/chat-agents/) message handler, which gives you message persistence and streaming: +The typical pattern is to create browser tools inside an [`AIChatAgent`](/agents/agent-class/communication-channels/chat/chat-agents/) message handler, which gives you message persistence and streaming: diff --git a/src/content/docs/agents/examples/chat-agent.mdx b/src/content/docs/agents/examples/chat-agent.mdx index 32169801577..2bfe7039a1f 100644 --- a/src/content/docs/agents/examples/chat-agent.mdx +++ b/src/content/docs/agents/examples/chat-agent.mdx @@ -349,19 +349,19 @@ Your chat agent has: diff --git a/src/content/docs/agents/examples/email-agent.mdx b/src/content/docs/agents/examples/email-agent.mdx index b63d259cd59..c061438fa8f 100644 --- a/src/content/docs/agents/examples/email-agent.mdx +++ b/src/content/docs/agents/examples/email-agent.mdx @@ -748,18 +748,18 @@ Useful when sending emails through external services while maintaining secure re diff --git a/src/content/docs/agents/examples/slack-agent.mdx b/src/content/docs/agents/examples/slack-agent.mdx index 87bcfc9d366..9c90be9c365 100644 --- a/src/content/docs/agents/examples/slack-agent.mdx +++ b/src/content/docs/agents/examples/slack-agent.mdx @@ -461,7 +461,7 @@ export class MyAgent extends SlackAgent { - Add rate limiting to prevent abuse - Implement conversation state management - Use [Workers Analytics Engine](/analytics/analytics-engine/) to track usage -- Add [schedules](/agents/runtime/execution/schedule-tasks/) for scheduled tasks +- Add [schedules](/agents/agent-class/schedule-tasks/) for scheduled tasks ## Related resources diff --git a/src/content/docs/agents/examples/voice-agent.mdx b/src/content/docs/agents/examples/voice-agent.mdx index 1a439fa4cd6..7be70b67871 100644 --- a/src/content/docs/agents/examples/voice-agent.mdx +++ b/src/content/docs/agents/examples/voice-agent.mdx @@ -291,18 +291,18 @@ export class MyVoiceAgent extends VoiceAgent { diff --git a/src/content/docs/agents/harnesses/index.mdx b/src/content/docs/agents/harnesses/index.mdx index ee5c55836dc..a711b50bcc5 100644 --- a/src/content/docs/agents/harnesses/index.mdx +++ b/src/content/docs/agents/harnesses/index.mdx @@ -12,13 +12,13 @@ A harness is the loop that makes an agent behave like an agent instead of a sing It is responsible for the turn-by-turn work around the model: building the prompt, loading memory, selecting tools, handling tool results, streaming responses, persisting messages, and deciding whether the agent should continue or stop. -To build a new agent, start with the [Pi harness](/agents/harnesses/pi/), which runs Pi Durable in a Durable Object. You can also run [OpenCode](/agents/harnesses/opencode/), or build the loop yourself on top of the [Agents SDK runtime](/agents/runtime/agents-api/). +To build a new agent, start with the [Pi harness](/agents/harnesses/pi/), which runs Pi Durable in a Durable Object. You can also run [OpenCode](/agents/harnesses/opencode/), or build the loop yourself on top of the [Agents SDK runtime](/agents/agent-class/). ## How harnesses fit Harnesses sit on top of the Agents SDK runtime: -- **The runtime** gives the agent durable infrastructure: the [`Agent` class](/agents/runtime/lifecycle/agent-class/), [state](/agents/runtime/lifecycle/state/), [sessions](/agents/runtime/lifecycle/sessions/), [routing](/agents/runtime/communication/routing/), [WebSockets](/agents/runtime/communication/websockets/), [scheduling](/agents/runtime/execution/schedule-tasks/), [fibers](/agents/runtime/execution/durable-execution/), and [observability](/agents/runtime/operations/observability/). +- **The runtime** gives the agent durable infrastructure: the [`Agent` class](/agents/agent-class/internals/), [state](/agents/agent-class/state/), [sessions](/agents/runtime/lifecycle/sessions/), [routing](/agents/agent-class/routing/), [WebSockets](/agents/agent-class/websockets/), [scheduling](/agents/agent-class/schedule-tasks/), [fibers](/agents/agent-class/durable-execution/), and [observability](/agents/runtime/operations/observability/). - **The harness** gives the agent behavior: model calls, prompt construction, tool selection, stream handling, memory strategy, and lifecycle hooks. The runtime answers “where does this agent live and how does it stay durable?” The harness answers “what does this agent do on each turn?” @@ -60,7 +60,7 @@ A harness usually owns: @@ -72,6 +72,6 @@ A harness usually owns: diff --git a/src/content/docs/agents/harnesses/think/channels.mdx b/src/content/docs/agents/harnesses/think/channels.mdx index 5667b653a6f..b6edc9e928f 100644 --- a/src/content/docs/agents/harnesses/think/channels.mdx +++ b/src/content/docs/agents/harnesses/think/channels.mdx @@ -183,4 +183,4 @@ const unsubscribe = subscribe("channel", (event) => { - [Messengers](/agents/harnesses/think/messengers/) — Chat SDK webhook setup and delivery in depth. - [Actions](/agents/harnesses/think/actions/) — record reply attachments for `renderAttachment()`. -- [Voice](/agents/communication-channels/voice/) — real-time speech surfaces. +- [Voice](/agents/agent-class/communication-channels/voice/) — real-time speech surfaces. diff --git a/src/content/docs/agents/harnesses/think/client-tools.mdx b/src/content/docs/agents/harnesses/think/client-tools.mdx index 4c3433368a1..eb76006bb6f 100644 --- a/src/content/docs/agents/harnesses/think/client-tools.mdx +++ b/src/content/docs/agents/harnesses/think/client-tools.mdx @@ -118,7 +118,7 @@ When a turn produces several client tool calls at once, Think waits for **all** A Durable Object can be evicted at any time, including while a turn is paused on an approval prompt or a client-side tool call. [`Think` durable recovery](/agents/harnesses/think/recovery/) is always on. The SDK treats such a turn as waiting on the human, not stuck. It parks the turn instead of failing it. The user's eventual approval or tool result resumes the conversation. -For which interactions are exempt from recovery budgets, refer to [Turns waiting on a human are not sealed](/agents/communication-channels/chat/chat-agents/#turns-waiting-on-a-human-are-not-sealed). +For which interactions are exempt from recovery budgets, refer to [Turns waiting on a human are not sealed](/agents/agent-class/communication-channels/chat/chat-agents/#turns-waiting-on-a-human-are-not-sealed). ## Message concurrency diff --git a/src/content/docs/agents/harnesses/think/index.mdx b/src/content/docs/agents/harnesses/think/index.mdx index 84cdc0b0a9b..d8edd145de3 100644 --- a/src/content/docs/agents/harnesses/think/index.mdx +++ b/src/content/docs/agents/harnesses/think/index.mdx @@ -151,7 +151,7 @@ For span attributes, payload controls, exporting traces, and direct AI SDK v6 or ## Think vs AIChatAgent -Both Think and [`AIChatAgent`](/agents/communication-channels/chat/chat-agents/) extend `Agent` and speak the same `cf_agent_chat_*` WebSocket protocol. They serve different goals. +Both Think and [`AIChatAgent`](/agents/agent-class/communication-channels/chat/chat-agents/) extend `Agent` and speak the same `cf_agent_chat_*` WebSocket protocol. They serve different goals. **AIChatAgent** is a protocol adapter. You override `onChatMessage` and are responsible for calling `streamText`, wiring tools, converting messages, and returning a `Response`. AIChatAgent handles the plumbing — message persistence, streaming, abort, resume — but the LLM call is entirely your concern. @@ -300,9 +300,9 @@ export class Assistant extends Think { The supported pattern is "add context, then run a turn": call `addMessages()`, then `runTurn()`. -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 `chat()` for low-level parent-to-child streaming when your code owns forwarding, cancellation, and replay policy. Use [Agents as tools](/agents/agent-class/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. +Use [`startFiber()`](/agents/agent-class/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. ## In this section @@ -394,8 +394,8 @@ Think's design is inspired by [Pi](https://pi.dev). ## Related - [Sessions](/agents/runtime/lifecycle/sessions/) — context blocks, compaction, search, multi-session (the storage layer Think builds on) -- [Sub-agents](/agents/runtime/execution/sub-agents/) — `subAgent()`, `abortSubAgent()`, `deleteSubAgent()` (the base Agent methods for spawning children) -- [Chat agents](/agents/communication-channels/chat/chat-agents/) — `AIChatAgent` for when you need full control over the LLM call +- [Sub-agents](/agents/agent-class/sub-agents/) — `subAgent()`, `abortSubAgent()`, `deleteSubAgent()` (the base Agent methods for spawning children) +- [Chat agents](/agents/agent-class/communication-channels/chat/chat-agents/) — `AIChatAgent` for when you need full control over the LLM call - [Long-running agents](/agents/concepts/agentic-patterns/long-running-agents/) — sub-agent delegation patterns for multi-week agent lifetimes -- [Durable execution](/agents/runtime/execution/durable-execution/) — `runFiber()` and crash recovery (used by `chatRecovery`) +- [Durable execution](/agents/agent-class/durable-execution/) — `runFiber()` and crash recovery (used by `chatRecovery`) - [Browse the web](/agents/tools/browser/) — full CDP helper API reference diff --git a/src/content/docs/agents/harnesses/think/messengers.mdx b/src/content/docs/agents/harnesses/think/messengers.mdx index ca99f07f7f6..882b3488411 100644 --- a/src/content/docs/agents/harnesses/think/messengers.mdx +++ b/src/content/docs/agents/harnesses/think/messengers.mdx @@ -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/communication/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/agent-class/communication-channels/chat-sdk/) for the underlying state adapter. diff --git a/src/content/docs/agents/harnesses/think/recovery.mdx b/src/content/docs/agents/harnesses/think/recovery.mdx index 79caf2d7a74..a4f034e5477 100644 --- a/src/content/docs/agents/harnesses/think/recovery.mdx +++ b/src/content/docs/agents/harnesses/think/recovery.mdx @@ -10,7 +10,7 @@ products: import { TypeScriptExample } from "~/components"; -Think always wraps chat turns in recoverable [fibers](/agents/runtime/execution/durable-execution/). If the Durable Object is evicted mid-stream, Think reconstructs any buffered chunks. It persists partial output and schedules a continuation or retry. +Think always wraps chat turns in recoverable [fibers](/agents/agent-class/durable-execution/). If the Durable Object is evicted mid-stream, Think reconstructs any buffered chunks. It persists partial output and schedules a continuation or retry. :::note Durable recovery works without configuration. Most apps never need to configure it. Use this page for provider-specific recovery, a stall watchdog, or terminal behavior. @@ -116,7 +116,7 @@ onChatRecovery(ctx: ChatRecoveryContext): ChatRecoveryOptions { Use `ctx.createdAt` to skip stale recoveries. For example, if the interrupted turn is older than a few minutes, return `{ continue: false }` so the partial response is preserved without starting an old continuation. -Durable bookkeeping remains active when automatic continuation is not appropriate. Return `{ continue: false }` to prevent another model call. For cancellation, side-effect, and cost controls, refer to [Control automatic continuation](/agents/communication-channels/chat/chat-agents/#control-automatic-continuation). +Durable bookkeeping remains active when automatic continuation is not appropriate. Return `{ continue: false }` to prevent another model call. For cancellation, side-effect, and cost controls, refer to [Control automatic continuation](/agents/agent-class/communication-channels/chat/chat-agents/#control-automatic-continuation). ### Recovery budgets and limits @@ -159,7 +159,7 @@ export class MyAgent extends Think { | `terminalMessage` | generic message | Message shown to the user when recovery is given up on. | | `onExhausted` | — | Called once when recovery is given up on. Inspect `ctx.reason`. | -`ctx.reason` on the exhausted hook is one of: `no_progress_timeout` (stuck), `max_attempts_exceeded` (no-progress alarm loop), `work_budget_exceeded` (runaway), `interrupted_attempts_exceeded` (the turn's attempts kept dying, for example in memory-limit resets), `out_of_memory` (sealed by the alarm memory-limit circuit breaker), `recovery_aborted` (your `shouldKeepRecovering` returned `false`), or `stable_timeout` (extreme churn). Refer to [Stream recovery](/agents/communication-channels/chat/chat-agents/#stream-recovery) for the full shared reference. Think and `@cloudflare/ai-chat` use the same recovery configuration. +`ctx.reason` on the exhausted hook is one of: `no_progress_timeout` (stuck), `max_attempts_exceeded` (no-progress alarm loop), `work_budget_exceeded` (runaway), `interrupted_attempts_exceeded` (the turn's attempts kept dying, for example in memory-limit resets), `out_of_memory` (sealed by the alarm memory-limit circuit breaker), `recovery_aborted` (your `shouldKeepRecovering` returned `false`), or `stable_timeout` (extreme churn). Refer to [Stream recovery](/agents/agent-class/communication-channels/chat/chat-agents/#stream-recovery) for the full shared reference. Think and `@cloudflare/ai-chat` use the same recovery configuration. ## Repairing interrupted tool calls diff --git a/src/content/docs/agents/harnesses/think/tools.mdx b/src/content/docs/agents/harnesses/think/tools.mdx index 51bee943ad4..5328b49d3f6 100644 --- a/src/content/docs/agents/harnesses/think/tools.mdx +++ b/src/content/docs/agents/harnesses/think/tools.mdx @@ -24,7 +24,7 @@ On every turn, Think merges tools from multiple sources. Later sources override 6. **MCP tools** — from connected MCP servers when `includeMcpTools` is `true` 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 [Agents as 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/agent-class/agent-tools/) instead of passing one-off tools through `chat()`. ## Built-in workspace tools diff --git a/src/content/docs/agents/harnesses/think/workflows.mdx b/src/content/docs/agents/harnesses/think/workflows.mdx index c4d73e6ef7e..c410572beb4 100644 --- a/src/content/docs/agents/harnesses/think/workflows.mdx +++ b/src/content/docs/agents/harnesses/think/workflows.mdx @@ -175,6 +175,6 @@ getScheduledTasks() { Use [`submitMessages()`](/agents/harnesses/think/programmatic-submissions/) for durable one-off turns where the caller can inspect submission status later. -Use [`startFiber()`](/agents/runtime/execution/durable-execution/#startfiber) for app-owned idempotent Agent jobs that need recovery inside the Agent. Think's workflow notification delivery does not use fibers; it uses a private outbox because it needs to store an event until delivery succeeds. +Use [`startFiber()`](/agents/agent-class/durable-execution/#startfiber) for app-owned idempotent Agent jobs that need recovery inside the Agent. Think's workflow notification delivery does not use fibers; it uses a private outbox because it needs to store an event until delivery succeeds. Use Workflows when the process has multiple deterministic steps, long waits, or human approval. diff --git a/src/content/docs/agents/index.mdx b/src/content/docs/agents/index.mdx index 98d691c38c2..5c127c3d098 100644 --- a/src/content/docs/agents/index.mdx +++ b/src/content/docs/agents/index.mdx @@ -24,9 +24,9 @@ Deploy once and Cloudflare runs your agents across its global network, scaling t Agents on Cloudflare are composed from four parts: -- **Communication channels** define how users and systems reach your agent, such as [chat](/agents/communication-channels/chat/), [voice](/agents/communication-channels/voice/), [email](/agents/communication-channels/email/), [Slack](/agents/communication-channels/slack/), [webhooks](/agents/communication-channels/webhooks/), and other event sources. -- **The agent harness** defines the loop: how the agent calls models, selects tools, handles tool results, streams responses, and decides whether to continue. Use the [Pi harness](/agents/harnesses/pi/) to run Pi Durable in a Durable Object, or build your own loop directly on the [Agents SDK runtime](/agents/runtime/agents-api/). -- **The Agents SDK runtime** provides durable infrastructure: the [`Agent` class](/agents/runtime/lifecycle/agent-class/), [state](/agents/runtime/lifecycle/state/), [sessions](/agents/runtime/lifecycle/sessions/), [routing](/agents/runtime/communication/routing/), [WebSockets](/agents/runtime/communication/websockets/), [scheduling](/agents/runtime/execution/schedule-tasks/), [fibers](/agents/runtime/execution/durable-execution/), and [observability](/agents/runtime/operations/observability/). +- **Communication channels** define how users and systems reach your agent, such as [chat](/agents/agent-class/communication-channels/chat/), [voice](/agents/agent-class/communication-channels/voice/), [email](/agents/agent-class/communication-channels/email/), [Slack](/agents/agent-class/communication-channels/slack/), [webhooks](/agents/agent-class/communication-channels/webhooks/), and other event sources. +- **The agent harness** defines the loop: how the agent calls models, selects tools, handles tool results, streams responses, and decides whether to continue. Use the [Pi harness](/agents/harnesses/pi/) to run Pi Durable in a Durable Object, or build your own loop directly on the [Agents SDK runtime](/agents/agent-class/). +- **The Agents SDK runtime** provides durable infrastructure: the [`Agent` class](/agents/agent-class/internals/), [state](/agents/agent-class/state/), [sessions](/agents/runtime/lifecycle/sessions/), [routing](/agents/agent-class/routing/), [WebSockets](/agents/agent-class/websockets/), [scheduling](/agents/agent-class/schedule-tasks/), [fibers](/agents/agent-class/durable-execution/), and [observability](/agents/runtime/operations/observability/). - **Tools** give the agent capabilities: [browser automation](/agents/tools/browser/), [sandboxed code execution](/agents/tools/sandbox/), [AI Search](/agents/tools/ai-search/), [MCP tools](/agents/tools/mcp/), and [payments](/agents/tools/payments/). [Code Mode](/agents/tools/codemode/) lets models discover and orchestrate multiple tools by writing code. ### Get started diff --git a/src/content/docs/agents/model-context-protocol/apis/agent-api.mdx b/src/content/docs/agents/model-context-protocol/apis/agent-api.mdx index 7026eae9aaa..4600cac1fbf 100644 --- a/src/content/docs/agents/model-context-protocol/apis/agent-api.mdx +++ b/src/content/docs/agents/model-context-protocol/apis/agent-api.mdx @@ -50,7 +50,7 @@ export class MyMCP extends McpAgent { -This means that each instance of your MCP server has its own durable state, backed by a [Durable Object](/durable-objects/), with its own [SQL database](/agents/runtime/lifecycle/state/). +This means that each instance of your MCP server has its own durable state, backed by a [Durable Object](/durable-objects/), with its own [SQL database](/agents/agent-class/state/). A stateless server can define [tools](/agents/model-context-protocol/protocol/tools/) with `@modelcontextprotocol/server` and serve them through `createMcpHandler`. @@ -335,13 +335,13 @@ For a stateless server, read the same props with `getMcpAuthContext()`. Refer to ## State synchronization APIs -The `McpAgent` class provides full access to the [Agent state APIs](/agents/runtime/lifecycle/state/): +The `McpAgent` class provides full access to the [Agent state APIs](/agents/agent-class/state/): -- [`state`](/agents/runtime/lifecycle/state/) — Current persisted state -- [`initialState`](/agents/runtime/lifecycle/state/#set-the-initial-state-for-an-agent) — Default state when instance starts -- [`setState`](/agents/runtime/lifecycle/state/) — Update and persist state -- [`onStateChanged`](/agents/runtime/lifecycle/state/#synchronizing-state) — React to state changes -- [`sql`](/agents/runtime/agents-api/#sql-api) — Execute SQL queries on embedded database +- [`state`](/agents/agent-class/state/) — Current persisted state +- [`initialState`](/agents/agent-class/state/#set-the-initial-state-for-an-agent) — Default state when instance starts +- [`setState`](/agents/agent-class/state/) — Update and persist state +- [`onStateChanged`](/agents/agent-class/state/#synchronizing-state) — React to state changes +- [`sql`](/agents/agent-class/#sql-api) — Execute SQL queries on embedded database :::note[State resets after the session ends] Each client session is backed by an instance of the `McpAgent` class. This means that when the same client reconnects, they will start a new session, and the state will be reset. diff --git a/src/content/docs/agents/model-context-protocol/apis/client-api.mdx b/src/content/docs/agents/model-context-protocol/apis/client-api.mdx index c2c56eb2b9d..c58ec07c807 100644 --- a/src/content/docs/agents/model-context-protocol/apis/client-api.mdx +++ b/src/content/docs/agents/model-context-protocol/apis/client-api.mdx @@ -62,7 +62,7 @@ export class MyAgent extends Agent { -Connections persist in the agent's [SQL storage](/agents/runtime/lifecycle/state/), and when an agent connects to an MCP server, all tools from that server become available automatically. +Connections persist in the agent's [SQL storage](/agents/agent-class/state/), and when an agent connects to an MCP server, all tools from that server become available automatically. ## Adding MCP servers @@ -751,7 +751,7 @@ async addMcpServer( - `transport` — Transport layer configuration: - `headers` — Custom HTTP headers for authentication - `type` — Transport type: `"auto"` (default), `"streamable-http"`, or `"sse"` - - `retry` — Retry options for connection and reconnection attempts. Persisted and used when restoring connections after hibernation or after OAuth completion. Default: 3 attempts, 500ms base delay, 5s max delay. Refer to [Retries](/agents/runtime/execution/retries/) for details on `RetryOptions`. + - `retry` — Retry options for connection and reconnection attempts. Persisted and used when restoring connections after hibernation or after OAuth completion. Default: 3 attempts, 500ms base delay, 5s max delay. Refer to [Retries](/agents/agent-class/retries/) for details on `RetryOptions`. #### Parameters (RPC transport) @@ -1091,7 +1091,7 @@ const disposable = this.mcp.onServerStateChanged(() => { :::note -MCP server list broadcasts (`cf_agent_mcp_servers`) are automatically filtered to exclude connections where [`shouldSendProtocolMessages`](/agents/runtime/communication/protocol-messages/) returned `false`. +MCP server list broadcasts (`cf_agent_mcp_servers`) are automatically filtered to exclude connections where [`shouldSendProtocolMessages`](/agents/agent-class/protocol-messages/) returned `false`. ::: ### Lifecycle methods @@ -1156,7 +1156,7 @@ await this.mcp.waitForConnections({ timeout: 10_000 }); ``` :::note -`AIChatAgent` calls this automatically via its [`waitForMcpConnections`](/agents/communication-channels/chat/chat-agents/#waitformcpconnections) property (defaults to `{ timeout: 10_000 }`). You only need `waitForConnections()` directly when using `Agent` with MCP, or when you want finer control inside `onChatMessage`. +`AIChatAgent` calls this automatically via its [`waitForMcpConnections`](/agents/agent-class/communication-channels/chat/chat-agents/#waitformcpconnections) property (defaults to `{ timeout: 10_000 }`). You only need `waitForConnections()` directly when using `Agent` with MCP, or when you want finer control inside `onChatMessage`. ::: #### `this.mcp.closeConnection()` @@ -1268,12 +1268,12 @@ export class MyAgent extends Agent { diff --git a/src/content/docs/agents/model-context-protocol/guides/connect-mcp-client.mdx b/src/content/docs/agents/model-context-protocol/guides/connect-mcp-client.mdx index d01eff88b8b..d9cde1c94ee 100644 --- a/src/content/docs/agents/model-context-protocol/guides/connect-mcp-client.mdx +++ b/src/content/docs/agents/model-context-protocol/guides/connect-mcp-client.mdx @@ -230,7 +230,7 @@ You created an Agent that can: - List all available tools from connected servers - Monitor connection status -Connections persist in the Agent's [SQL storage](/agents/runtime/lifecycle/state/), so they remain active across requests. +Connections persist in the Agent's [SQL storage](/agents/agent-class/state/), so they remain active across requests. ## Next steps diff --git a/src/content/docs/agents/platform/limits.mdx b/src/content/docs/agents/platform/limits.mdx index b531c72fad9..7073926e31f 100644 --- a/src/content/docs/agents/platform/limits.mdx +++ b/src/content/docs/agents/platform/limits.mdx @@ -28,6 +28,6 @@ Many limits are inherited from those applied to Workers scripts and/or Durable O [^2]: You can deploy up to [500 scripts per account](/workers/platform/limits/), but each script (project) can define multiple Agents. Each deployed script can be up to 10 MB on the [Workers Paid Plan](/workers/platform/pricing/#workers) -[^3]: Compute (CPU) time per Agent is limited to 30 seconds, but this is refreshed when an Agent receives a new HTTP request, runs a [scheduled task](/agents/runtime/execution/schedule-tasks/), or an incoming WebSocket message. +[^3]: Compute (CPU) time per Agent is limited to 30 seconds, but this is refreshed when an Agent receives a new HTTP request, runs a [scheduled task](/agents/agent-class/schedule-tasks/), or an incoming WebSocket message. diff --git a/src/content/docs/agents/runtime/communication/index.mdx b/src/content/docs/agents/runtime/communication/index.mdx deleted file mode 100644 index afc1b725017..00000000000 --- a/src/content/docs/agents/runtime/communication/index.mdx +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Communication -pcx_content_type: navigation -sidebar: - order: 2 - group: - hideIndex: true ---- - -import { DirectoryListing } from "~/components"; - - diff --git a/src/content/docs/agents/runtime/execution/agent-skills.mdx b/src/content/docs/agents/runtime/execution/agent-skills.mdx index 580acff3445..7bef060ae58 100644 --- a/src/content/docs/agents/runtime/execution/agent-skills.mdx +++ b/src/content/docs/agents/runtime/execution/agent-skills.mdx @@ -16,7 +16,7 @@ Agent Skills are on-demand instructions, resources, and scripts. A skill source Agent Skills are experimental, and script execution in particular is early. The API may change in a future release. ::: -The skills engine lives in `agents/skills` and is framework-agnostic, so any agent (including a plain [`AIChatAgent`](/agents/communication-channels/chat/chat-agents/) `onChatMessage`) can build a `SkillRegistry`. [`@cloudflare/think`](/agents/harnesses/think/) re-exports it as the `skills` namespace and wires `getSkills()` into the turn automatically. +The skills engine lives in `agents/skills` and is framework-agnostic, so any agent (including a plain [`AIChatAgent`](/agents/agent-class/communication-channels/chat/chat-agents/) `onChatMessage`) can build a `SkillRegistry`. [`@cloudflare/think`](/agents/harnesses/think/) re-exports it as the `skills` namespace and wires `getSkills()` into the turn automatically. ## Using skills with Think diff --git a/src/content/docs/agents/runtime/lifecycle/get-current-agent.mdx b/src/content/docs/agents/runtime/lifecycle/get-current-agent.mdx index 706eaf1b0fa..e33dd267c40 100644 --- a/src/content/docs/agents/runtime/lifecycle/get-current-agent.mdx +++ b/src/content/docs/agents/runtime/lifecycle/get-current-agent.mdx @@ -320,18 +320,18 @@ The context available depends on how the method was invoked: diff --git a/src/content/docs/agents/runtime/lifecycle/sessions.mdx b/src/content/docs/agents/runtime/lifecycle/sessions.mdx index 84967bb6bde..5bd33e614bf 100644 --- a/src/content/docs/agents/runtime/lifecycle/sessions.mdx +++ b/src/content/docs/agents/runtime/lifecycle/sessions.mdx @@ -906,5 +906,5 @@ By default, storage is in Durable Object SQLite and tables are created lazily on ## Related - [Think](/agents/harnesses/think/) — opinionated chat agent that uses Session for conversation storage via `configureSession()` -- [Chat agents](/agents/communication-channels/chat/chat-agents/) — `AIChatAgent` with its own message persistence layer -- [Store and sync state](/agents/runtime/lifecycle/state/) — `setState()` for simpler key-value persistence +- [Chat agents](/agents/agent-class/communication-channels/chat/chat-agents/) — `AIChatAgent` with its own message persistence layer +- [Store and sync state](/agents/agent-class/state/) — `setState()` for simpler key-value persistence diff --git a/src/content/docs/agents/runtime/operations/configuration.mdx b/src/content/docs/agents/runtime/operations/configuration.mdx index 4fd49eefa80..ab9a592a4f1 100644 --- a/src/content/docs/agents/runtime/operations/configuration.mdx +++ b/src/content/docs/agents/runtime/operations/configuration.mdx @@ -330,7 +330,7 @@ export default defineConfig({ The `agents()` plugin is safe to include even if your project does not use decorators. It only runs the transform on files that contain `@` syntax. -The starter template and all examples include this plugin by default. If you encounter `SyntaxError: Invalid or unexpected token` with decorators, refer to [Callable methods — Troubleshooting](/agents/runtime/lifecycle/callable-methods/#troubleshooting). +The starter template and all examples include this plugin by default. If you encounter `SyntaxError: Invalid or unexpected token` with decorators, refer to [Callable methods — Troubleshooting](/agents/agent-class/callable-methods/#troubleshooting). ## Generating types @@ -939,18 +939,18 @@ Consider converting to the declarative [`exports`](/durable-objects/reference/du diff --git a/src/content/docs/agents/runtime/operations/cross-domain-authentication.mdx b/src/content/docs/agents/runtime/operations/cross-domain-authentication.mdx index 12c801a1785..75270b95c4f 100644 --- a/src/content/docs/agents/runtime/operations/cross-domain-authentication.mdx +++ b/src/content/docs/agents/runtime/operations/cross-domain-authentication.mdx @@ -256,13 +256,13 @@ export class SecureAgent extends Agent { @@ -274,6 +274,6 @@ export class SecureAgent extends Agent { diff --git a/src/content/docs/agents/runtime/operations/observability/tracing.mdx b/src/content/docs/agents/runtime/operations/observability/tracing.mdx index 3e26ae7050f..3ac85830243 100644 --- a/src/content/docs/agents/runtime/operations/observability/tracing.mdx +++ b/src/content/docs/agents/runtime/operations/observability/tracing.mdx @@ -279,6 +279,6 @@ Beginning December 1, 2026, agent traces contribute to account-level ingestion a diff --git a/src/content/docs/agents/tools/ai-search.mdx b/src/content/docs/agents/tools/ai-search.mdx index 964b74449d3..098d2ae90d1 100644 --- a/src/content/docs/agents/tools/ai-search.mdx +++ b/src/content/docs/agents/tools/ai-search.mdx @@ -10,7 +10,7 @@ products: import { LinkCard, TypeScriptExample, WranglerConfig } from "~/components"; -Agents can use [AI Search](/ai-search/) to retrieve relevant information from indexed content and use it to augment [calls to AI models](/agents/runtime/operations/using-ai-models/). AI Search manages the retrieval pipeline for you, including indexing, search, and optional chat completions over your content. +Agents can use [AI Search](/ai-search/) to retrieve relevant information from indexed content and use it to augment [calls to AI models](/agents/agent-class/using-ai-models/). AI Search manages the retrieval pipeline for you, including indexing, search, and optional chat completions over your content. Use AI Search when you want an agent to: diff --git a/src/content/docs/agents/tools/codemode/browser.mdx b/src/content/docs/agents/tools/codemode/browser.mdx index 94d293b855a..8c3f055191f 100644 --- a/src/content/docs/agents/tools/codemode/browser.mdx +++ b/src/content/docs/agents/tools/codemode/browser.mdx @@ -215,4 +215,4 @@ The timeout cannot interrupt a tight synchronous loop such as `while (true) {}`. `createBrowserCodeTool()` excludes any tool whose `needsApproval` value is `true` or a function. Code Mode does not pause iframe execution to request approval for those tools. -Keep approval-gated actions outside the Code Mode descriptor. Register them as standard tools and use the [`useAgentChat()` approval flow](/agents/communication-channels/chat/chat-agents/#tool-approval-human-in-the-loop) instead. +Keep approval-gated actions outside the Code Mode descriptor. Register them as standard tools and use the [`useAgentChat()` approval flow](/agents/agent-class/communication-channels/chat/chat-agents/#tool-approval-human-in-the-loop) instead. diff --git a/src/content/docs/agents/tools/mcp.mdx b/src/content/docs/agents/tools/mcp.mdx index 9f9e9904206..6c718620c09 100644 --- a/src/content/docs/agents/tools/mcp.mdx +++ b/src/content/docs/agents/tools/mcp.mdx @@ -53,7 +53,7 @@ export class ToolAgent extends Agent { -If the server requires OAuth, `addMcpServer()` returns an authentication state and authorization URL. The connection is persisted in the agent's [SQL storage](/agents/runtime/lifecycle/state/). +If the server requires OAuth, `addMcpServer()` returns an authentication state and authorization URL. The connection is persisted in the agent's [SQL storage](/agents/agent-class/state/). ## Configuration diff --git a/src/content/docs/agents/tools/sandbox.mdx b/src/content/docs/agents/tools/sandbox.mdx index 37b18717ff1..95cd36a48e8 100644 --- a/src/content/docs/agents/tools/sandbox.mdx +++ b/src/content/docs/agents/tools/sandbox.mdx @@ -196,7 +196,7 @@ Files in the sandbox last while the container runs. When the container stops, th Use agent state for user-visible progress and small metadata, such as the ID of the latest snapshot. -For long-running sandbox work, pair the sandbox with [durable execution with fibers](/agents/runtime/execution/durable-execution/) or [Workflows](/agents/runtime/execution/run-workflows/) so the agent can recover or report progress if work outlives a single request. +For long-running sandbox work, pair the sandbox with [durable execution with fibers](/agents/agent-class/durable-execution/) or [Workflows](/agents/agent-class/run-workflows/) so the agent can recover or report progress if work outlives a single request. ## Security considerations diff --git a/src/content/docs/ai-search/agent-sdks/agents-sdk.mdx b/src/content/docs/ai-search/agent-sdks/agents-sdk.mdx index 1a4c84fd5df..53fb7a38a81 100644 --- a/src/content/docs/ai-search/agent-sdks/agents-sdk.mdx +++ b/src/content/docs/ai-search/agent-sdks/agents-sdk.mdx @@ -230,7 +230,7 @@ npx wrangler types npm run dev ``` -`AIChatAgent` speaks its chat protocol over a WebSocket, so drive it from a chat client rather than a plain `curl` request. The quickest way is to point a UI built with the Agents SDK [`useAgentChat`](/agents/communication-channels/chat/chat-agents/) hook at your local server. +`AIChatAgent` speaks its chat protocol over a WebSocket, so drive it from a chat client rather than a plain `curl` request. The quickest way is to point a UI built with the Agents SDK [`useAgentChat`](/agents/agent-class/communication-channels/chat/chat-agents/) hook at your local server. Send a message such as `How do I get started?`. On the first message, the agent creates and seeds the instance, so the first response can take a minute or two while the seed document indexes. diff --git a/src/content/docs/ai-search/how-to/human-in-the-loop-knowledge-base.mdx b/src/content/docs/ai-search/how-to/human-in-the-loop-knowledge-base.mdx index 86b86805e66..aeadd67b3fa 100644 --- a/src/content/docs/ai-search/how-to/human-in-the-loop-knowledge-base.mdx +++ b/src/content/docs/ai-search/how-to/human-in-the-loop-knowledge-base.mdx @@ -366,7 +366,7 @@ async () => { `aiSearch.search()` runs immediately. When the program reaches `aiSearch.saveDocument()`, the runtime records the call as pending and pauses the execution before the upload runs. -Your client sends the chat message that starts the run, then drives the approval with the `@callable()` methods. The following script uses the [Agents SDK client](/agents/communication-channels/chat/client-sdk/) to do both. Save it as `client.mjs`, set `HOST` to your deployed Worker, and run it with `node client.mjs`: +Your client sends the chat message that starts the run, then drives the approval with the `@callable()` methods. The following script uses the [Agents SDK client](/agents/agent-class/communication-channels/chat/client-sdk/) to do both. Save it as `client.mjs`, set `HOST` to your deployed Worker, and run it with `node client.mjs`: diff --git a/src/content/docs/ai-search/how-to/talk-to-your-knowledge-base.mdx b/src/content/docs/ai-search/how-to/talk-to-your-knowledge-base.mdx index 2059cb136fd..2832cc2ecb5 100644 --- a/src/content/docs/ai-search/how-to/talk-to-your-knowledge-base.mdx +++ b/src/content/docs/ai-search/how-to/talk-to-your-knowledge-base.mdx @@ -18,7 +18,7 @@ import { } from "~/components"; import AiSearchVoiceDiagram from "~/components/AiSearchVoiceDiagram.astro"; -This tutorial builds a voice agent that you can talk to and that answers out loud from your [AI Search](/ai-search/) knowledge base. It uses the [Cloudflare Agents](/agents/) [`@cloudflare/voice`](/agents/communication-channels/voice/) package for the speech pipeline, and AI Search as the agent's knowledge base, exposed as a retrieval tool the agent's model calls. +This tutorial builds a voice agent that you can talk to and that answers out loud from your [AI Search](/ai-search/) knowledge base. It uses the [Cloudflare Agents](/agents/) [`@cloudflare/voice`](/agents/agent-class/communication-channels/voice/) package for the speech pipeline, and AI Search as the agent's knowledge base, exposed as a retrieval tool the agent's model calls. **What you will build:** A voice agent that transcribes your speech, calls AI Search to retrieve relevant content from your indexed knowledge base, generates a grounded answer, and speaks it back. @@ -53,7 +53,7 @@ Install the voice package: -The [`@cloudflare/voice`](/agents/communication-channels/voice/) package provides the `withVoice` mixin and the Workers AI providers (`WorkersAIFluxSTT` and `WorkersAITTS`). For a full walkthrough of the voice agent itself, including the browser client, refer to the [Voice agent example](/agents/examples/voice-agent/). +The [`@cloudflare/voice`](/agents/agent-class/communication-channels/voice/) package provides the `withVoice` mixin and the Workers AI providers (`WorkersAIFluxSTT` and `WorkersAITTS`). For a full walkthrough of the voice agent itself, including the browser client, refer to the [Voice agent example](/agents/examples/voice-agent/). ## 2. Add the AI Search binding @@ -199,7 +199,7 @@ Use a Workers AI model that supports function calling so the model can call the ## 4. Build the client -Replace `src/client.tsx` with a React component that uses the [`useVoiceAgent`](/agents/communication-channels/voice/) hook. The hook manages the microphone, the WebSocket connection to your agent, audio playback, and interrupt detection, so the component only needs to render controls. Set `agent` to your agent class name, `TalkToDocs`. +Replace `src/client.tsx` with a React component that uses the [`useVoiceAgent`](/agents/agent-class/communication-channels/voice/) hook. The hook manages the microphone, the WebSocket connection to your agent, audio playback, and interrupt detection, so the component only needs to render controls. Set `agent` to your agent class name, `TalkToDocs`. ```tsx title="src/client.tsx" import { useVoiceAgent } from "@cloudflare/voice/react"; @@ -292,7 +292,7 @@ This tutorial builds a single-user voice agent. If you instead need several peop diff --git a/src/content/docs/workers/demos/chatgpt-app.mdx b/src/content/docs/workers/demos/chatgpt-app.mdx index e5ccd8ba0d7..9ea01e4e048 100644 --- a/src/content/docs/workers/demos/chatgpt-app.mdx +++ b/src/content/docs/workers/demos/chatgpt-app.mdx @@ -868,7 +868,7 @@ Now that you have a working ChatGPT App, you can: diff --git a/src/content/docs/workflows/get-started/durable-agents.mdx b/src/content/docs/workflows/get-started/durable-agents.mdx index 97efadb5912..56115326a7d 100644 --- a/src/content/docs/workflows/get-started/durable-agents.mdx +++ b/src/content/docs/workflows/get-started/durable-agents.mdx @@ -649,7 +649,7 @@ Agent class names are automatically converted to kebab-case for URLs (`ResearchA diff --git a/src/content/partials/agents/common-integration-patterns.mdx b/src/content/partials/agents/common-integration-patterns.mdx index c596443ec91..5ee7dd47d3f 100644 --- a/src/content/partials/agents/common-integration-patterns.mdx +++ b/src/content/partials/agents/common-integration-patterns.mdx @@ -49,7 +49,7 @@ const agentResponse = await routeAgentRequest(request, env, { -Refer to [Routing](/agents/runtime/communication/routing/) for more options including CORS, custom instance naming, and location hints. +Refer to [Routing](/agents/agent-class/routing/) for more options including CORS, custom instance naming, and location hints. ### Accessing agents from server code diff --git a/src/content/partials/agents/next-steps.mdx b/src/content/partials/agents/next-steps.mdx index b1a384f100f..42c4780fb04 100644 --- a/src/content/partials/agents/next-steps.mdx +++ b/src/content/partials/agents/next-steps.mdx @@ -12,46 +12,46 @@ Now that you have a working agent, explore these topics: | Learn how to | Refer to | | ------------------------ | --------------------------------------------------------- | -| Add AI/LLM capabilities | [Using AI models](/agents/runtime/operations/using-ai-models/) | +| Add AI/LLM capabilities | [Using AI models](/agents/agent-class/using-ai-models/) | | Expose tools via MCP | [MCP servers](/agents/model-context-protocol/apis/handler-api/) | -| Run background tasks | [Schedule tasks](/agents/runtime/execution/schedule-tasks/) | -| Handle emails | [Email routing](/agents/communication-channels/email/) | -| Use Cloudflare Workflows | [Run Workflows](/agents/runtime/execution/run-workflows/) | +| Run background tasks | [Schedule tasks](/agents/agent-class/schedule-tasks/) | +| Handle emails | [Email routing](/agents/agent-class/communication-channels/email/) | +| Use Cloudflare Workflows | [Run Workflows](/agents/agent-class/run-workflows/) | ### Explore more \ No newline at end of file From c1c13d18aabd8d3c72181ea1f90bc3349a78ee39 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Tue, 27 Oct 2026 11:14:35 +0000 Subject: [PATCH 2/2] [Agents] Address style review: relative links, refer to, serial comma, split sentences --- src/content/changelog/agents/2025-03-18-npm-i-agents.mdx | 2 +- .../agents/2025-11-26-agents-resumable-streaming.mdx | 4 ++-- .../agents/2026-02-03-agents-workflows-integration.mdx | 2 +- src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx | 4 ++-- .../communication-channels/chat/autonomous-responses.mdx | 2 +- .../agents/concepts/agentic-patterns/long-running-agents.mdx | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/content/changelog/agents/2025-03-18-npm-i-agents.mdx b/src/content/changelog/agents/2025-03-18-npm-i-agents.mdx index 3bd3242dead..b5b97ed1dae 100644 --- a/src/content/changelog/agents/2025-03-18-npm-i-agents.mdx +++ b/src/content/changelog/agents/2025-03-18-npm-i-agents.mdx @@ -127,7 +127,7 @@ You can use the starter as a template for your own Agents projects: open up `src We've heard your feedback on the Agents SDK documentation, and we're shipping more API reference material and usage examples, including: - Expanded [API reference documentation](/agents/runtime/), covering the methods and properties exposed by the Agents SDK, as well as more usage examples. -- More [Client API](/agents/agent-class/#client-api) documentation that documents `useAgent`, `useAgentChat` and the new `@unstable_callable` RPC decorator exposed by the SDK. +- More [Client API](/agents/agent-class/#client-api) documentation that documents `useAgent`, `useAgentChat`, and the new `@unstable_callable` RPC decorator exposed by the SDK. - New documentation on how to [route requests to agents](/agents/agent-class/routing/) and (optionally) authenticate clients before they connect to your Agents. Note that the Agents SDK is continually growing: the type definitions included in the SDK will always include the latest APIs exposed by the `agents` package. diff --git a/src/content/changelog/agents/2025-11-26-agents-resumable-streaming.mdx b/src/content/changelog/agents/2025-11-26-agents-resumable-streaming.mdx index 560b2eeac6d..4c19d25c918 100644 --- a/src/content/changelog/agents/2025-11-26-agents-resumable-streaming.mdx +++ b/src/content/changelog/agents/2025-11-26-agents-resumable-streaming.mdx @@ -24,7 +24,7 @@ Streams are maintained across page refreshes, broken connections, and syncing ac ### Other improvements - Default JSON schema validator added to MCP client -- [Schedules](https://developers.cloudflare.com/agents/agent-class/schedule-tasks/) can now safely destroy the agent +- [Schedules](/agents/agent-class/schedule-tasks/) can now safely destroy the agent ### MCP client API improvements @@ -60,7 +60,7 @@ MCP discovery fetches the available tools, prompts, and resources from an MCP se ### Bug fixes -- Fixed a bug where [schedules](https://developers.cloudflare.com/agents/agent-class/schedule-tasks/) meant to fire immediately with this.schedule(0, ...) or `this.schedule(new Date(), ...)` would not fire +- Fixed a bug where [schedules](/agents/agent-class/schedule-tasks/) meant to fire immediately with this.schedule(0, ...) or `this.schedule(new Date(), ...)` would not fire - Fixed an issue where schedules that took longer than 30 seconds would occasionally time out - Fixed SSE transport now properly forwards session IDs and request headers - Fixed AI SDK stream events conversion to UIMessageStreamPart diff --git a/src/content/changelog/agents/2026-02-03-agents-workflows-integration.mdx b/src/content/changelog/agents/2026-02-03-agents-workflows-integration.mdx index 7fd6157f3c0..20fac12d9a9 100644 --- a/src/content/changelog/agents/2026-02-03-agents-workflows-integration.mdx +++ b/src/content/changelog/agents/2026-02-03-agents-workflows-integration.mdx @@ -175,4 +175,4 @@ To update to the latest version: npm i agents@latest ``` -For the complete Workflows API reference and patterns, see [Run Workflows](/agents/agent-class/run-workflows/). +For the complete Workflows API reference and patterns, refer to [Run Workflows](/agents/agent-class/run-workflows/). diff --git a/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx index 01093055962..abb8da7b93a 100644 --- a/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx +++ b/src/content/changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx @@ -73,7 +73,7 @@ class MyAgent extends Agent { Connections with protocol messages disabled still fully participate in RPC and regular messaging. Use `isConnectionProtocolEnabled(connection)` to check a connection's status at any time. The flag persists across Durable Object hibernation. -See [Protocol messages](/agents/agent-class/protocol-messages/) for full documentation. +Refer to [Protocol messages](/agents/agent-class/protocol-messages/) for full documentation. ## `@cloudflare/ai-chat` v0.1.0 @@ -81,7 +81,7 @@ The first stable release of `@cloudflare/ai-chat` ships alongside this release w Key new features: -- **Data parts** — Attach typed JSON blobs (`data-*`) to messages alongside text. Supports reconciliation (type+id updates in-place), append, and transient parts (ephemeral via `onData` callback). See [Data parts](/agents/agent-class/communication-channels/chat/chat-agents/#data-parts). +- **Data parts** — Attach typed JSON blobs (`data-*`) to messages alongside text. Supports reconciliation (type+id updates in-place), append, and transient parts (ephemeral via `onData` callback). Refer to [Data parts](/agents/agent-class/communication-channels/chat/chat-agents/#data-parts). - **Tool approval persistence** — The `needsApproval` approval UI now survives page refresh and DO hibernation. The streaming message is persisted to SQLite when a tool enters `approval-requested` state. - **`maxPersistedMessages`** — Cap SQLite message storage with automatic oldest-message deletion. - **`body` option on `useAgentChat`** — Send custom data with every request (static or dynamic). diff --git a/src/content/docs/agents/agent-class/communication-channels/chat/autonomous-responses.mdx b/src/content/docs/agents/agent-class/communication-channels/chat/autonomous-responses.mdx index 52768f99752..cb344e872e0 100644 --- a/src/content/docs/agents/agent-class/communication-channels/chat/autonomous-responses.mdx +++ b/src/content/docs/agents/agent-class/communication-channels/chat/autonomous-responses.mdx @@ -66,7 +66,7 @@ return Response.json({ `submitMessages()` stores pending work first and appends the messages to the conversation Session only when the submission starts executing. It accepts serializable `UIMessage[]` values, not the function form supported by `saveMessages((messages) => ...)`. -Use [`startFiber()`](/agents/agent-class/durable-execution/#startfiber) outside Think when the durable unit is a surrounding application job, such as accepting a webhook once, restoring provider state, posting a visible reply, and recording recovery policy. `submitMessages()` owns Think's conversation admission; managed fibers own external side effects around that turn. +Use [`startFiber()`](/agents/agent-class/durable-execution/#startfiber) outside Think when the durable unit is a surrounding application job, such as accepting a webhook once, restoring provider state, posting a visible reply, and recording recovery policy. `submitMessages()` owns Think's conversation admission. Managed fibers own external side effects around that turn. For the full Think API, refer to [`submitMessages()`](/agents/harnesses/think/programmatic-submissions/#submitmessages). ### When to use `saveMessages` vs `onChatResponse` diff --git a/src/content/docs/agents/concepts/agentic-patterns/long-running-agents.mdx b/src/content/docs/agents/concepts/agentic-patterns/long-running-agents.mdx index 32a33b9c9af..8e99398d8fc 100644 --- a/src/content/docs/agents/concepts/agentic-patterns/long-running-agents.mdx +++ b/src/content/docs/agents/concepts/agentic-patterns/long-running-agents.mdx @@ -229,7 +229,7 @@ An agent can be evicted at any time — a deploy, a platform restart, or hitting [`runFiber()`](/agents/agent-class/durable-execution/) provides crash-recoverable execution. It persists a row in SQLite for the duration of the work, and lets you `stash()` intermediate state. If the agent is evicted, the fiber row survives, and `onFiberRecovered()` is called on the next activation. -Use [`startFiber()`](/agents/agent-class/durable-execution/#startfiber) when the important boundary is durable acceptance. It adds an idempotency key, retained status records, inspection, cancellation, and cleanup on top of the same fiber machinery. By default it returns after acceptance; pass `waitForCompletion: true` when the request should stay open until the accepted job reaches a terminal status. This is a good fit for webhooks where the provider may retry delivery and the agent must avoid starting duplicate visible side effects. +Use [`startFiber()`](/agents/agent-class/durable-execution/#startfiber) when the important boundary is durable acceptance. It adds an idempotency key, retained status records, inspection, cancellation, and cleanup on top of the same fiber machinery. By default it returns after acceptance. Pass `waitForCompletion: true` when the request should stay open until the accepted job reaches a terminal status. This is a good fit for webhooks where the provider may retry delivery and the agent must avoid starting duplicate visible side effects. ```ts export class ProjectManager extends Agent {