langchain/tests/unit_tests/agents
Zach Jones 13d1df2140
Feature: AgentExecutor execution time limit (#2399)
`AgentExecutor` already has support for limiting the number of
iterations. But the amount of time taken for each iteration can vary
quite a bit, so it is difficult to place limits on the execution time.
This PR adds a new field `max_execution_time` to the `AgentExecutor`
model. When called asynchronously, the agent loop is wrapped in an
`asyncio.timeout()` context which triggers the early stopping response
if the time limit is reached. When called synchronously, the agent loop
checks for both the max_iteration limit and the time limit after each
iteration.

When used asynchronously `max_execution_time` gives really tight control
over the max time for an execution chain. When used synchronously, the
chain can unfortunately exceed max_execution_time, but it still gives
more control than trying to estimate the number of max_iterations needed
to cap the execution time.

---------

Co-authored-by: Zachary Jones <zjones@zetaglobal.com>
2023-04-06 12:54:32 -07:00
..
__init__.py
test_agent.py Feature: AgentExecutor execution time limit (#2399) 2023-04-06 12:54:32 -07:00
test_mrkl.py Fix issue#1645: Parse llm_output even there's newline (#2092) (#2099) 2023-03-28 08:14:09 -07:00
test_react.py Removed duplicate BaseModel dependencies (#2471) 2023-04-06 12:45:16 -07:00
test_tools.py rfc: callback changes (#1165) 2023-02-20 22:54:15 -08:00