Observed since 20 Oct, 21:32 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
agentbelt-loop
Detect repeat, cyclic, and stagnation loops in AI agent tool-call sequences, with cross-session pattern learning. Part of the agentbelt suite.
Detect repeat, cyclic, and stagnation loops in AI agent tool-call sequences — with cross-session pattern learning. Part of the agentbelt suite.
pip install agentbelt-loop
from agentbelt_loop import LoopDetector, LoopPolicy, LoopDetected
detector = LoopDetector(LoopPolicy(max_exact_repeats=3))
detector.record("session-1", tool="search", args={"q": "foo"}, result=result)
try:
detector.check("session-1")
except LoopDetected as e:
print(e.kind, e.detail) # "repeat" | "cycle" | "stagnation" | "known_pattern"
Once a cyclic shape (e.g. search → rephrase_query → search → rephrase_query)
has been confirmed a loop in enough distinct sessions, new sessions matching
that shape trip early — after 2 local repeats instead of waiting out the
full threshold every time.
print(detector.impact_report())
# 3 loop(s) detected across 5 check(s) (repeat=3)
Breaks down detections by kind, and calls out known_pattern catches
specifically since those are the cross-session differentiator in action —
loops caught early because another session already proved the shape.
See the suite README
for the full concept and how this fits with agentbelt-budget and
agentbelt-sampler.
MIT
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
agentbelt-coreEnvironment{
"extras": "",
"marker": null,
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | agentbelt-core>=0.1.1 | runtime |
pytestEnvironment{
"extras": "",
"marker": "extra == \"dev\"",
"requires_python": ">=3.9",
"evaluation": "NOT_EVALUATED"
} | pytest>=7.0; extra == "dev" | runtime |
bdist_wheel · 11.16 KB · Python py3
sdist · 10.33 KB · Python source
Observed since 20 Oct, 21:32 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:00d9724f2afdfc295c1d8dcf3587983af632e0904057cfd2d9c6da030560123d