AI tools helped gather research and write the first draft of this article. I edited it and checked every quote and figure against the source page listed at the end, read on 1 December 2026. The illustrations are AI-generated. Details at the end.
An assistant in a chat window sends a request, the connection stalls, and the client has to decide: wait, try again, or tell the user it failed. For a question, any of those is harmless. For "send these tokens to my savings account" it is not, because the first request may have succeeded while the answer was lost. Give each user intention one identifier, created once when the user decides, and send that identifier with every attempt, at every layer. Retry in one place only. When an attempt ends without an answer, treat the outcome as unknown and look it up before doing anything new.
Below: why a timeout cannot tell you what happened, what payment, cloud and model API documentation says about retrying, and how those rules fit an AI chat that can take actions. Separating conversation from actions and waiting-time design are covered by other parts of this series.
A timeout does not report an outcome
A client that stops waiting has learned one thing: no answer arrived in time. It has not learned whether the server did the work. The IETF Idempotency-Key draft (revision 09, dated 21 November 2026) describes the situation plainly. A client sent a request that timed out, and "the client is left uncertain about the status of the resource" [1]. It does not know whether the resource was created or updated, or whether the server even finished.
The AWS Builders' Library agrees: "A timeout or failure doesn't necessarily mean that side effects haven't happened" [4]. Stripe's HTTP-level guidance: "Restoring connectivity doesn’t tell you whether the original request succeeded" [2]. Microsoft's Retry pattern gives the typical case: a service "might receive the request, process the request successfully, but fail to send a response" [5].
HTTP itself encodes the caution. RFC 9110 says a client "SHOULD NOT automatically retry a request with a non-idempotent method unless it has some means to know that the request semantics are actually idempotent, regardless of the method, or some means to detect that the original request was never applied" [3]. The same section says "A proxy MUST NOT automatically retry non-idempotent requests" and "A client SHOULD NOT automatically retry a failed automatic retry" [3]. In short: know the action is safe to repeat, or detect that it never happened.
Two kinds of retry in one chat
An AI chat makes two kinds of calls that need different treatment.
The model request. The client asks a model to generate a reply. The model providers' error pages describe how to retry it. Anthropic's documentation says its SDK retries a failed request up to two times by default (three attempts in all), follows an x-should-retry header when the response has one, waits as long as a retry-after header says, and otherwise backs off exponentially "from 0.5 to 8 seconds" [6]. It also says "the SDK doesn’t retry an error in a stream" [6]. OpenAI's page for a 429 rate-limit error says: "If a Retry-After header is present, wait at least as long as it specifies before trying again. If it’s missing, use exponential backoff with jitter and limit the number of retries" [7].
The action. The assistant, or the user through a button, asks some system to do something that changes the world: move tokens, place an order, send a message, publish. Neither model page says anything about that. Their retry advice concerns the request to the model, not what a tool call did afterwards.
The distinction below is the author's inference from these pages, not a quotation: repeating a generation request has no effect outside the conversation beyond the cost and delay of another attempt, while repeating an action request can duplicate a real effect. Whether a repeated generation request is billed again is not covered by the pages read here; check your provider's terms. The rest of this article is about the second kind.
One intention, one key
An idempotency key is how a client says "this is the same request as before". The IETF draft defines it as "a unique value generated by the client which the resource uses to recognize subsequent retries of the same request" [1]. It adds: "The idempotency key MUST be unique and MUST NOT be reused with another request with a different request payload" [1]. Stripe describes the same arrangement: the client generates the key, the server uses it to recognize retries, and keys can be up to 255 characters, with random values such as V4 UUIDs suggested and sensitive data such as email addresses discouraged as keys [8].
What matters for a chat is when the key is created. A key made inside the retry loop makes every attempt a new request; the server cannot tell they are related. The key has to exist before the first attempt, at the moment the user's intention exists, and be stored with that intention so every later attempt reads it back. The draft frames it from the user's side: a client may send the header "to indicate the user's intent is to only perform this action once" [1], and "without a priori knowledge, a general client cannot assume the server will respect this request" [1]. A key helps only if the receiving system honours it.
The draft spells out what the receiving system does:
- First time: process the request normally.
- Duplicate after completion: respond consistently with the request having been completed.
- Duplicate while the first is still running: respond with a conflict error, HTTP 409.
- Same key, different payload: fail with HTTP 422.
- Key required but missing: HTTP 400.
All five are "SHOULD" in the draft [1], an Internet-Draft cited here as work in progress. Stripe's documentation is a working implementation with its own details: for its v1 API it saves the status code and body of the first request after execution begins and returns the saved response for retries with the same key, "including 500 errors"; it compares incoming parameters with the original and errors if they differ; it can remove keys after at least 24 hours; and for its v2 API retries "don’t repeat successful operations" under different replay behaviour [2][8]. Each service defines its own rules, so the first step in any design is reading the provider's.
A fictional transfer, attempt by attempt
The following example is invented. Harbor Ledger is a made-up app with a chat assistant; its tokens, amounts and identifiers are fictional and show the design only.
A Harbor Ledger user types: "Move 40 demo tokens to my savings." The assistant shows a confirmation card with the amount and the destination. The user taps Confirm. This tap, not the sentence in the chat, is the moment of intention, and the client creates intent-7f3a there and stores it with the card.
- Attempt 1. The client sends the transfer with intent-7f3a. The server executes it. The reply is lost on a bad connection. After the client timeout, the client has no answer.
- What the client shows. Not "Failed. Try again?" but "Checking whether the transfer went through." The state is unknown, and the interface says so.
- Attempt 2. The client sends the same transfer with the same key intent-7f3a. The server recognizes it as the finished request and returns the saved result. The user sees one transfer.
- The bug this prevents. If each attempt had made its own key, the server would have run the transfer twice and the savings account would hold 80 tokens.

Two more places can multiply an action in an AI chat: a regenerated or resumed model turn can ask for the same tool call again, and a user can tap twice. The key should come from the confirmed card, not from text the model wrote, so both repeats carry the same key. These are the author's design proposals for the fictional app, not statements from the sources.
Choosing timeouts
The AWS Builders' Library article (2019) says to set a timeout on any remote call, and gives the two risks of a too-low value: more backend traffic and latency because too many requests are retried, and "a complete outage, because all requests start being retried" [4]. For calls inside one AWS Region it describes picking an acceptable rate of false timeouts, such as 0.1%, and reading the matching latency percentile of the downstream service, p99.9 in that example [4].
For a chat, that suggests different budgets for different calls, which is the author's reading and not a rule from a source. A model request can legitimately take long; Anthropic's documentation points to streaming for long-running requests [6]. A transfer endpoint should answer fast, so its timeout can be short, and a timeout there means "unknown", not "failed".
Microsoft's Retry pattern adds a user-facing point: in an interactive application it can be better "to fail after a smaller number of retries with only a short delay between retry attempts, and display a suitable message to the user" [5]. In an action flow, that message is the unknown state from the example.
Retry in one place
Retries multiply across layers. The AWS article's example is a five-deep stack of service calls with three retries at each layer: if the database fails, the load on it increases "243x" [4]. Its advice for low-cost operations is to "retry at a single point in the stack" [4]. It also recommends backoff, jitter to spread retries out, and a local token bucket to limit them [4].
An AI chat is a deep stack by nature: browser, app server, agent loop, tool gateway, payment API. If the browser, the agent and the gateway each make up to three attempts, one tap can become 27 requests (3 × 3 × 3, the author's arithmetic, following the AWS example). Pick the layer that owns the user's intention, usually the one that created the key, and let the others fail fast and report. Whichever layer retries, it reads the same stored key.
Stripe's SDKs retry too, with exponential backoff, and defaults depend on SDK and version [2]; SDK retries plus your own on top is the layering problem again.
Which errors to retry
A retry rule should name the failure, not just repeat on any error. This table collects what the sources read say; the right column is the author's synthesis for the fictional app.
| What came back | What the sources say | What the chat client does |
|---|---|---|
| Connection error or timeout, no response | Outcome unknown [1][2] | Same key, same payload, within the key's retention; then reconcile |
| 409, request with this key still running | IETF: conflict while the first runs; Stripe: wait and retry with the same key [1][2] | Wait, then ask again with the same key |
| 400 or 422 from bad parameters | IETF: clients must correct the request before a retry [1] | Do not retry; fix the request |
| 429 with Retry-After | Wait at least as long as it says [7] | Wait, then retry |
| 429 from a spend cap or exhausted credits | Anthropic: keeps failing until access resumes; OpenAI: retrying billing or quota errors will not restore access [6][7] | Stop; tell the user |
| 500 on an action | Stripe: treat as indeterminate; do not use a new key until the original outcome is resolved [2] | Same key, then reconcile |
The 500 row is the least intuitive: an error status feels like a clean "no". Stripe says to treat a 500 as indeterminate, because "the operation might have produced side effects even though you received an error" [2].
When retrying stops: look the outcome up
A key is not kept forever. Stripe may remove v1 keys once they are at least 24 hours old [8], and says that for a lost connection you should retry with the same key within the first 24 hours; "if you still haven’t received a result when that window ends, stop retrying and reconcile the outcome" [2]. Reconciling means asking the system of record: retrieve the object, inspect the request, use webhook events [2].
In the fictional app that is a lookup of the transfer by intent-7f3a in the ledger. Starting a fresh key while the answer is still unknown is the exact action the preceding sections exist to prevent. If reconciliation cannot give an answer, the chat should say plainly that the state is unknown and point to a human or a statement page, not make another transfer.

A five-minute check
For one action your chat can take, answer:
- Is the key created once, when the user confirms, and stored with the intention?
- Does every layer read that key instead of making its own?
- Does exactly one layer retry, with backoff and jitter and a limit, and do the others fail fast?
- Does the interface show an unknown state after a timeout, instead of "Failed, try again"?
- Is there a lookup by key for the outcome, and a stated end to retrying that falls back to it?
- Does the receiving system publish how it treats keys: saved result on a duplicate, refusal of a different payload, retention time?
What this article cannot tell you
It does not show that any design here prevents duplicates in your system; the sources document what providers say and recommend, and the transfer is an invented illustration, not a test. The idempotency specification is a work-in-progress Internet-Draft and may change. The AWS Builders' Library article dates from 2019, and its numbers are examples, not recommendations for your latency. The model providers' pages describe their own request retries; none of them speaks about tool calls, so how an agent framework retries tools has to be read from its own documentation. Nothing here covers blockchain-specific problems such as a transaction that is pending, replaced or reordered on a network; they need their own sources.
How this article was made
| Task | What the AI did | What a person did | How it was checked |
|---|---|---|---|
| Research | Gathered candidate sources and drafted notes | Chose the question and which pages to rely on | Every quote checked against the raw page text named in the sources, read on 1 December 2026 |
| Draft | Wrote the first draft from the notes | Edited the text, the fictional transfer and the checklist | An independent review compares claims with the sources before publication |
| Images | Generated the cover and inline illustrations | Chose and checked them | Labelled as AI-generated in the disclosure line and alt text |
| Not done by AI | — | The decision to publish and responsibility for the text | — |
Conflicts of interest: none. The author has no commercial relationship with the organisations named here.
Responsible for this article: Dmitriy Lastovka, author. Corrections: contact form.
Sources
Labels: draft (work-in-progress standard), standard (published standard), guidance (provider documentation or engineering article). Quotes are as on the pages read on 1 December 2026.
- IETF HTTPAPI working group, "The Idempotency-Key HTTP Header Field", draft-ietf-httpapi-idempotency-key-header-09. https://www.ietf.org/archive/id/draft-ietf-httpapi-idempotency-key-header-09.txt Draft; dated 21 November 2026, expires 25 May 2027; work in progress.
- Stripe, "Advanced error handling" (HTTP-level errors, network errors, idempotency). https://docs.stripe.com/error-low-level Guidance; no revision date on the page. The page says its idempotency guidance applies to API v1.
- IETF, RFC 9110, "HTTP Semantics", section 9.2.2, Idempotent Methods. https://www.rfc-editor.org/rfc/rfc9110.txt Standard.
- Marc (AWS), "Timeouts, retries, and backoff with jitter", AWS Builders' Library. https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/ Guidance; page shows "Published Dec 5, 2019"; the URL now redirects to AWS Builder Center.
- Microsoft, "Retry pattern", Azure Architecture Center. https://learn.microsoft.com/en-us/azure/architecture/patterns/retry Guidance; page shows "Last updated on 2026-11-24".
- Anthropic, "Errors", Claude API documentation. https://docs.anthropic.com/en/api/errors Guidance; no revision date on the page.
- OpenAI, "Error codes", API documentation. https://platform.openai.com/docs/guides/error-codes Guidance; no revision date on the page.
- Stripe, "Idempotent requests", API reference. https://docs.stripe.com/api/idempotent_requests Guidance; no revision date on the page.










