Expand description
Tool-loop detection with tiered escalation.
Three detectors run after each tool call to prevent agents from getting stuck in repetitive loops:
- Exact repeat — Same tool + same arguments N times in a row.
- Similarity — Tool calls with high argument similarity over a sliding window.
- Cost runaway — Token spend exceeds budget threshold.
Structs§
- Loop
Detection Config - Configuration for loop detection thresholds.
- Tool
Loop Detector - Stateful detector that tracks tool calls and checks for loops.
Functions§
- severity
- Severity ordering for LoopAction (higher = more severe).