Skip to content

Lesson 6 of 6 · 6 min read

Stuck-Loop Detectors: Repeats, Cycles and No Progress

A step limit catches a stuck agent at the step limit, after the budget is mostly spent. A stuck-loop detector catches it within a few calls, by watching the sequence of tool calls for a repeating pattern. Three details make it useful rather than noisy. Calls are normalised before comparison, so a changed request id or a reworded argument still counts as the same call. The detector looks for a period, not only an exact repeat, so an agent alternating between two calls is caught as well as one repeating a single call. And a repeating pattern counts as stuck only when the results repeat too: an agent polling a job whose state changes is working, not stuck. The detector's output is an action, not a flag. The first detection sends the model a short note with the evidence, because models often recover when told what they are doing; the second ends the run with a named exit the caller can count.

Premium lessonReviewed By the AIAgentInterviews editorial team
Get full Premium access · $25

All 19 topics with every worked answer, all lessons and courses, the full practice bank, and anything new that appears during your access.

6 months · One payment · No auto-renewal

Practise it as an interviewer asks it

Related lessons