Observed since 20 Oct, 22:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Detect repeated agent steps and stop runaway loops. Python port of @mukundakatta/agent-loop-breaker.
Detect repeated agent steps and stop runaway loops. Pure Python, zero deps. Python port of @mukundakatta/agent-loop-breaker.
pip install agent-loop-breaker-py
from agent_loop_breaker import detect_loop, should_stop
events = [{"tool": "search"}, {"tool": "fetch"}] * 4
res = detect_loop(events, window=2, repeat_threshold=3)
# LoopDetection(looping=True, pattern="search>fetch", count=4)
if should_stop(events):
raise RuntimeError("agent stuck in a loop")
detect_loop(events, *, window=4, repeat_threshold=3) -> LoopDetectionScans events for a repeating window of length window. Returns the first window seen repeat_threshold times or more.
Each event is reduced to a signature via event.get("tool") or event.get("name") or event.get("type") (or str(event) for non-dicts).
should_stop(events, *, window=4, repeat_threshold=3) -> boolConvenience wrapper returning the looping flag.
MIT
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.0 | 27 Apr 2026 | 1 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 22:37 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:21f2151512678a39b7a7c83992384fa26ece16935739d654685b3a1c96e8ea86