Pattern-based loop detection iteration policy for exoclaw — replaces hard iteration caps
Project description
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 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file exoclaw_loop_detection-0.1.0.tar.gz.
File metadata
- Download URL: exoclaw_loop_detection-0.1.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3b15126494b372ba05056545d51d4fb1a6d68988b22c9633364e830454a3280
|
|
| MD5 |
c3362951d6c22b3727a81a59dfe55fe6
|
|
| BLAKE2b-256 |
7f7c18f947f89d36b0401365dbd65c32c83348532ec72342de25cb63aaded970
|
File details
Details for the file exoclaw_loop_detection-0.1.0-py3-none-any.whl.
File metadata
- Download URL: exoclaw_loop_detection-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bc56f04c401d7ed1e62137ecd2f875261722e04a7b2fbc896813d58bb487963
|
|
| MD5 |
16c182096143307364c4fb92bb612993
|
|
| BLAKE2b-256 |
f49afc02cd70292acbd9f8923be3b4b2adaf41b1c6e26e419638984922a287dd
|