Skip to content

docs: sync from cloudflare/agents PR #731 - refactor tools#27094

Closed
agents-git-bot[bot] wants to merge 1 commit into
productionfrom
sync-docs-pr-731
Closed

docs: sync from cloudflare/agents PR #731 - refactor tools#27094
agents-git-bot[bot] wants to merge 1 commit into
productionfrom
sync-docs-pr-731

Conversation

@agents-git-bot

@agents-git-bot agents-git-bot Bot commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR syncs documentation updates from cloudflare/agents PR #731 which introduces breaking changes to the Agents SDK's tool and chat APIs.

Changes

  • Breaking: Replace useAgent + useAgentChat two-hook pattern with unified useChat hook
  • Breaking: New declarative tool configuration using confirm and execute properties
  • Breaking: Simplified approval API with approve(id) and deny(id) instead of addToolResult()
  • Add documentation for TOOL_CONFIRMATION protocol constants
  • Update human-in-the-loop guide with complete examples using new API
  • Update Agents API reference with new useChat hook documentation

Source PR

Breaking Changes

These changes affect how users implement human-in-the-loop workflows:

Old pattern (deprecated):

const agent = useAgent({ agent: "my-agent" });
const { messages, sendMessage, addToolResult } = useAgentChat({
  agent,
  tools: clientTools,
  toolsRequiringConfirmation: ["toolA", "toolB"]
});
// Manual approval handling
addToolResult({ tool: "toolA", output: "Yes, confirmed.", toolCallId });

New pattern:

const { messages, sendMessage, approve, deny, pendingToolCalls } = useChat({
  agent: "my-agent",
  tools: clientTools // confirm property defines approval behavior
});
// Simple approval handling
approve(toolCallId);

Impact

  • All users implementing human-in-the-loop workflows will need to migrate to the new API
  • Tool configuration is now declarative with confirm: true/false instead of manual tracking lists
  • Significantly simpler API surface for common use cases

🤖 Generated with Claude Code

@agents-git-bot
agents-git-bot Bot requested a review from a team December 12, 2025 17:24
@github-actions github-actions Bot added product:agents Build and deploy AI-powered Agents on Cloudflare that can act autonomously. size/l labels Dec 12, 2025
@github-actions

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/agents/ @irvinebroque, @rita3ko, @elithrar, @thomasgauvin, @threepointone, @whoiskatrin, @cloudflare/pcx-technical-writing, @cloudflare/ai-agents

@agents-git-bot agents-git-bot Bot changed the title refactor tools Sync docs for PR #731: refactor tools Dec 12, 2025
@agents-git-bot agents-git-bot Bot changed the title Sync docs for PR #731: refactor tools Sync docs for PR #731: refactor tools (useChat hook + declarative tools) Dec 12, 2025
@agents-git-bot
agents-git-bot Bot force-pushed the sync-docs-pr-731 branch 3 times, most recently from de01ade to d7c601b Compare December 12, 2025 19:08
Updates documentation to reflect the breaking changes in PR #731:
- Replace useAgent + useAgentChat two-hook pattern with unified useChat hook
- Update human-in-the-loop guide with new declarative tool configuration
- Document new approve(id)/deny(id) API replacing addToolResult()
- Add TOOL_CONFIRMATION protocol constants documentation
- Update tool configuration to use confirm property instead of manual lists
- Simplify examples to show new streamlined API

This is a breaking change that affects how users implement human-in-the-loop
workflows with the Agents SDK.

Related PR: cloudflare/agents#731
@agents-git-bot agents-git-bot Bot changed the title Sync docs for PR #731: refactor tools (useChat hook + declarative tools) docs: sync from cloudflare/agents PR #731 - refactor tools Dec 12, 2025
@mattzcarey

Copy link
Copy Markdown
Contributor

underlying pr was closed

@mattzcarey mattzcarey closed this Jan 16, 2026
@github-actions
github-actions Bot deleted the sync-docs-pr-731 branch March 19, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:agents Build and deploy AI-powered Agents on Cloudflare that can act autonomously. size/l

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants