Home / Function/ test_agent_iterator_custom_stopping_condition() — langchain Function Reference

test_agent_iterator_custom_stopping_condition() — langchain Function Reference

Architecture documentation for the test_agent_iterator_custom_stopping_condition() function in test_agent_iterator.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3ccb2260_33bd_1adf_e5fd_57b4256975f6["test_agent_iterator_custom_stopping_condition()"]
  2423e003_42f4_7c6a_3fba_30db54c07a0c["test_agent_iterator.py"]
  3ccb2260_33bd_1adf_e5fd_57b4256975f6 -->|defined in| 2423e003_42f4_7c6a_3fba_30db54c07a0c
  a825180e_890c_af0f_6e56_99b57c6c526b["_should_continue()"]
  3ccb2260_33bd_1adf_e5fd_57b4256975f6 -->|calls| a825180e_890c_af0f_6e56_99b57c6c526b
  style 3ccb2260_33bd_1adf_e5fd_57b4256975f6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/agents/test_agent_iterator.py lines 340–352

def test_agent_iterator_custom_stopping_condition() -> None:
    """Test AgentExecutorIterator with a custom stopping condition."""
    agent = _get_agent()

    class CustomAgentExecutorIterator(AgentExecutorIterator):
        def _should_continue(self) -> bool:
            return self.iterations < 2  # Custom stopping condition

    agent_iter = CustomAgentExecutorIterator(agent, inputs="when was langchain made")

    outputs = list(agent_iter)

    assert len(outputs) == 2  # Check if the custom stopping condition is respected

Domain

Subdomains

Frequently Asked Questions

What does test_agent_iterator_custom_stopping_condition() do?
test_agent_iterator_custom_stopping_condition() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/test_agent_iterator.py.
Where is test_agent_iterator_custom_stopping_condition() defined?
test_agent_iterator_custom_stopping_condition() is defined in libs/langchain/tests/unit_tests/agents/test_agent_iterator.py at line 340.
What does test_agent_iterator_custom_stopping_condition() call?
test_agent_iterator_custom_stopping_condition() calls 1 function(s): _should_continue.

Analyze Your Own Codebase

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

Try Supermodel Free