Notes ยท Munna Suprathik
The Agent That Looped Forever
By Munna Suprathik, Generative AI Engineer.
There is a specific kind of quiet that means something is wrong. No error in the logs, no stack trace, just a token counter climbing and climbing while nothing ships.
My multi-agent graph on LangGraph had gotten into an argument with itself. A worker agent called a tool, disliked the result, and called it again with almost the same arguments. The planner kept re-planning around a subtask that never resolved. Each loop looked reasonable in isolation. Together they were a very expensive way to accomplish nothing, and because everything "succeeded," nothing alerted me.
Every step reasonable, the whole thing going nowhere.
The fix was unglamorous and I should have built it first. A hard step budget per run. A memory of the last few actions, so a repeated tool call with repeated arguments trips a circuit breaker. And an explicit rule that if two passes produce the same plan, you stop and return whatever you have with a note that you got stuck. The mistake was thinking about what the agent could do and never about when it should give up.
Now I design the exit before I design the loop.
Autonomy without a stopping condition is not autonomy, it is a while-true loop with a language model attached.