Backend for AIintermediate10 min · 10 steps
Idempotency Keys
A unique key on each non-idempotent request lets the server recognise a retry and return the original result instead of doing the work twice.
requestheavy workdatatool callresponsesignal
ProblemStep 1 of 10
The work succeeded; the reply got lost
An agent tool posts a comment to ticket INC0045121. ServiceNow adds it, but the response times out on the way back. The tool can't tell "failed" from "succeeded but the reply got lost", so it retries, and the ticket gets the same comment twice.
Agents make this more likely: tool timeouts, loop retries, and runs resumed from a checkpoint all re-send the same operation.
Watch outNetworks fail after the server did the work but before the client heard about it. Retries without keys turn that into duplicates.
Lesson 15 of 20 in Backend for AI