Home / Function/ _should_continue() — langchain Function Reference

_should_continue() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3ae56802_4473_30c3_edb2_2b4283afafdf["_should_continue()"]
  493d4ce4_2303_08e0_2337_2bee34fe2662["AgentExecutor"]
  3ae56802_4473_30c3_edb2_2b4283afafdf -->|defined in| 493d4ce4_2303_08e0_2337_2bee34fe2662
  edf0069e_99f2_31ed_6ba2_2ed571e40c37["_call()"]
  edf0069e_99f2_31ed_6ba2_2ed571e40c37 -->|calls| 3ae56802_4473_30c3_edb2_2b4283afafdf
  0af1a14d_a510_7165_2c6d_4a48bbb56e65["_acall()"]
  0af1a14d_a510_7165_2c6d_4a48bbb56e65 -->|calls| 3ae56802_4473_30c3_edb2_2b4283afafdf
  style 3ae56802_4473_30c3_edb2_2b4283afafdf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/agent.py lines 1235–1238

    def _should_continue(self, iterations: int, time_elapsed: float) -> bool:
        if self.max_iterations is not None and iterations >= self.max_iterations:
            return False
        return self.max_execution_time is None or time_elapsed < self.max_execution_time

Subdomains

Called By

Frequently Asked Questions

What does _should_continue() do?
_should_continue() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/agent.py.
Where is _should_continue() defined?
_should_continue() is defined in libs/langchain/langchain_classic/agents/agent.py at line 1235.
What calls _should_continue()?
_should_continue() 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