An agent that retries is useful. An agent that retries the same failing call with slightly different wording forty times is an outage with a bill attached. This adds explicit termination: a hard step ceiling, a repeat detector that catches near identical attempts, and a rule that a failure escalates rather than being retried differently. The important part is that stopping produces a structured failure the caller can act on, not silence.
Tools / stack
Inputs required
The agent’s system prompt and loop code, plus a trace of a run that spiralled
Steps
- 1.Set a hard maximum step count enforced in code, not requested in the prompt. A prompt level limit is a suggestion.
- 2.Add a repeat detector that compares each tool call against the previous three, treating near identical calls as a repeat rather than requiring exact matches.
- 3.On a detected repeat, stop rather than nudging. A nudged agent usually produces a fourth variation of the same call.
- 4.Add a token budget per run, checked between steps, with a hard stop when exceeded.
- 5.Make every termination produce a structured failure containing the reason, the step count, and the last attempted call.
- 6.Replay the spiral trace against the bounded loop and confirm it now stops, and record at which step.
Expected output
A bounded agent loop, plus a replay of the original spiral showing where it now terminates and what structured failure it returns
Golden Example
Trace of an agent that made 61 near identical search calls before hitting the platform timeout, plus the loop code
Bounded to 12 steps with a repeat detector on a three call window. Replay terminated at step 7 with reason “repeated_call”, the step count, and the last attempted arguments. Token spend on the replay was 4 percent of the original run.
Sign in to verify this playbook: run it and log what happened.
Reports
0 reports
Raw reproduction reports: evidence, not a verified badge yet.
No reports yet.
Run it and log the result. Be the first to prove it works.