Skip to content

chimera.detection

chimera.detection watches the agent’s tool-call stream for repetition patterns that indicate the loop is stuck and signals the runtime to break out (raising a LoopDetectedEvent).

from chimera.detection import (
LoopDetector,
ExactRepeatDetector,
PatternCycleDetector,
)
SymbolPurpose
LoopDetectorABC. observe(tool_call) returns True when a loop is detected.
ExactRepeatDetector(window=N)Flags when the same tool call is emitted N times in a row.
PatternCycleDetector(min_period=2, min_repeats=3)Flags when a repeating multi-call pattern is detected.

Wire into a loop via LoopConfig.detector=.