AI Anonymous / Give your AI agent a stop rule / October 16, 2026
Full guide: https://jabsystems.io/ai-anonymous/agent-stop-rule

Requires Python 3.13; tested on Windows with Python 3.13.15.
No pip packages or model credentials needed. Inspect stop_rule.py and test_stop_rule.py before running.
The read_note tool is only an in-memory dictionary lookup. Decisions are authored fixtures, not model outputs.

In PowerShell, from the extracted folder:
python .\stop_rule.py complete
python .\stop_rule.py step-limit
python .\stop_rule.py repeat
python .\stop_rule.py denied
python -m unittest -v test_stop_rule.py

Expected reports: complete (2 decisions, 1 tool, exit 0); step_limit (3, 3, exit 2);
repeat_limit (3, 2, exit 2); denied_action (1, 0, exit 2). Exit 2 marks a controlled stop.
The observed JSON contains actual local reports. Test suite: 10 tests, including injected-clock deadline checks.

Teaching defaults: 3 decision attempts, at most 2 executed identical action/key pairs, 5 seconds checked cooperatively.
These are arbitrary small teaching limits, not recommended universal settings.
The time check cannot interrupt an in-flight callback. No API timeout, hard cancellation, token/dollar cap,
real tool permissions, production isolation, model quality, or real agent integration was tested.
The done decision is self-reported; verify the result separately. Exact repeats are not semantic loop detection.
Python callbacks execute with your process permissions; this is not a sandbox.

For a real runner: enforce limits outside model-generated choices, validate tool inputs, set provider/tool timeouts,
account for retries and parallel calls, verify success criteria, preserve a minimal safe report, and require
explicit human authorization for any consequential action outside the approved scope.
Do not connect a send tool to this lab. Keep your first experiment fictional and read-only.
