- Distinguish model retry, tool retry, and workflow retry.
- Design idempotent actions for payments, emails, tickets, and data changes.
- Create an execution table that blocks duplicates.
tabla_tool_executions:
idempotency_key: "invoice-email:cliente-42:2026-07"
tool: "send_email"
status: "completed"
result_id: "msg_abc123"
regla:
si existe completed con misma key:
devolver result_id anterior
no ejecutar tool otra vez
si existe running:
esperar o marcar conflicto
si falla:
guardar error y decidir retry con humanoSafe pattern
- Generate an `idempotency_key` before calling the tool.
- Record `running` before the external effect.
- Mark `completed` only when the provider confirms.
- On retry, check the table before acting.
- For irreversible actions, add human approval.