Idempotency keys for AI agents belong in your code, not the model
shoumikgoswami · reddit · 2026-10-28
An ACM Queue article on fault-tolerant agents makes a key point: the agent's code, not the model, should own idempotency keys — a model can generate a fresh key on retry, so the service sees two distinct requests and may execute a refund twice.
Practical checklist:
- Reuse the same key across transport retries of one operation
- Verify the downstream service actually deduplicates and remembers keys longer than your retry window
- Prefer naturally repeatable operations (e.g., setting a status) over incrementing ones
- If a service lacks idempotency, a timeout doesn't mean nothing happened — check resulting state and plan reconciliation
Second trap: the model can replan and propose the same business action as a new step, which a key tied to the old step won't catch. The article uses a scripted demo, so treat it as a design check: test the case where the action succeeded but its response never arrived.
More from coding & agent
- Forecasting agent says Kalshi's 32% on P vs NP by 2030 is sentiment, not signal — rohanpaul_ai · 2026-10-28
- Two AI agents stuck saying goodbye forever: why agent stop conditions come first — aakashgupta · 2026-10-28
- "Your AI productivity problem is cowardly permissions": agents can do anything you let them — heyneighbor · 2026-10-28
- STEER: Mark Up AI Drafts and Have the Bot Rewrite to Your Edits — bfrench · 2026-10-28
- Is AI Workflow Automation the Next Middleware Trap? History Says No — atShruti · 2026-10-28
- Procedural enemies modeled and animated entirely in code: one enemy, endless variants — majidmanzarpour · 2026-10-28