Upper bound on number of iterations (#754)

Some custom agents might continue to iterate until they find the correct
answer, getting stuck on loops that generate request after request and
are really expensive for the end user. Putting an upper bound for the
number of iterations
by default controls this and can be explicitly tweaked by the user if
necessary.

Co-authored-by: Francisco Ingham <>
ankush/async-llmchain
Francisco Ingham 1 year ago committed by GitHub
parent 28efbb05bf
commit 374e510f94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -199,7 +199,7 @@ class AgentExecutor(Chain, BaseModel):
agent: Agent
tools: List[Tool]
return_intermediate_steps: bool = False
max_iterations: Optional[int] = None
max_iterations: Optional[int] = 15
early_stopping_method: str = "force"
@classmethod

Loading…
Cancel
Save