Give “try again” an owner.
A failed AI-service call can leave a workflow stuck between two unhelpful choices: give up immediately or keep trying indefinitely. Start with a small written policy: which failures can be retried, which layer owns retries, how many additional attempts are allowed, and when the user gets a clear failure or deferred state.
This is established HTTP and reliability practice applied to AI workflows, not a new model capability. Amazon’s Builders’ Library explains why retries can increase pressure on an already struggling service, why random jitter spreads retry traffic, and why a timeout does not establish that an operation had no side effects. Keep one retry owner and inspect the layers underneath it.
For a hobby script, write this policy before adding a wrapper. For a workplace integration, use the approved SDK and service policy, and give support a redacted request ID. A patient interface should show whether work is pending, stopped or waiting for a person.
Check the SDK before adding another loop.
Find the installed SDK version, its retry default and any application or queue retry settings. In the current Anthropic Python SDK documentation, transient failures have two automatic retries by default, and max_retries configures that behavior. Verify the documentation for the version and platform you actually use. We reviewed the docs; we did not install or exercise the SDK.
If an outer wrapper makes three total attempts and every SDK call also makes three total attempts, the composed upper bound is nine underlying attempts. That is arithmetic for a hypothetical configuration, not an observed request trace. Record actual attempt counts in a controlled test before relying on a policy.
Use the review checklist to capture provider, endpoint, version, error type, wait hint, per-attempt timeout and total deadline. Do not copy API keys, sensitive prompts or response bodies into public debugging tools.
Read the signal before choosing a delay.
RFC 6585 defines HTTP 429 for excessive requests and permits a Retry-After field. RFC 9110 defines the wait hint as integer seconds or an HTTP date. If the suggested wait exceeds your deadline, stop or defer the work; do not silently shorten the hint to fit.
Provider meaning matters. The Claude API error guide distinguishes rate limits, spend-cap cases and overload. It documents that a tier spend-cap 429 can lack a wait hint and persist until access resumes. It also describes errors that arrive after an HTTP 200 in a stream. A status-only loop cannot handle all these situations.
The practice policy below deliberately sends a 429 without a wait hint to human review. That is our conservative teaching choice, not a universal provider rule. Authentication errors also stop. A real integration needs to examine documented error details and reconcile uncertain outcomes, especially when tool actions or external writes may already have occurred.
Try the decision without making a request.
Use an existing Python 3 installation. We ran the kit on Windows with Python 3.13.15. It uses the standard library and requires no SDK, API key or package installation. These PowerShell commands create a new dated folder; choose another empty folder if it already exists.
New-Item -ItemType Directory -Path .\retry-practice-2026-10-24 -ErrorAction Stop
Set-Location .\retry-practice-2026-10-24
Invoke-WebRequest -Uri "https://jabsystems.io/ai-anonymous/Social/read-the-signal-practice.zip" -OutFile .\practice.zip
Expand-Archive -LiteralPath .\practice.zip -DestinationPath .\practice
Get-Content .\practice\retry-plan.py
Get-Content .\practice\retry-cases.json
Read the files before running local code. The script only reads its adjacent fictional cases and prints JSON. It does not contact a provider, wait, retry anything or invoke an AI model. Running a downloaded Python file still executes local code; this exercise is not a sandbox.
From the same session:
python --version
python .\practice\retry-plan.py | Set-Content -Encoding utf8 .\my-plan.json
Get-Content .\my-plan.json
Each case is independent. The fixed clock is October 24, 2026 at 16:00:00 UTC. The authored policy allows two additional retries after the original attempt, with an illustrative 30-second total deadline. A fixed 0.5-second jitter value makes the examples reproducible; production jitter should be randomized. These values are exercise choices, not provider recommendations.
Ten cases make the policy visible.
Observed by running the offline script on October 24, 2026:
429with a five-second hint:would_waitfor 5.5 seconds.429with a date ten seconds after the fixed clock:would_waitfor 10.5 seconds.503without a hint:would_waitfor 1.5 seconds under our fallback policy.401: stop; outside this demo’s retry policy.429without a hint: review.- A 120-second hint: stop; exceeds the deadline budget.
- Two retries already used: stop; retry limit reached.
- Repeat safety unconfirmed: stop before choosing a delay.
200: done under this non-streaming snapshot assumption.- A malformed wait hint: review.
These are authored fixtures, not errors observed from a model or live service. Download the recorded report. would_wait means the planner selected a delay; no real wait or retry occurred. Exit 0 means a report was produced.
The complete script includes this budget check:
remaining = WAIT_BUDGET - elapsed
if delay > remaining - JITTER:
return {"action": "stop", "reason": "deadline_budget"}
return {"action": "would_wait", "seconds": delay + JITTER, "basis": basis}
The parser accepts ASCII integer seconds and canonical GMT IMF-fixdate values. It uses Python’s date helper with a canonical-format check. It intentionally rejects other date spellings instead of implementing every HTTP-date form. A past date produces a zero minimum plus the exercise jitter. Do not substitute this narrow parser for a complete HTTP client.
Turn the exercise into questions for your real workflow.
Before adopting changes, confirm whether repeating the operation is safe. The fixture’s repeat_safe: true is an authored assumption. It is not evidence that a real model request, tool execution, message send or write is safe to repeat. A failed connection may leave the outcome unknown; investigate the existing operation rather than guessing it did nothing.
A real runner needs a current clock for date hints, monotonic elapsed timing for deadlines, timeouts that include request time, cancellation, bounded concurrency, randomized jitter, provider-specific error handling and separate handling of interrupted streams. This planner implements none of those runtime systems. Even a 200 snapshot cannot prove a stream completed or a useful answer was produced.
An optional proposed AI review prompt can help identify gaps in approved redacted configuration. It was not executed or evaluated. Keep human review responsible for the final policy, and verify behavior under controlled conditions before using it on real traffic.
Tested: ten offline authored cases, parser and budget boundaries, extracted-kit reruns and the published download workflow. Not tested: SDK execution, live API errors, actual waits or recovery, paid requests, model output, production reliability, concurrency, stream recovery, cost savings or performance. No improvement percentage or service-availability guarantee is claimed.
Take the retry review kit.
Practice ZIP · Complete offline planner · Authored cases · Observed report · Human review checklist · Proposed prompt · Practice README
Primary sources reviewed October 24, 2026. The portrait is original AI-generated conceptual artwork, visually reviewed. The pause signal and request cards are illustrative.

