CCAR-P · Integration
Production reliability, rate limits, retries, idempotency and fallback
A logistics company launches a promotion and volume triples within an hour. The agent that creates shipments gets an avalanche of 429 errors from the API, and the client retries them immediately, all at once. The next day, besides the partial outage, the warehouse finds duplicate shipping labels: several requests had timed out on the client, but the tool that creates the shipment had already executed them, and the retry created them again. These are two different failures with two different controls.
First, what pattern does the data show
Before choosing a control, look at the traces or the throughput chart and classify the error:
| What you see | What it is | Control |
|---|---|---|
| Many 429s in bursts, and immediate retries make them worse | Rate limit exceeded, and a retry storm | Respect the retry-after header, exponential backoff with jitter, a retry cap, and smoothing the demand (a queue) |
| 5xx or transient overload that clears in seconds | Transient error | Retry with backoff, up to a maximum |
| A 400 for an invalid parameter | A request error: retrying won’t fix it | Don’t retry; fix the input |
| Duplicates after a client-side timeout | The tool executed the effect before the client saw the response | Idempotency in the tool |
| A degraded provider or region for a long stretch | Sustained failure | Fallback routing |
Rate limits: don’t all retry together
Exponential backoff waits longer between attempts. Without jitter (a random variation in the wait), every client that failed at once comes back at once and hits the limit again. The retry-after header says how long to wait: respect it. Retries live in the client or the integration layer, not in the model, and have a cap so they don’t hide a long outage.
Relieving the underlying limit is a different job: spread the demand over time with a queue, move work that doesn’t need an immediate answer to batch processing, or ask for more capacity. Retrying harder is none of those.
Idempotency: retry without repeating the effect
A read tool can be retried safely. One that creates, sends or charges something can’t: if the request arrived and executed but the response was lost, the client has no way of knowing, and retrying repeats the effect. The fix is to make the operation idempotent:
- The caller generates an idempotency key once per intended action, not once per attempt, and sends it on every retry.
- The tool stores the key with the result. If it receives the same key again, it returns the original result and doesn’t execute again.
- The key is generated in code, not invented by the model, and the tool must validate it on its side.
What doesn’t suffice: lengthening the timeout or lowering retries (it reduces how often, not the mechanism), asking the model in the prompt to “check whether it already exists” (the retry happens in the client, where the model sees nothing), or moving the work to batches (it doesn’t solve duplicate semantics).
Fallback routing: when the failure isn’t transient
If the main provider or region is degraded for a long stretch, retrying only adds delay. Fallback routing diverts traffic to another path: another model, another region or a different deployment surface. Three cautions:
- Trigger it on a measured signal (a sustained error rate), not on the first failure, and switch back when it recovers.
- Validate the fallback with the same evaluation suite: a fallback model that fails on your cases is an outage in disguise.
- Check that it meets the same data and compliance constraints as the main path.
The usual traps
- Retrying immediately and without a cap: it turns a rate limit into an outage.
- Retrying validation errors (400), which will never work.
- Retrying writes without an idempotency key.
- Generating a new key per attempt: it deduplicates nothing.
- Trusting a prompt instruction to prevent duplicates.
- A fallback nobody evaluated, or one that violates a data residency constraint.
In the exam
Classify the pattern before looking at the options. Bursts of 429s call for backoff with jitter and respecting retry-after. Duplicates after a timeout call for idempotency in the tool. A long provider failure calls for an evaluated fallback. And if an option proposes that the model handle the retry logic, it is the wrong one: retrying is done in code.
Quick question
A practice exam question on this domain. It counts towards your progress.
An internal HR-operations assistant exposes a tool that changes employees' job grades. The tool accepts three arguments: the employee ID, the new grade and an is_admin boolean that the model sets to true when the user says they work in HR leadership. The tool applies the change whenever is_admin is true.
During a pilot, a user from another department typed that they were in HR leadership and asked for a colleague's grade to be raised. The assistant set the flag to true and the tool applied the change. The audit trail shows only the service account.
What should the team change?