Asked about Budgets, loops and giving up well

An agent keeps calling the same tool with the same arguments. What do you do?

An answer that works

Detect the repeat by hashing the tool name and arguments, and when it repeats, return a result telling the model it is stuck and should try something else. Killing the run is the fallback if that does not work.

Reading an answer is not being able to give one. The section that teaches this is Budgets, loops and giving up well, 3 hours of The agent loop.

Learn this properly