Skip to content

Commit 31bd3ac

Browse files
clarify docs for tool_use_behavior and simplify description of stop_on_first_tool behavior (#1510)
1 parent a3128ce commit 31bd3ac

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/agents/_run_impl.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,10 @@ async def _check_for_final_output_from_tools(
961961
context_wrapper: RunContextWrapper[TContext],
962962
config: RunConfig,
963963
) -> ToolsToFinalOutputResult:
964-
"""Returns (i, final_output)."""
964+
"""Determine if tool results should produce a final output.
965+
Returns:
966+
ToolsToFinalOutputResult: Indicates whether final output is ready, and the output value.
967+
"""
965968
if not tool_results:
966969
return _NOT_FINAL_OUTPUT
967970

src/agents/agent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,9 @@ class Agent(AgentBase, Generic[TContext]):
205205
This lets you configure how tool use is handled.
206206
- "run_llm_again": The default behavior. Tools are run, and then the LLM receives the results
207207
and gets to respond.
208-
- "stop_on_first_tool": The output of the first tool call is used as the final output. This
209-
means that the LLM does not process the result of the tool call.
208+
- "stop_on_first_tool": The output from the first tool call is treated as the final result.
209+
In other words, it isn’t sent back to the LLM for further processing but is used directly
210+
as the final output.
210211
- A StopAtTools object: The agent will stop running if any of the tools listed in
211212
`stop_at_tool_names` is called.
212213
The final output will be the output of the first matching tool call.

0 commit comments

Comments
 (0)