🇪🇸 Español 🇬🇧 English 🇧🇷 Português

Escalate to a human after N replies without resolving (anti-loop lock)

How to turn on the deterministic lock that forces a handoff to a human after your AI agent has replied N times without resolving the case.

Jul 11, 2026

The anti-loop lock is a deterministic safety net: the system counts, in code, how many consecutive replies the AI agent has sent in the current segment without the conversation being resolved, and forces a human handoff once it hits the number you set. It doesn't depend on the model "realizing" it's stuck — the system makes the call.

Requirements

  • An active AI agent with at least one fallback destination configured (where to escalate to).
  • Access to the agent editor's Behavior tab.

Setup

  1. Open the agent under AI Agents and go to the Behavior tab.
  2. Find the "Escalate to a human after N replies without resolving" field.
  3. Enter the number N of consecutive bot replies you'll tolerate before escalating (0 or empty = disabled, the default for every new agent).
  4. Set "What to do on escalation" (fallback_action): transfer to a specific human agent, transfer to a team, close the conversation, or no action.
  5. Save your changes.

How the lock counts

  • It only counts genuine bot replies (real outbound messages) — not transfer notes or off-schedule notices.
  • The count resets every time a human replies in the conversation — if a human agent picks up the chat and hands it back to the bot, the counter starts over from zero.
  • Once it hits N, the system automatically generates a context summary for the human (if you have that option enabled) and runs the configured fallback action.

Example

You set N=3 with fallback_action = "Transfer to team" → Support team. A customer asks the bot the same technical question three different ways, and the agent replies three times without the customer confirming it's resolved. On the fourth turn, the system doesn't let the bot reply again: it automatically transfers the conversation to the Support team with a summary of what was discussed.

Tips

  • N=3 or N=4 is a reasonable starting point for technical support agents; N=2 works better for sales agents, where every message without progress is more costly.
  • Combine it with the confidence threshold (auto_handoff_confidence_threshold) to cover two different scenarios: low model confidence (immediate escalation) and objective stalling (count-based escalation).
  • Test the behavior in the Sandbox by simulating several turns in a row before shipping it to production.

Troubleshooting

  • "I set N but it never escalates": check that the saved value isn't 0 or empty, and that the fallback team/agent exists and is active.
  • "It escalates too early": check whether one of your bot's messages is being counted as a genuine reply when it's actually a transfer note — this usually resolves itself, since the system automatically excludes those events.
Was this helpful?

Related articles