From 9121ddbaaefddda2ca76628064534a0a97665032 Mon Sep 17 00:00:00 2001 From: Abishai-kashif <161566193+Abishai-kashif@users.noreply.github.com> Date: Sun, 17 Aug 2025 14:05:15 +0500 Subject: [PATCH 1/2] Update docstring in `_check_for_final_output_from_tools` to reflect correct return type --- src/agents/_run_impl.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/agents/_run_impl.py b/src/agents/_run_impl.py index 6e23e9507..6c417b308 100644 --- a/src/agents/_run_impl.py +++ b/src/agents/_run_impl.py @@ -961,7 +961,10 @@ async def _check_for_final_output_from_tools( context_wrapper: RunContextWrapper[TContext], config: RunConfig, ) -> ToolsToFinalOutputResult: - """Returns (i, final_output).""" + """Determine if tool results should produce a final output. + Returns: + ToolsToFinalOutputResult: Indicates whether final output is ready, and the output value. + """ if not tool_results: return _NOT_FINAL_OUTPUT From 799cf3e15b0621c3b40790f4ec3140d15773ba91 Mon Sep 17 00:00:00 2001 From: Abishai-kashif <161566193+Abishai-kashif@users.noreply.github.com> Date: Sun, 17 Aug 2025 14:48:04 +0500 Subject: [PATCH 2/2] Clarify that first tool call output is used directly as final result --- src/agents/agent.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/agents/agent.py b/src/agents/agent.py index 55de35e50..2be7595b5 100644 --- a/src/agents/agent.py +++ b/src/agents/agent.py @@ -205,8 +205,9 @@ class Agent(AgentBase, Generic[TContext]): This lets you configure how tool use is handled. - "run_llm_again": The default behavior. Tools are run, and then the LLM receives the results and gets to respond. - - "stop_on_first_tool": The output of the first tool call is used as the final output. This - means that the LLM does not process the result of the tool call. + - "stop_on_first_tool": The output from the first tool call is treated as the final result. + In other words, it isn’t sent back to the LLM for further processing but is used directly + as the final output. - A StopAtTools object: The agent will stop running if any of the tools listed in `stop_at_tool_names` is called. The final output will be the output of the first matching tool call.