In a multimodal AI application, a single user action can trigger several metered APIs. One HTTP 429 can therefore turn into a queue, several retries and an unexpectedly expensive conversation. The engineering mistake is to count retry attempts in isolation instead of asking whether a user still needs the result.

This runbook translates AWS retry-with-backoff guidance and the HTTP Retry-After specification into concrete rules for agent tool chains, live speech and video features.

Classify the failure before anyone retries

A real-time AI product may call a speech recognizer, an LLM, a retrieval service and a video renderer inside one user session. When one provider returns HTTP 429, the naive implementation retries the whole chain. That can charge for already successful stages, preserve stale context and make latency unpredictable. Treat the response as a capacity signal, not as permission to repeat every action. Distinguish a documented rate limit from an authentication error, a malformed request and an unknown server failure. Log the status, provider, endpoint class, attempt number and a correlation identifier; avoid logging private audio or complete prompts just to debug the incident. RFC 9110 defines Retry-After as a way for servers to indicate when a client ought to try again, and permits an HTTP date or a number of delay seconds. Respect the field where applicable, but also enforce the client’s overall deadline. A retry that completes after the caller has gone away is not a success.

Budget retries from the user’s end-to-end deadline

Start from a user experience target rather than an arbitrary library default. Suppose a live conversation turn has a two-second response budget. Reserve time for speech finalization, model response and the first audio frame; the remaining budget is the maximum amount you can spend on retry attempts. Split it explicitly between services and keep a small safety margin for network variability. A retrieval request that times out after its budget is exhausted should fall back to a safe, limited answer, not block voice playback indefinitely. Never allow every layer to retry independently: three retries at the HTTP client, service SDK and workflow engine can multiply into many downstream requests. Choose a single layer that owns each retry decision, and record when the budget was consumed. AWS’s Prescriptive Guidance on retry with backoff warns that repeated attempts can increase contention and that idempotency matters. Apply those cautions to the full AI session, not just isolated API calls.

Use jitter, backoff and per-provider concurrency limits

Exponential backoff increases spacing between attempts, while jitter prevents many workers from waking together after an outage. A basic implementation uses a bounded random delay that increases with the attempt count, but the exact multiplier should be tested against provider limits. Set both a maximum number of attempts and a maximum elapsed duration. Add separate concurrency controls for speech, text, image and video so a burst of image generation does not starve an active call. A token-bucket limiter can absorb brief bursts while preserving an average request ceiling. For fairness, maintain per-tenant or per-user quotas where shared API credentials are used; otherwise one creator’s campaign could consume the allowance for everyone. When Retry-After exceeds the real-time budget, stop retrying and show an understandable status. The right behavior is sometimes immediate graceful degradation rather than technically correct but useless waiting.

Treat irreversible actions as a different class of operation

Reading metadata and generating a draft are often safe to repeat; sending a creator invitation, publishing a social post or charging a wallet is not. The agent must know which tool calls cause an external side effect before it chooses a retry policy. Assign idempotency keys to supported write endpoints and use a durable operation record containing requested action, current state and confirmed external identifier. If a request times out after submission, query its status before creating another one. If the upstream provider offers no idempotency or read-after-write mechanism, send the operation for controlled reconciliation rather than blindly reissuing it. This is related to the transactional outbox pattern, but the distinct design challenge here is rate-limit behavior while multiple models and tools compete for time. Retries should also preserve authorization scopes and never expand permissions just because a previous call failed. A good retry engine understands both business consequences and HTTP responses.

Load-test with partial success and correlated 429 storms

A happy-path test of one request proves little about resilience. Create synthetic workloads that reproduce real traffic shapes: voice-heavy users, bulk image jobs, simultaneous first-logins and a provider that suddenly halves the permitted rate. Inject 429 responses with Retry-After values both shorter and longer than the session deadline. Measure successful-turn latency, rejected work, duplicate side effects, tokens consumed by aborted attempts and time to recover after throttling ends. Test partial success explicitly: speech transcription completes, retrieval is throttled, then the user interrupts. The system must cancel stale work and avoid narrating an answer based on a session that no longer exists. Make sure error dashboards separate genuine user abandonment from tool failures; otherwise an overloaded dependency may be misdiagnosed as a product-engagement problem. Schedule these tests before large marketing campaigns, when traffic can arrive in sudden geographic waves.

A deployable decision tree and the release gate

For every external AI tool call, record whether the request is read-only or side-effecting, the owning retry layer, allowed status codes, maximum attempts and remaining deadline. On success, record the result once. On a 429, check Retry-After, available concurrency and deadline; retry with bounded jitter only when the operation is safe and worthwhile. On other permanent client errors, stop and surface the specific problem. On ambiguous write timeouts, reconcile external state first. Release should be blocked if a test creates duplicate charges or publications, if the worst-case retry fan-out exceeds the provider contract, or if live audio repeatedly stalls behind lower-priority tasks. AWS documentation supplies an architectural pattern and the HTTP specification defines protocol semantics; the numerical budgets, priorities and launch thresholds described here are engineering recommendations, not mandated values. The practical goal is predictable user experience even when a vendor is temporarily saying no.

Sources

Example time budgets are illustrative architecture choices and should be validated against actual product latency requirements.