test_agent_async_iterator_stopped_early() — langchain Function Reference
Architecture documentation for the test_agent_async_iterator_stopped_early() function in test_agent_iterator.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 561a0eca_e14e_e73d_b6fa_4e4261dfb87d["test_agent_async_iterator_stopped_early()"] 2423e003_42f4_7c6a_3fba_30db54c07a0c["test_agent_iterator.py"] 561a0eca_e14e_e73d_b6fa_4e4261dfb87d -->|defined in| 2423e003_42f4_7c6a_3fba_30db54c07a0c style 561a0eca_e14e_e73d_b6fa_4e4261dfb87d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/agents/test_agent_iterator.py lines 61–90
async def test_agent_async_iterator_stopped_early() -> None:
"""Test when async react chain iterator is stopped early.
Test react chain async iterator when max iterations or
max execution time is exceeded.
"""
# iteration limit
agent = _get_agent(max_iterations=1)
agent_async_iter = agent.iter(inputs="when was langchain made")
assert isinstance(agent_async_iter, AgentExecutorIterator)
outputs = list(agent_async_iter)
assert isinstance(outputs[-1], dict)
assert (
outputs[-1]["output"] == "Agent stopped due to iteration limit or time limit."
)
# execution time limit
agent = _get_agent(max_execution_time=1e-5)
agent_async_iter = agent.iter(inputs="when was langchain made")
assert isinstance(agent_async_iter, AgentExecutorIterator)
outputs = []
async for step in agent_async_iter:
outputs.append(step)
assert (
outputs[-1]["output"] == "Agent stopped due to iteration limit or time limit."
)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_agent_async_iterator_stopped_early() do?
test_agent_async_iterator_stopped_early() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/test_agent_iterator.py.
Where is test_agent_async_iterator_stopped_early() defined?
test_agent_async_iterator_stopped_early() is defined in libs/langchain/tests/unit_tests/agents/test_agent_iterator.py at line 61.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free