docs(agents): updates for agents 0.7.0 release#28695
Conversation
Revise and expand agent docs: introduce structured observability (diagnostics channels, subscribe helper, Tail Workers) and provide an event reference; update MCP client docs with URL security rules, idempotency/URL normalization details, and this.mcp.waitForConnections(); add AI chat doc improvements (requestId in onChatMessage, waitForMcpConnections option, and addToolOutput for custom denial messages); add keepAlive() and keepAliveWhile() scheduling APIs and usage guidance; clarify transport deduplication rules and adjust a few state handler names in examples. Various table/link updates and examples included for clarity.
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
|
/bonk could you fix the build failure please Error: 3 [ERROR] ✗ Found 2 invalid links in 1 file. |
Co-authored-by: threepointone <threepointone@users.noreply.github.com>
|
Fixed both invalid links in |
Summary
Documentation updates for the upcoming
agents@0.7.0release. Covers new features, API changes, and stale content that has drifted from the SDK since0.5.0.Changes
1.
keepAlive()/keepAliveWhile()— new API docs (schedule-tasks.mdx)Added full documentation for the new idle-eviction prevention API (cloudflare/agents#1029, #1033):
keepAlive()andkeepAliveWhile()signatures, parameters, return typesAIChatAgentuses it automaticallykeepAlive()for their use case@experimental2. Observability page rewrite (
observability.mdx)The entire observability page was stale — it described an old
console.log-basedObservability.emit()interface with incorrect event types (disconnect,message,error,queue:process). Rewrote from scratch to match the currentdiagnostics_channel-based implementation (cloudflare/agents#1024):agents:state,agents:rpc,agents:message,agents:schedule,agents:lifecycle,agents:workflow,agents:mcp)subscribe()helper — fromagents/observability, with type-narrowed callbacksnode:diagnostics_channel— for direct accessevent.diagnosticsChannelEventsObservabilityoverride — retained but updated with correct event types3.
callbackHostoptional for non-OAuth servers (mcp-client-api.mdx)Updated prose and code examples to clarify that
callbackHostis not needed when connecting to MCP servers that do not use OAuth (cloudflare/agents#963). Previously the examples always showedcallbackHost, which could mislead users into thinking it was required.4. MCP dedup behavior (
mcp-client-api.mdx,transport.mdx)Documented the updated
addMcpServerdeduplication logic:5.
agents-api.mdxquick reference tablekeepAlive()to the Scheduling rowobservability.emit()tosubscribe(), diagnostics channels, Tail Workers6.
addToolOutputwith custom denial messages (chat-agents.mdx)Documented the
output-errortype anderrorTextfield foraddToolOutput, allowing custom denial messages in human-in-the-loop tool approval flows (cloudflare/agents#967).Files changed
agents/api-reference/schedule-tasks.mdxkeepAlive(),keepAliveWhile()API ref + guide sectionagents/api-reference/observability.mdxagents/api-reference/mcp-client-api.mdxagents/model-context-protocol/transport.mdxagents/api-reference/agents-api.mdxagents/api-reference/chat-agents.mdxagents/api-reference/store-and-sync-state.mdxagents/api-reference/get-current-agent.mdxRelated PRs (agents repo)
Agent.keepAlive()Agent.keepAliveWhile()