Multiple layers each retry several times
Detect: Traces show multiplicative attempts for one business request.
Recover: Assign retry ownership and disable or coordinate nested policies.
Retry transient failures with bounded exponential delays and randomized timing, preserving operation identity and respecting the remaining task deadline.
Exponential backoff increases the delay between repeated attempts so a struggling dependency has time to recover. Jitter randomizes that delay to prevent many clients from retrying together. A common full-jitter policy samples uniformly between zero and the capped exponential delay, but the exact algorithm should be documented and tested.
Retry only failures that may improve and only operations that are safe to repeat. Authentication errors, invalid arguments, and permanent policy denials usually need correction or termination. For commands with uncertain outcomes, idempotency and reconciliation come before retry convenience. Backoff reduces synchronized pressure; it does not create additional dependency capacity.
A prototype can simulate transient failures and verify that attempts spread over time. Include a hard maximum attempt count and total elapsed budget.
Production classifies retryable errors, honors applicable server retry guidance, preserves operation keys, and chooses one layer to own retries. Nested SDK, gateway, and agent retries can multiply traffic unexpectedly.
At scale, combine backoff with retry budgets, circuit breakers, and admission control. Measure attempts per original request and dependency load during recovery, not only the percentage eventually succeeding.
Determines whether the observed error is transient, permanent, throttled, or outcome-uncertain.
Computes capped exponential delays and applies the selected jitter distribution.
Limits attempts and aggregate retry traffic within task and service capacity.
Rejects another attempt when delay and useful execution cannot fit the remaining window.
Preserves command identity and reconciles effects across repeated attempts.
flowchart LR
C["Dependency call"] --> E["Classify failure"]
E --> P["Permanent failure"]
E --> I["Idempotency or reconciliation check"]
I --> B["Attempt and deadline budget"]
B --> J["Capped exponential delay with jitter"]
J --> C
B --> S["Stop or defer"]
E --> R["Record successful result"]Inspect transport status, service error semantics, and whether a side effect may already have occurred.
Confirm read semantics, downstream idempotency, or completed reconciliation before repeating a command.
Calculate the capped exponential interval and apply documented jitter and relevant server guidance.
Ensure attempt count, retry allocation, and remaining task deadline permit another useful call.
Wait without occupying scarce execution resources where the runtime supports durable scheduling.
Reuse operation identity, record outcome and delay, then stop or continue under the same bounded policy.
Logistics integration · Illustrative enterprise scenario, not a reported customer outcome.
A delivery platform's agents query carrier tracking APIs after a regional weather disruption increases customer requests.
Immediate retries synchronize across workers and intensify throttling, delaying every shipment investigation.
The assistant must recover transient tracking reads without exhausting the carrier or the user-facing deadline.
A carrier-specific retry policy classifies throttling, applies server guidance and jittered backoff, and consumes a shared retry budget.
If the same policy is applied to a shipment-changing command, the adapter first requires idempotency or reconciliation rather than assuming read-like safety.
Track attempts per original request, retry delay, throttle rate, deadline exhaustion, and carrier recovery load under burst tests.
| Decision | Benefit | Cost |
|---|---|---|
| Exponential delay | Repeated pressure falls as failures persist. | Individual requests may take longer to recover. |
| Jitter | Clients are less likely to retry in synchronized bursts. | Timing becomes variable and tests need distribution-aware assertions. |
| Shared retry budgets | Retries cannot consume unlimited service capacity. | Some recoverable requests must fail or defer during widespread outages. |
Detect: Traces show multiplicative attempts for one business request.
Recover: Assign retry ownership and disable or coordinate nested policies.
Detect: Scheduler would wake after the task has expired.
Recover: Stop or defer without issuing another call.
Classify errors using actual operation semantics.
Use a documented jitter distribution.
Preserve the original business operation identity.