Skip to main content

Module loop_detect

Module loop_detect 

Source
Expand description

Loop detection for agent loops.

Detects three types of repetitive behavior:

  1. Exact repetition — identical action signatures (catches trivial loops)
  2. Semantic repetition — normalized signatures via normalize_signature (catches loops where the agent retries the same intent with different flags, quotes, or fallback chains)
  3. Output stagnation — identical tool outputs despite varied commands (catches loops where the agent tries different approaches but gets the same result)

Each signal tracks consecutive matches independently. The worst signal determines the returned LoopStatus.

Structs§

LoopDetector
Detects repeated action patterns in agent loops.

Enums§

LoopStatus

Functions§

normalize_signature
Normalize an action signature to its semantic category.