What is Idempotency?

An operation is idempotent if running it many times has the same effect as running it once. It is what makes safe retries possible when a network call's outcome is uncertain, a core concern for agents.

Idempotency means that repeating the same request produces the same end state as making it a single time, with no extra side effects. Reading a record is naturally idempotent; charging a card or sending a message is not, doing it twice charges twice. This matters whenever a caller cannot be sure a request succeeded: a timeout or dropped connection leaves the client unsure whether the server applied the change, and the only safe move is to retry. If the operation is idempotent, retrying is harmless; if it is not, the system needs a way to deduplicate. The standard mechanism is an idempotency key, a unique client-generated identifier sent with the request, the server records the key with the result of the first call and, on seeing the same key again, returns that stored result instead of repeating the work. Payment and messaging APIs build this in for exactly this reason. Idempotency is foundational for AI agents and MCP tools because agents retry aggressively under rate limits and transient errors, and a model may even re-issue a call after a confusing response. A tool that mutates state should therefore be designed to be idempotent or to honor an idempotency key, so an agent's retry does not duplicate an action. It pairs with rate limiting and backoff to make pipelines resilient rather than dangerous.