Loop Controls That Stop for a Reason¶
What you build¶
The exits a harness owns, in exercise/controls.py:
stop_reason: iteration, token, time and cost budgets; no-progress detection; repeated actions; A-B-A-B oscillationclassify_failure: transient (retry) or substantive (adjust)backoff_delays: exponential backoff with a capCircuitBreaker: closed, open, half-openshould_trigger: event loops ignore events their own agent caused
Steps¶
- Implement each function; run
python -m pytest -qafter each one. - Compare with
harnesslab/harnesslab/loop.py, which uses budgets, repeat refusal and a no-progress window.
Done when¶
All seven tests pass, and for each control you can name the runaway-loop cause it prevents.
Stretch goals¶
- Add jitter to
backoff_delaysand a test that two clients do not retry in lockstep. - Add
stop_reasonto Project 1's loop.