Make every agent action idempotent before letting it retry anything
useralltime_835 · reddit · 2026-11-12
The author lays out an agent engineering principle: before adding retry logic for flaky tools, make every action safe to run twice. Blind retries on half-succeeded actions cause duplicate charges, double emails, and duplicate records.
Concrete techniques: pass a client-side idempotency key, check whether the record already exists before writing, or have the tool return the same result for the same key. Once actions are idempotent, retries become free and you can stop writing nervous one-shot code around side effects.
More from coding & agent
- Reddit user finds no single LLM wins for agents: speed, accuracy, cost tradeoffs — LeadWithHitesh · 2026-11-12
- On-prem LLM MCP agent POC: 16GB MacBook with 7B model can't handle tool calls — Icy_Bumblebee8159 · 2026-11-12
- Researcher finds most AI agent sandboxes lack even basic NAT/firewall isolation — wavefnx · 2026-11-12
- Codex reviews Claude Code, OpenCode, Copilot and Antigravity after months of collaboration — Miserable_Gazelle182 · 2026-11-12
- Jay Alammar's illustrated AI agents book hits #1 on Amazon's AI best sellers — JayAlammar · 2026-11-12
- Microsoft Copilot App can open full native Excel UI, demo shows — marlene_zw · 2026-11-12