Why it matters
This drill simulates the most common production incident in agent systems: a run that keeps calling tools and never finishes. Under time pressure the temptation is to edit the prompt and retry, which occasionally works and teaches nothing. The interviewer is watching for a diagnostic order: read the trace, classify the repetition, inspect the observation, test the tool, then change one thing. Naming the check before running it is what separates debugging from guessing.
Mental model
It is a stuck elevator: the panel lights show the same floor repeatedly, and you check the sensor before pressing buttons harder. The metaphor breaks because the agent can also be following a correct sensor into a bad plan, so both the signal and the policy need checking.
How it works
- 1Ask for the full trajectory with tool names, arguments and observations, and read it before proposing a cause.
- 2Mark the first point where the run stops making progress and describe the repetition pattern.
- 3Form one hypothesis and state the observation that would confirm or refute it.
- 4Inspect the tool result at that step, including whether state actually changed.
- 5Apply one fix, either to the observation quality or to the termination rule, and re-run the same input.
- 6Show the new trace and confirm the run ends, then add the case to a regression set.
Step 1 of 6
Ask for the full trajectory with tool names, arguments and observations, and read it before proposing a cause.
Figure. The mechanism in this page's own steps. The figure adds sequence, not new claims.
What to notice. A step can be read alone, but the order is the mechanism. The control lets you stop on any one.
Text version
The page's steps: 1. Ask for the full trajectory with tool names, arguments and observations, and read it befo… 2. Mark the first point where the run stops making progress and describe the repetition patt… 3. Form one hypothesis and state the observation that would confirm or refute it. 4. Inspect the tool result at that step, including whether state actually changed. 5. Apply one fix, either to the observation quality or to the termination rule, and re-run t… 6. Show the new trace and confirm the run ends, then add the case to a regression set.
- Ask for the full trajectory with tool names, arguments and observations, and read it before proposing a cause.
- Mark the first point where the run stops making progress and describe the repetition pattern.
- Form one hypothesis and state the observation that would confirm or refute it.
- Inspect the tool result at that step, including whether state actually changed.
- Apply one fix, either to the observation quality or to the termination rule, and re-run the same input.
- Show the new trace and confirm the run ends, then add the case to a regression set.
Trade-offs
| Choice | Good for | Cost | Fails when |
|---|---|---|---|
| Cap steps immediately | Stops the bleeding | Masks the cause and returns partial work | The task genuinely needs more steps |
| Improve the error message | Addresses the common cause | Does not help a planning loop | The tool reported success |
| Add a no-progress detector | Catches repetition generically | False positives on polling | The tool is asynchronous |
| Change the prompt | Sometimes unblocks quickly | Leaves the mechanism intact | The observation never changes |
Good for
Stops the bleeding
Cost
Masks the cause and returns partial work
Fails when
The task genuinely needs more steps
- The task genuinely needs more steps
- The tool reported success
- The tool is asynchronous
- The observation never changes
Figure. Each choice with what it buys, what it costs, and the case where it loses.
What to notice. The fourth column is the decision: if the losing case describes your situation, the choice is wrong.
Text version
Four trade-offs: Cap steps immediately is good for Stops the bleeding, costs Masks the cause and returns partial work, and fails when The task genuinely needs more steps. Improve the error message is good for Addresses the common cause, costs Does not help a planning loop, and fails when The tool reported success. Add a no-progress detector is good for Catches repetition generically, costs False positives on polling, and fails when The tool is asynchronous. Change the prompt is good for Sometimes unblocks quickly, costs Leaves the mechanism intact, and fails when The observation never changes
Failure modes
- Prompt-first debugging. The run changes behaviour for one input and the mechanism remains. Debug: re-run a second failing input after the prompt change and compare.
- Misread trace. The repeated call is assumed identical but the arguments differ each time. Debug: hash the tool arguments per step and compare consecutive hashes.
- Unbounded debugging. The drill burns its time on repeated live runs. Debug: count how many full runs you have executed and cap them.
In production
Rehearse this drill with a real trace from a system you built, and keep a step cap and a per-request spend cap configured while you debug.
Common misconceptions
People think: The interviewer expects an immediate fix.
Actually: They expect a diagnostic order and a stated hypothesis; a lucky fix without a cause scores poorly.
People think: Loops are always the model's fault.
Actually: Tool contracts and termination rules cause most repetitions, and they are cheaper to verify.
Interview angle
Strong answers narrate the trace, classify the loop, state a hypothesis and verify it with one change. Weak answers propose prompt edits before reading the observations.
Sources
- Anthropic, Building effective agents — loop design and stopping conditions.
- OpenTelemetry GenAI semantic conventions — what a useful agent trace records per step.
- Shinn et al., Reflexion — failure without reflection repeats.