Home / Function/ _return() — langchain Function Reference

_return() — langchain Function Reference

Architecture documentation for the _return() function in agent.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  edb6329e_28b7_5b52_d3e5_499df4131105["_return()"]
  493d4ce4_2303_08e0_2337_2bee34fe2662["AgentExecutor"]
  edb6329e_28b7_5b52_d3e5_499df4131105 -->|defined in| 493d4ce4_2303_08e0_2337_2bee34fe2662
  edf0069e_99f2_31ed_6ba2_2ed571e40c37["_call()"]
  edf0069e_99f2_31ed_6ba2_2ed571e40c37 -->|calls| edb6329e_28b7_5b52_d3e5_499df4131105
  style edb6329e_28b7_5b52_d3e5_499df4131105 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/agent.py lines 1240–1251

    def _return(
        self,
        output: AgentFinish,
        intermediate_steps: list,
        run_manager: CallbackManagerForChainRun | None = None,
    ) -> dict[str, Any]:
        if run_manager:
            run_manager.on_agent_finish(output, color="green", verbose=self.verbose)
        final_output = output.return_values
        if self.return_intermediate_steps:
            final_output["intermediate_steps"] = intermediate_steps
        return final_output

Subdomains

Called By

Frequently Asked Questions

What does _return() do?
_return() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/agent.py.
Where is _return() defined?
_return() is defined in libs/langchain/langchain_classic/agents/agent.py at line 1240.
What calls _return()?
_return() is called by 1 function(s): _call.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free