Skip to content

Commit 8f2f76c

Browse files
author
xianghuijin
committed
docs: Update tool_choice reset documentation to match implementation
1 parent bbcda75 commit 8f2f76c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: docs/agents.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ Supplying a list of tools doesn't always mean the LLM will use a tool. You can f
142142

143143
!!! note
144144

145-
To prevent infinite loops, the framework automatically resets `tool_choice` to "auto" after a tool call when it's set to "required" or a specific function name. This allows the model to decide whether to make additional tool calls in subsequent turns.
145+
To prevent infinite loops, the framework automatically resets `tool_choice` to "auto" after a tool call in the following scenarios:
146+
147+
1. When `tool_choice` is set to a specific function name (any string that's not "auto", "required", or "none")
148+
2. When `tool_choice` is set to "required" AND there is only one tool available
149+
150+
This targeted reset mechanism allows the model to decide whether to make additional tool calls in subsequent turns while avoiding infinite loops in these specific cases.
146151

147152
If you want the Agent to completely stop after a tool call (rather than continuing with auto mode), you can set [`Agent.tool_use_behavior="stop_on_first_tool"`] which will directly use the tool output as the final response without further LLM processing.

0 commit comments

Comments
 (0)