Every agent run has a turn limit and a token budget
An agent that loops between two tools will loop until something stops it, and the only things that stop it are a limit you set or the bill.
for (let turn = 0; turn < 40; turn++) { … }
if (usedTokens > 200_000) return giveUp("budget");Log the runs that hit the limit. Those are the bugs. A run that needs sixty turns is a task that should have been split.
ai-agentsreliability