Tool Design and Contracts

Idempotent Tools

An idempotent tool produces the same result regardless of how many times you call it with the same arguments, making it safe to retry on failure without causing unintended side effects. This property is critical for agent systems because agents frequently retry failed tool calls, and without idempotency a retry could create duplicate records, send duplicate messages, or double-charge a payment. Designing tools to be idempotent by default, using unique request IDs, upsert operations, and check-before-act patterns, is one of the most important reliability practices for production agent systems.