Idempotency patterns for AI tool calls
5 Jul 2026 · 7 min read
Agent tools that write, send, publish, deploy, or delete need idempotency before retries are safe.
Retries are only safe when repeated execution cannot create duplicate side effects.
AstraRunner treats this as an execution-platform concern: the run needs durable state, traceable decisions, cost visibility, and enough structure for teams to review what happened after the agent finishes.
Patterns that work
- Use idempotency keys for external writes.
- Record tool request and response pairs.
- Separate dry-run, prepare, commit, and verify phases.
- Require approval before irreversible commits.
Implementation checklist
- Generate stable operation IDs.
- Store external resource identifiers.
- Detect duplicate tool requests.
- Verify side effects before retrying.
Watch outs
- LLM tool arguments can vary between retries.
- Some third-party APIs do not support idempotency.
- A retry after timeout may have already succeeded.
Related reading
How this fits the Astra stack
AstraRunner owns the operational path for agent work: orchestration, scheduling, approval gates, traces, costs, and role-agent handoffs. AstraMemory owns durable context and retrieval. AstraGenie turns those capabilities into product workflows for teams that want automation without rebuilding the platform layer.