Designing Idempotent Side-Effect Contracts for AI Agents

An AI agent calls send_refund. The payment provider accepts the request, but the response disappears during a network timeout. The runtime sees an exception and retries. The second request also succeeds.The trace now looks reassuring:send_refund attempt=1 timeout send_refund attempt=2 success agent run success The customer sees two refunds. This is a synthetic example, but the failure mode is ordinary distributed-systems behavior. The agent did not need a stranger prompt or a better model. It needed a tool contract that distinguished an unsuccessful response from an unsuccessful effect.That distinction matters anywhere an agent can change the world: sending a message, creating a ticket
…