A recorded automated loop showed why a deterministic guard was needed. I added
a check before the next model call to bound the conversation and label the
outcome explicitly.
The agent reached people through phone channels, which sometimes route into an
automated menu or IVR rather than a person. Those systems reply with the same
canned line forever. Without a guard, the agent treats each canned reply as a new
turn and answers again — indefinitely.
Repetition guard — if the same normalized inbound repeats enough times
inside a short window (with a minimum length, so "ok"/"sim" don't trip it), it
is a machine.
Turn-cap guard — if the agent has taken far more turns than any real
negotiation should, stop regardless.
Loop detector
The check runs before model setup, so a detected loop costs nothing more.
Two design choices mattered most. First, the guard runs before model setup,
so catching a loop avoids the model calls instead of paying for them. Second, a
detected loop gets its own terminal status — "automated counterpart" — not
"failure". That distinction is the difference between a metric you can trust and a
bucket that hides a systemic problem.
The deterministic check can be tested against false positives, such as short
acknowledgements and interleaved real replies that a naive repetition check
would misclassify.
Some of the highest-leverage AI-safety work is not in the model at all. A few
lines of deterministic logic, placed before the expensive call and paired with an
honest status, turned an open-ended cost and a metrics blind spot into a bounded,
observable event.