An agent that works in testing and fails in production usually has not got worse at reasoning. It has started retrying.
In a test run every tool call happens once. One user, no concurrency, clean state. Production adds back the three things the harness quietly removed: timeouts, parallel runs, and history.
So the failure moves into the retry layer. The loop retries when a call times out, when a tool response fails to parse, when a step blows its token budget. By then the side effect has already landed: the capture, the queued payout, the sent notification. Only the acknowledgement was lost. That part is ordinary payments work.
What is specific to agents is worse: the retry is not the same call. The model regenerates the arguments. A different amount string, a reordered payload, a reformatted reference. So an idempotency key derived from the tool arguments dedupes nothing. It mints a fresh key for the same intent, and the second write looks legitimate all the way down.
The fix is to stop letting the model own the key. I derive it from step identity (run id, plan step, target entity), assigned before the model is asked anything and not read back from its output. The tool checks the key and returns the prior result instead of acting twice.
Test harnesses do not retry. That is most of why they pass.
If you run agents against write APIs, I think the question worth asking is where your idempotency key comes from: the model's arguments, or the step.