Catalog PyPI
Back to packageRELEASE DETAILS

0.1.1

PyPI

agentbelt-loop

Detect repeat, cyclic, and stagnation loops in AI agent tool-call sequences, with cross-session pattern learning. Part of the agentbelt suite.

agentsllmloop-detectionobservabilitytool-calling
Published8 Sept 2026
Direct dependencies2
Transitive dependenciesNot calculated

README

Version 0.1.1 documentation

agentbelt-loop

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

Quickstart

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"

The differentiator: cross-session pattern learning

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.

What did this actually catch?

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.

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 2

Native requirements
2 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
agentbelt-core
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
agentbelt-core>=0.1.1runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.9",
  "evaluation": "NOT_EVALUATED"
}
pytest>=7.0; extra == "dev"runtime

Distribution files

2 collected
agentbelt_loop-0.1.1-py3-none-any.whl

bdist_wheel · 11.16 KB · Python py3

Source file
agentbelt_loop-0.1.1.tar.gz

sdist · 10.33 KB · Python source

Source file

Repository

PENDING
bsaptarshi/agentbelt

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:32 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:00d9724f2afdfc295c1d8dcf3587983af632e0904057cfd2d9c6da030560123d

Other collected versions

View all collected versions →