# 10-Point AI Agent Loop Prevention Checklist

Use this checklist to audit your agent architecture for loop vulnerabilities. Check each item — if any are unchecked, your agent is at risk of silent infinite loops.

## 🟢 1. Success Condition Clarity
- [ ] Every task/tool call has a clear "what does done look like?" condition
- [ ] Success is defined as a specific output state, not "no error"
- [ ] The agent has an explicit stop condition after completing a task
- [ ] **Without this**: Agent generates output, re-checks, tweaks, generates again — never self-terminates

## 🟢 2. Tool Failure Isolation
- [ ] Each tool call has a max retry count (3 or fewer)
- [ ] Failed tool calls return a distinct error, not partial data
- [ ] Tool failures don't cascade into other tool contexts
- [ ] **Without this**: Tool A fails → context gets corrupted → Tool B receives bad data → agent retries Tool A with corrupted context → infinite loop

## 🟢 3. Max-Iteration Limits
- [ ] Agent has a hard cap on iterations per task (not per session)
- [ ] When limit is reached, agent enters a "failed" state (not "retry")
- [ ] Failed state triggers an alert, not a silence
- [ ] **Without this**: Agent loops until API cost limit or human notices degraded responses

## 🟢 4. Circuit Breaker Patterns
- [ ] Repeated same-tool failures trigger a circuit breaker (halt further calls)
- [ ] Circuit breaker has configurable thresholds (e.g., 5 failures in 60 seconds)
- [ ] Breaker state is observable via metrics
- [ ] **Without this**: Agent calls the same broken tool 500+ times before anyone notices

## 🟢 5. Loop Detection Telemetry
- [ ] System tracks: identical tool calls without state change
- [ ] System tracks: context growth without output production
- [ ] System tracks: retry count acceleration (retries increasing faster than tasks)
- [ ] **Without this**: You have no data to diagnose loop behavior after the fact

## 🟢 6. Dead-Letter Queues
- [ ] Failed/looped requests are captured in a dead-letter queue for inspection
- [ ] DLQ preserves the full request context (prompt, tool calls, results, errors)
- [ ] DLQ has a review workflow (human checks, retrains, releases)
- [ ] **Without this**: Loop evidence is lost when the agent is restarted

## 🟢 7. Ambiguous Instruction Audit
- [ ] Agent prompts reviewed for ambiguous action instructions
- [ ] "If needed," "as appropriate," "when necessary" flagged as risks
- [ ] Every conditional path in the prompt has a defined "do nothing" outcome
- [ ] **Without this**: Ambiguous prompts are the #1 cause of agents that "keep going"

## 🟢 8. Context Window Overflow Detection
- [ ] Context size is monitored per-task (not just per-session)
- [ ] Warning when context exceeds 70% of model limit
- [ ] Auto-trim policy defined: what gets summarized, what gets dropped
- [ ] **Without this**: Agent fills context with loop artifacts, loses coherence, spirals

## 🟢 9. Retry Budget Caps
- [ ] Each task has a total retry budget (across all tools, not per tool)
- [ ] Budget resets per task, not per session (prevents budget exhaustion cascades)
- [ ] Budget exceeded → task fails cleanly → alert fires
- [ ] **Without this**: Agent can exceed budget across 50 partial retries and appear "working"

## 🟢 10. Agent Health Scorecard
- [ ] Daily score: loop-free uptime + tool success rate + avg iterations/task
- [ ] Weekly trend: improving or degrading?
- [ ] Alert when score drops below threshold (e.g., <95% loop-free rate)
- [ ] **Without this**: You don't know if your agent is getting healthier or sicker

---

## Scoring Guide

| Checks Passed | Status | Action |
|---------------|--------|--------|
| **10/10** | 🏆 Production-Ready | Your agent is loop-resistant. Maintain with monitoring. |
| **7-9/10** | ⚠️ Minor Gaps | 1-3 vulnerabilities. Address highest-risk items first. |
| **4-6/10** | 🚨 At Risk | Multiple loop entry points. Full guardrail deployment recommended. |
| **0-3/10** | 🔴 Critical | Your agent will loop in production. Stop deployment until guardrails are in place. |

---

## Common Loop Patterns to Watch For

| Pattern | Symptom | Fix |
|---------|---------|-----|
| **Same-tool retries** | Agent calls Tool X 10+ times in a row | Add circuit breaker (item #4) |
| **Context growth without output** | Token usage climbs, user sees no response | Add max-iteration limit (#3) |
| **Degrading responses over time** | First response good, 10th response gibberish | Add context window monitor (#8) |
| **Cost spikes without traffic** | API bill up 3x, users didn't increase | Add loop detection telemetry (#5) |
| **Agent contradicts itself** | "I'll do X" then "I already did X" repeatedly | Fix success condition clarity (#1) |

---

*Downloaded from Digital HustlerX — Agent Loop Breaker Service*
*Need guardrails deployed on your agents? → [See plans]*
