Lesson 03.12 · Phase 03 · The Agent Loop

Debugging a stuck loop

A stuck agent doesn't crash. It politely does the same useless thing until the budget runs out. Name the pattern, then intervene.

Learning objectives

  • Recognise the five shapes of a stuck or broken run: repeated calls, oscillation, error streaks, no progress, and premature stops.
  • Implement detectors that read a transcript and report what's wrong, at which step, with a suggested fix.
  • Read traces in more than one format (native tool calls and text ReAct) with one set of detectors.
  • Build a watchdog that intervenes during a run: a specific nudge first, then a forced answer.

Lesson 2's live run asked llama3.2 how many times taller the Eiffel Tower is than the Statue of Liberty. It ran until maxsteps without an answer, using every step. Nothing crashed, nothing logged an error, and the step budget did its job. But all you learn from stop: maxsteps is that it failed, not why.

Loading the full lesson…