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 17ffb6b2_fdd9_29f3_ea89_3211cf54065f["return_stopped_response()"] 3b9abff9_c907_d2e1_41bb_cbceeb6d27f4["BaseSingleActionAgent"] 17ffb6b2_fdd9_29f3_ea89_3211cf54065f -->|defined in| 3b9abff9_c907_d2e1_41bb_cbceeb6d27f4 d5615fad_7511_8934_27f8_61cead3ea814["return_stopped_response()"] d5615fad_7511_8934_27f8_61cead3ea814 -->|calls| 17ffb6b2_fdd9_29f3_ea89_3211cf54065f 91ad3c4b_7d4d_167d_7a4e_117cb9d64e89["return_stopped_response()"] 91ad3c4b_7d4d_167d_7a4e_117cb9d64e89 -->|calls| 17ffb6b2_fdd9_29f3_ea89_3211cf54065f d5615fad_7511_8934_27f8_61cead3ea814["return_stopped_response()"] 17ffb6b2_fdd9_29f3_ea89_3211cf54065f -->|calls| d5615fad_7511_8934_27f8_61cead3ea814 style 17ffb6b2_fdd9_29f3_ea89_3211cf54065f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/agents/agent.py lines 110–136
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 iteration limit or time limit."},
"",
)
msg = f"Got unsupported early_stopping_method `{early_stopping_method}`"
raise ValueError(msg)
Domain
Subdomains
Source
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 110.
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 2 function(s): return_stopped_response, return_stopped_response.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free