Protocol
Write the completion condition before the agent starts iterating
An agent loop cannot finish reliably if 'done' exists only in the model's mood.
When it fits
- An agent is told to 'keep improving' or 'work until done' without an external definition of done.
When to avoid it
- Open-ended creative work may need a human accept/reject condition rather than an objective test.
Why it matters
Define the observable completion state outside the loop: tests pass, required files exist, all checklist items are satisfied, source coverage reaches a threshold, or another verifiable condition. Keep subjective quality separate from mandatory completion so the agent does not keep polishing indefinitely.
Steps
- Completion is observable outside the model's narrative.
- Mandatory outputs are explicit.
- Quality improvements are separated from hard done criteria.
- A human or grader can verify the state without trusting 'I finished.'
An example
For a repo task, completion means the requested files changed, tests pass and the final diff contains no unrelated edits—not 'the implementation looks good now.'
Check your result
A separate evaluator could decide done/not-done from artifacts and state.
Keep this limit in mind
- Open-ended creative work may need a human accept/reject condition rather than an objective test.
Connected ideas
Use beforeKeep an eval set that can embarrass the agent
Evidence and sources
Agent-loop frameworks rely on explicit completion conditions; evaluation guidance likewise recommends unambiguous tasks and success criteria.
Open-ended creative work may need a human accept/reject condition rather than an objective test.
Agent Looping · See source record