An agent that calls a write API is a retry machine. It retries on socket timeouts, on 5xx responses, on gateway stalls, and on its own internal step budgets. When several agents or helper agents run in parallel, a slow response can produce two in-flight copies of the same logical write. A payments integration write-up describes exactly this shape: an agent retries a payment 20 times in 200 milliseconds, ten of them clear, and the fraud system flags none, so the reconciliation team finds it the next morning in Formance's agentic payments overview. The write path, not the agent, has to be the thing that makes duplication harmless.
Idempotency in the API sense means that sending the same request multiple times produces the same outcome as sending it once, and the standard mechanism is a client-generated key that the server records against the first execution as described in this idempotency guide. HTTP methods carry some of this for free: GET, PUT and DELETE are idempotent by definition, while POST and PATCH are not unless you design them to be per the same guide. Agent writes are almost always POST-shaped (create ticket, send payout, append event), so you need the key.
There is a second, quieter failure mode: two different logical writes sharing one key. That turns your idempotency guard into a data-loss machine, because the second write gets the first write's stored response and the caller believes its change landed. Most of the design work below is about keeping those two failure modes apart.



