You cap the agent at 10 iterations to stop runaways.
It hits the cap mid-task and returns a half-finished answer as if done.
- AJust raise the cap to 50 and hope it finishes.
- BRemove the cap and let the agent run until its own goal check says the task is complete, however many steps that takes.
- CKeep the cap AND an explicit goal check, and treat hitting the cap as a failure to surface - not a success.
- DRestart the whole task from scratch whenever the cap is hit.
Answer: C
Keep the cap AND an explicit goal check, and treat hitting the cap as a failure to surface - not a success.
Why
A budget stops runaways; a goal check decides when it is actually done. Keep both, and treat a cap-hit as an explicit failure - never dress up a truncated run as a success.
- Agent loopsThe same step fails the same way on every pass of the loop.
- Agent loopsThe agent alternates between two fixes forever: each one undoes the other, and both look reasonable in isolation.
- Agent loopsYour ReAct agent calls the same search with the same query five times in a row and never finishes.
- Agent loopsYour agent is stuck in a loop - it keeps making the same tool call over and over.
More on Way of the Agent
- Course programThe first three modules are free: start in the browser or the app, no card needed.
- Library: guides, skills and promptsReady prompt templates, grouped into collections.
- AI ChroniclesSourced stories from the history of AI.
- ConceptsPlain-language explainers of agent engineering.
- Learn AI agentsApps and courses for learning AI agents, compared honestly.
Real situations from building agents - with the answer and why.
Solve a new one every day on the Path