Home / Function/ return_stopped_response() — langchain Function Reference

return_stopped_response() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  d5615fad_7511_8934_27f8_61cead3ea814["return_stopped_response()"]
  abf3bf27_12e4_7de1_8ae0_a05a97c163d3["BaseMultiActionAgent"]
  d5615fad_7511_8934_27f8_61cead3ea814 -->|defined in| abf3bf27_12e4_7de1_8ae0_a05a97c163d3
  17ffb6b2_fdd9_29f3_ea89_3211cf54065f["return_stopped_response()"]
  17ffb6b2_fdd9_29f3_ea89_3211cf54065f -->|calls| d5615fad_7511_8934_27f8_61cead3ea814
  17ffb6b2_fdd9_29f3_ea89_3211cf54065f["return_stopped_response()"]
  d5615fad_7511_8934_27f8_61cead3ea814 -->|calls| 17ffb6b2_fdd9_29f3_ea89_3211cf54065f
  style d5615fad_7511_8934_27f8_61cead3ea814 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/agent.py lines 280–303

    def return_stopped_response(
        self,
        early_stopping_method: str,
        intermediate_steps: list[tuple[AgentAction, str]],  # noqa: ARG002
        **_: Any,
    ) -> AgentFinish:
        """Return response when agent has been stopped due to max iterations.

        Args:
            early_stopping_method: Method to use for early stopping.
            intermediate_steps: Steps the LLM has taken to date,
                along with observations.

        Returns:
            Agent finish object.

        Raises:
            ValueError: If `early_stopping_method` is not supported.
        """
        if early_stopping_method == "force":
            # `force` just returns a constant string
            return AgentFinish({"output": "Agent stopped due to max iterations."}, "")
        msg = f"Got unsupported early_stopping_method `{early_stopping_method}`"
        raise ValueError(msg)

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free