Why Did My AI Agent Send Duplicate Emails or Double-Charge Customers?
Missing action deduping: why AI network retries trigger duplicate charges and spam storms.
AI agents send duplicate emails or double-charge cards when network timeouts or partial API failures trigger internal retry loops. Because the model plans step-by-step without a persistent side-effect ledger, it believes each retry attempt is its very first. Exogram enforces automatic deduplication keys and 0.07ms safety brakes.
What Actually Happened in the Real World
A customer support bot was processing a $250 invoice refund. The payment gateway experienced a 3-second network spike and returned a HTTP 504 Gateway Timeout. The agent assumed the transaction failed, retried four times in succession, and ended up charging the customer twice while sending five identical apology emails.
Why Polite Prompts Like “Please Don't Do This” Fail
Instructing an AI "Never send duplicate emails or charge cards twice" has zero impact on network sockets. When an API call drops or hangs, the model receives an error response and follows its recovery instructions to try again.
The Sub-Millisecond Code Fix
Exogram attaches an idempotency token to every external tool call. If an action with identical parameters is attempted within a configured cooldown window, Exogram returns the cached receipt instead of re-executing the network call.
import { ExogramIdempotency } from '@exogram/sdk';
const dedup = new ExogramIdempotency({ cooldownSeconds: 300 });
export async function processRefund(customerId: string, amount: number) {
// Blocks duplicate financial transactions within 5 minutes
const token = `refund_${customerId}_${amount}`;
return dedup.executeOnce(token, async () => {
return paymentGateway.chargeOrRefund({ customerId, amount });
});
}Frequently Asked Questions
Why do LLMs retry dangerous actions on timeout?
LLMs cannot distinguish between a dropped request and an unexecuted request. Unless hardcoded deduplication sits outside the model, retries will duplicate side-effects.
Related Diagnostic Answers
Comparison Guides
Stop AI Mistakes Before They Execute
Exogram sits directly between your AI model and your tools. Set up in 10 seconds inside Claude, Cursor, ChatGPT, or your own code.