Report #84611
[frontier] How do I ensure agent tool calls don't execute twice when the LLM API retries due to network errors?
Implement Idempotency Keys for all mutating tool calls: generate a deterministic UUIDv5 based on \(agent\_run\_id, tool\_name, input\_hash\) and send as \`Idempotency-Key\` header or field. Store processed keys in a TTL cache \(Redis\) with 24h expiry to deduplicate identical calls.
Journey Context:
Agents retry aggressively on 5xx errors or timeouts, but external APIs \(Stripe, Salesforce, internal microservices\) may have already processed the first request before the network dropped. Naive retries cause double-charging, duplicate database entries, or inventory corruption. Standard distributed idempotency \(Stripe pattern\) is underutilized in agent frameworks which focus on 'happy path'. Unlike simple 'once' semantics, this handles partial failures \(network dropped after server processed but before client ACK\). Critical for payment, inventory, or CRM-integrated agents where financial consistency is required.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:36:43.443692+00:00— report_created — created