Expand description
Loop detection for agent outputs — prevents repetitive/stuck agents. Loop detection for ARES agents.
Detects when an agent is producing repetitive outputs and intervenes to break the loop. Uses a sliding window of recent outputs with similarity hashing, optional fuzzy matching, and iteration limits.
Structs§
- Loop
Config - Configuration for loop detection and iteration limits.
- Loop
Detection - Pure detection result from
detect_loop. - Loop
Detector - Tracks agent outputs and detects repetitive loops.
- Loop
State - Runtime state for loop detection and iteration tracking.
Enums§
- Loop
Action - Actions to take when a loop is detected.
- Loop
Match Kind - How a repetitive output was matched.
- Loop
Status - Result of checking an output for loops.
Functions§
- count_
fuzzy_ repetitions - Count signatures in
signaturesthat fuzzy-matchcurrent. - count_
repetitions - Count how many entries in
hashesequalhash. - detect_
loop - Detect a repetitive output against recent window state (does not mutate
state). - loop_
signature - Canonical normalized signature (whitespace-stripped, lowercased, capped).
- should_
halt - Whether the agent should halt due to iteration limits or consecutive failures.
- should_
halt_ on_ max_ iterations - Returns true when
LoopConfig::halt_on_maxis set and iteration limits are reached. - similarity_
hash - Hash normalized output content for exact duplicate detection.
Type Aliases§
- Loop
Detector Config - Backward-compatible alias for
LoopConfig.