Lion Cipher Lab

Detect a stuck agent's repeating tool-call loop with state fingerprints, without killing legitimate polling

Why it matters

An AI agent that hunts threats or works incidents runs in a loop: think, call a tool, read the result, think again. Sometimes that loop gets stuck. It asks the SIEM the same question over and over. It flips between two tools forever. It keeps asking for page one of the results because its cursor keeps resetting. Each turn costs tokens, time and API quota, and while it spins it is not doing the investigation you needed. The usual safety net is a step budget - stop after 60 calls - and the fleet-governance lab shows how to meter and cap that spend. But a budget only stops a loop at the end,…

What you'll learn

Steps in this lab

  1. The words first: agent loop, trace, stuck loop, fingerprint, volatile field, cycle - and the fact that the agent is a stub
  2. Open a terminal, check Python, make a scratch folder (Windows, macOS, Linux)
  3. One-step recap: what the fleet-governance lab already gives you, and what it cannot see
  4. Build 200 keyed traces: 130 healthy runs and 70 stuck ones
  5. Write the four detectors and watch the fingerprints on two tiny runs
  6. Measure: loops caught, latency, tokens wasted, and healthy runs killed
  7. Read it honestly: D2 kills healthy polling, and D3 does not fix everything
  8. The negatives with numbers: slow drift, a backstop that has its own price, and over-normalizing
  9. Why this, not that - and when NOT to use a loop detector
  10. The way a pro does it: per-tool rules, a soft trip first, and the trip as a logged event
  11. Ship it: wrap the detector around your own agent loop, then break the stub on purpose

Open the full interactive lab →