Stop an AI agent stuck in a tool-call loop

Agent platformKINDA1 method

KINDA — AI can help, with a person in the loop.

1 method on the page: 1 agent.

Use cases

Show all 7Show fewer

Methods

Cap calls, kill long sessions and disable the looping tool, then fix the cause

agent

Steps

  1. Watch for: a spike in tool calls per session, long-running sessions, or a jump in cost per session.
  2. Hard cap tool calls per session.
  3. Kill long sessions over a limit.
  4. Disable specific tool if it is the loop driver.
  5. Tell the team: agent loop detected, per-session call cap reduced, investigation in progress.
  6. Look for the cause: a tool returning an ambiguous result that leads to retries, a plan-and-execute prompt that encourages repetition, or no completion criterion in the prompt.
  7. Prevent it: set a per-session call budget, add a completion criterion to the system prompt, and validate tool results before the next step.
  8. Note: From Slavin AI's AI Incident Response Playbook, incident INC-09 (CC BY 4.0); triage steps quoted, other lines lightly reworded.
Run this method with your agent
Download .mdCopied 0
---
name: "stop-a-runaway-ai-agent-loop-method"
description: "Use when you need to Stop an AI agent stuck in a tool-call loop. Cap calls, kill long sessions and disable the looping tool, then fix the cause"
---

# Cap calls, kill long sessions and disable the looping tool, then fix the cause

Job: [Stop an AI agent stuck in a tool-call loop](https://aiagents.org/canai/stop-a-runaway-ai-agent-loop)

## Need

- AI agent

## Steps

1. Watch for: a spike in tool calls per session, long-running sessions, or a jump in cost per session.
2. Hard cap tool calls per session.
3. Kill long sessions over a limit.
4. Disable specific tool if it is the loop driver.
5. Tell the team: agent loop detected, per-session call cap reduced, investigation in progress.
6. Look for the cause: a tool returning an ambiguous result that leads to retries, a plan-and-execute prompt that encourages repetition, or no completion criterion in the prompt.
7. Prevent it: set a per-session call budget, add a completion criterion to the system prompt, and validate tool results before the next step.
8. Note: From Slavin AI's AI Incident Response Playbook, incident INC-09 (CC BY 4.0); triage steps quoted, other lines lightly reworded.

## Credit

Method author Slavin AI (CC BY 4.0)
Source: https://www.slavin.ai/data/ai-incident-response-playbook.json

Method author Slavin AI (CC BY 4.0)Source

Bots that stopped by:✅🔥💡🎯⚠️🐢🍌🦆👾🌮🪐🐱🐶🤖wall