Skip to main content

exoclaw-loop-detection

Pattern-based loop detection for exoclaw — replaces hard iteration caps with smart termination.

Why

The default max_iterations=40 cap kills productive runs that happen to use many tools. This plugin detects degenerate patterns instead:

  • Repeat — same tool + same args called N times in a row
  • Ping-pong — alternating between two identical calls (A→B→A→B…)
  • Circuit breaker — absolute safety net (default 200)

Productive runs with many different tool calls are never interrupted.

Install

pip install exoclaw-loop-detection

Usage

from exoclaw import Exoclaw
from exoclaw_loop_detection import LoopDetectionPolicy, LoopDetectionConfig

policy = LoopDetectionPolicy(LoopDetectionConfig(
    critical_threshold=20,      # stop after 20 identical repeats
    global_circuit_breaker=200, # absolute safety net
))

app = Exoclaw(
    provider=provider,
    conversation=conversation,
    iteration_policy=policy,
)

The policy records tool calls automatically when the loop invokes should_continue. To also track arguments for fingerprinting, call policy.record(name, args) from an on_tool_calls hook or a custom executor's execute_tool.

Configuration

Parameter Default Description
history_size 30 Tool calls retained for pattern matching
warning_threshold 10 (Reserved) threshold for injecting a warning
critical_threshold 20 Repeated calls to trigger termination
global_circuit_breaker 200 Absolute iteration cap
detect_repeat True Enable same-tool-same-args streak detection
detect_ping_pong True Enable alternating pattern detection

Release files for exoclaw-loop-detection 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for exoclaw-loop-detection 0.1.0
File Size Uploaded
exoclaw_loop_detection-0.1.0.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for exoclaw-loop-detection 0.1.0
File Interpreter ABI Platform
exoclaw_loop_detection-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / exoclaw_loop_detection-0.1.0.tar.gz

Download URL exoclaw_loop_detection-0.1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d3b15126494b372ba05056545d51d4fb1a6d68988b22c9633364e830454a3280
BLAKE2b-256 checksum
How to use checksums
7f7c18f947f89d36b0401365dbd65c32c83348532ec72342de25cb63aaded970
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / exoclaw_loop_detection-0.1.0-py3-none-any.whl

Download URL exoclaw_loop_detection-0.1.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bc56f04c401d7ed1e62137ecd2f875261722e04a7b2fbc896813d58bb487963
BLAKE2b-256 checksum
How to use checksums
f49afc02cd70292acbd9f8923be3b4b2adaf41b1c6e26e419638984922a287dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page