_get_tool_return() — langchain Function Reference
Architecture documentation for the _get_tool_return() function in agent.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 6318fe2c_c718_cc8e_b66f_30bc2f54d1dc["_get_tool_return()"] 493d4ce4_2303_08e0_2337_2bee34fe2662["AgentExecutor"] 6318fe2c_c718_cc8e_b66f_30bc2f54d1dc -->|defined in| 493d4ce4_2303_08e0_2337_2bee34fe2662 edf0069e_99f2_31ed_6ba2_2ed571e40c37["_call()"] edf0069e_99f2_31ed_6ba2_2ed571e40c37 -->|calls| 6318fe2c_c718_cc8e_b66f_30bc2f54d1dc 0af1a14d_a510_7165_2c6d_4a48bbb56e65["_acall()"] 0af1a14d_a510_7165_2c6d_4a48bbb56e65 -->|calls| 6318fe2c_c718_cc8e_b66f_30bc2f54d1dc style 6318fe2c_c718_cc8e_b66f_30bc2f54d1dc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/agents/agent.py lines 1697–1716
def _get_tool_return(
self,
next_step_output: tuple[AgentAction, str],
) -> AgentFinish | None:
"""Check if the tool is a returning tool."""
agent_action, observation = next_step_output
name_to_tool_map = {tool.name: tool for tool in self.tools}
return_value_key = "output"
if len(self._action_agent.return_values) > 0:
return_value_key = self._action_agent.return_values[0]
# Invalid tools won't be in the map, so we return False.
if (
agent_action.tool in name_to_tool_map
and name_to_tool_map[agent_action.tool].return_direct
):
return AgentFinish(
{return_value_key: observation},
"",
)
return None
Domain
Subdomains
Source
Frequently Asked Questions
What does _get_tool_return() do?
_get_tool_return() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/agent.py.
Where is _get_tool_return() defined?
_get_tool_return() is defined in libs/langchain/langchain_classic/agents/agent.py at line 1697.
What calls _get_tool_return()?
_get_tool_return() is called by 2 function(s): _acall, _call.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free