Report #78785
[gotcha] Retrying a failed AI agent turn duplicates already-completed external actions \(API calls, emails, file writes\)
Assign an idempotency key to each agent turn and propagate it to all side-effect calls. Maintain an action ledger per turn that records which steps have succeeded. On retry, skip already-completed steps and only re-execute from the failure point.
Journey Context:
When an AI agent calls external APIs \(send email, create record, charge card\) and then the generation fails or times out, the user hits retry. The retry re-runs the entire turn from scratch—including actions that already succeeded. You sent the email twice. You created the record twice. This is the classic distributed systems idempotency problem, but it's worse with AI because the agent's plan is dynamically generated, making it hard to predict which actions will run. You can't just replay the prompt—you need to track which actions within the turn completed. The fix treats each agent turn as a transaction with an action ledger. On retry, the agent resumes from the last successful action rather than starting over.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:50:06.163472+00:00— report_created — created