A simple loop detector for stuck agents
Warm-Reaction-456 · reddit · 2026-07-20
The author describes a practical detector for autonomous agents that get stuck in tool-call loops.
Approach
- Fingerprint each tool call as name + hash(arguments)
- Keep a sliding window of the last 20 fingerprints
- Detect short repeating cycles of length 1–3, such as A A A, A B A B A B, or A B C A B C A B C
- Escalate gradually: first and second hits inject nudges, the third hit halts the turn
Limits
- Only catches byte-identical argument loops
- Misses loops with slightly different arguments
- Does not detect semantic no-progress loops
The author asks how others detect stuck agents, especially when the agent appears to be making “progress” but is actually going nowhere.
Related event: Catching Agent Infinite Loops: Fingerprint & Sliding Window(6 posts)→
More from coding & agent
- Building a Secure AI Agent Gateway: Self-Hosting OAuth for Multiple SaaS Apps — Defiant_Cod_2654 · 2026-07-22
- Rowboat launches as an open-source, local-first AI coworker with memory — ycombinator · 2026-07-22
- Scoble says AI “loops” really means long-running multi-agent workspaces — Scobleizer · 2026-07-22
- Kimi Code opens a waitlist as Moonshot rolls out its coding product — Fabulous_Bonus_8981 · 2026-07-22
- Open-source runtime lets each repo define its own AI code reviewer — ibabufrik · 2026-07-22
- Indie Dev Asks: What's Actually Broken in Your AI Agent's Memory Today? — AcceptableTime7937 · 2026-07-22