_process_next_step_output() — langchain Function Reference
Architecture documentation for the _process_next_step_output() function in agent_iterator.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD d5f8bce5_089f_ce88_6683_139f191b2eb6["_process_next_step_output()"] 490b6bce_9d4c_017c_89ae_b13ea74223ea["AgentExecutorIterator"] d5f8bce5_089f_ce88_6683_139f191b2eb6 -->|defined in| 490b6bce_9d4c_017c_89ae_b13ea74223ea a9a06b32_02d8_cc0e_a2b9_4c37ea88936c["__iter__()"] a9a06b32_02d8_cc0e_a2b9_4c37ea88936c -->|calls| d5f8bce5_089f_ce88_6683_139f191b2eb6 4d87dde3_a32d_10d0_6e36_d6572758987b["_return()"] d5f8bce5_089f_ce88_6683_139f191b2eb6 -->|calls| 4d87dde3_a32d_10d0_6e36_d6572758987b style d5f8bce5_089f_ce88_6683_139f191b2eb6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/agents/agent_iterator.py lines 318–345
def _process_next_step_output(
self,
next_step_output: AgentFinish | list[tuple[AgentAction, str]],
run_manager: CallbackManagerForChainRun,
) -> AddableDict:
"""Process the output of the next step.
Process the output of the next step,
handling AgentFinish and tool return cases.
"""
logger.debug("Processing output of Agent loop step")
if isinstance(next_step_output, AgentFinish):
logger.debug(
"Hit AgentFinish: _return -> on_chain_end -> run final output logic",
)
return self._return(next_step_output, run_manager=run_manager)
self.intermediate_steps.extend(next_step_output)
logger.debug("Updated intermediate_steps with step output")
# Check for tool return
if len(next_step_output) == 1:
next_step_action = next_step_output[0]
tool_return = self.agent_executor._get_tool_return(next_step_action) # noqa: SLF001
if tool_return is not None:
return self._return(tool_return, run_manager=run_manager)
return AddableDict(intermediate_step=next_step_output)
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does _process_next_step_output() do?
_process_next_step_output() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/agent_iterator.py.
Where is _process_next_step_output() defined?
_process_next_step_output() is defined in libs/langchain/langchain_classic/agents/agent_iterator.py at line 318.
What does _process_next_step_output() call?
_process_next_step_output() calls 1 function(s): _return.
What calls _process_next_step_output()?
_process_next_step_output() is called by 1 function(s): __iter__.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free