Skip to main content

Module loop_detector

Module loop_detector 

Source
Expand description

Loop detection for agent operations

Detects when the agent is stuck in repetitive patterns and suggests intervention. The unified interactive VT Code runloop applies its own richer turn-local recovery policy; this detector remains the generic safeguard for legacy or non-unified autonomous execution paths.

Structure:

  • mod.rs — the LoopDetector state machine: budgets, streak tracking, identical-call enforcement, pattern detection, and the public API.
  • normalization — pure helper functions: tool classification, argument hashing/normalization, and read-target extraction. Kept separate so the detector state and the normalization logic are independently testable.

Structs§

LoopDetector
ToolCallRecord

Constants§

HARD_STOP_PREFIX
Prefix of every message returned by LoopDetector::record_call when the call reached a hard limit (the caller then sees LoopDetector::is_hard_limit_exceeded for that tool). Callers end the run or force a tool-free synthesis pass, so each message states what is blocked and what to do with the results already gathered.