Idempotency
An operation is idempotent if running it twice has the same effect as running it once. It is what makes retries safe, so a duplicated request, message, or tool call does not double-charge or double-act.
also: idempotency · idempotent · idempotency key
Networks and queues deliver more than once, clients retry on timeouts, and agents re-issue tool calls, so any system that does real work has to assume duplicates. The standard defence is an idempotency key: the caller attaches a unique id, the server records it with the result, and a repeat with the same key returns the stored result instead of doing the work again. Payment APIs do exactly this so a retried charge does not bill twice.
Idempotency is what lets the rest of your reliability story work. At-least-once delivery, automatic retries, and crash recovery are all safe to use precisely because the operations underneath them are idempotent; without that, every retry is a new risk. For agents it is sharper still, because a model may call a tool again after a timeout it never saw the response to, so write-side tools need idempotency keys or they will act twice.
related_terms
faq
Questions & answers
- What is an idempotency key?
- A unique identifier the caller attaches to a request so the server can recognise a retry. The server stores the key with the result of the first call and, on any repeat with the same key, returns that stored result instead of performing the action again, so duplicates do not double-act.
- Why does idempotency matter for AI agents?
- Because agents retry. A model may re-issue a tool call after a timeout it never saw the response to, or loop and repeat an action. If a write operation is not idempotent, that retry sends a second email, places a second order, or charges twice, so any tool with side effects needs an idempotency key or an equivalent guard.
Want this applied to your stack, not just defined?
The free tools run the numbers; an audit tells you where the real cost and risk are. Book a call, or leave your email and I'll reach out.
Prefer proof first? See how this plays out in real case studies →