← All stories
discussionr/AI_Agents · Nov 15, 2026

Fixing AI agent tool-call loops: stop the loop outside the model, not inside it

A developer's agent kept repeating the same tool call 5-10 times, and a Python sidecar supervisor was the only thing breaking the loop. The pattern that works: record each call's name and argument hash in a small state file, break the loop when the same call repeats twice, cap retries at three per step, and make tool calls idempotent so a repeat is harmless instead of expensive.

Read the full source →