How do you detect a looping agent in production?

Watch for the shape a stuck loop always leaves in a trace: the same tool call or model call repeating with near-identical arguments while turn count, duration, or cost keeps climbing well past what that call site normally takes. A looping agent doesn’t throw an error or hang in any way monitoring would flag on its own, since the model keeps generating fluent, plausible steps the whole time; the giveaway is the pattern across the session, not any single step in it.

Static analysis, scanning an agent’s own code for a cycle with no real limit on it, catches this before a change ships, but it’s a one-time check on code you have, not something watching live traffic after the fact. Production detection is the layer that catches what a code review can’t: an agent that loops because of a runtime condition the code review never exercised. Tessary’s duration_drift and cost_drift classifiers watch exactly that per call site, comparing each session’s cost and duration against its own history rather than a fixed threshold, since what’s slow or expensive for one agent is routine for another.

sources

keep reading

More on this.

Self-host Tessary.

Free and open source. Point it at the traces your agent already emits.

Self-host Tessary for me by following https://github.com/tessaryai/tessary/blob/main/setup.md

docker compose -f oci://docker.io/tessaryai/tessary:compose up -d -y