Budgeted Retry
Failed operations are retried under an explicit budget (attempts, cost, or time) with a required diagnosis between attempts. When the budget exhausts, the loop escalates to a human with the evidence trail instead of failing silently or looping forever.
When to use
Flaky environments: network operations, test suites with intermittent failures, external API integration.
Steps
| Step | What happens | Verification |
|---|---|---|
| Attempt | Run the operation, capturing full output. | Output captured verbatim. |
| Diagnose | Classify the failure: transient, deterministic, or environmental. Same-input retry is only justified for transient. | Classification written down with the evidence that supports it. |
| Retry or escalate | Retry (possibly modified) if budget remains and failure is plausibly transient; otherwise escalate with the trail. | Budget decremented every attempt; escalation includes all diagnoses. |
Specification
| Verification method | Success criterion of the wrapped operation; the loop adds bookkeeping, not new checks. |
|---|---|
| Recovery behavior | escalate |
| Observability | Attempt count, per-attempt diagnosis, budget remaining. |
| Inputs | Operation, Budget, Escalation channel |
| Outputs | Success, or a structured escalation |
| Risk level / maturity | medium / emerging |
Failure modes
- Retrying deterministic failures
- Budget set so high escalation never happens
- Diagnosis skipped under time pressure
Assessment
The unglamorous loop that separates production agents from demos. The mandatory diagnosis step is the load-bearing element; retry-without-diagnosis is just slower failure.