hotai.news
← Back to AI WikiAI Wiki / Core concepts

What is idempotency? Preventing duplicate effects during retries

Understand idempotency through a timed-out ticket creation, including intent, keys, matching parameters, lifetimes, and limits beyond a single operation.

HotAI.news · Sources checked with CodexPublished on 2026-10-20Sources checked on 2026-10-20
Our take

Understand the concept

Idempotency means repeating the same operation under its contract causes no additional duplicate effects. It can prevent one intent creating multiple records after timeouts or agent retries. Implementations often use request identifiers, with provider-specific scope and retention. Equal parameters need not imply equal intent, and idempotency does not make all distributed steps transactional.

01

A timeout alone cannot establish whether execution occurred

A ticket-creation request can succeed server-side even when its response is lost. An ordinary retry may create a second ticket. Reconcile state or use an implemented idempotency contract. This example creates no real tickets.

AWS explains using caller request IDs to express intent rather than only hashing parameters, since users may want two identical resources. Agent retries should preserve the original identifier, while independent tasks should not reuse it arbitrarily.

02

Keys must match parameters and service rules

Stripe documents keyed requests and parameter consistency checks. This is a service-specific contract, not evidence that every API accepts the same header. Check retention, operation scope, and concurrent-request behavior.

Without server support, callers may need durable execution state and reconciliation. In-memory flags disappear on crashes, and records can diverge from real actions. A set-based deduplication demo is not a complete production design.

03

Verify duplicate effects separately from completion

In testing, repeat one key and confirm one record, use a new key for a new record, and check changed parameters under the same key. These are proposed checks without payment calls, real writes, or measured success rates.

Controlled duplicates do not establish correct ticket content or completed notifications. Check each distributed step and recovery mechanism. Preserved execution IDs and results are more auditable than reminders not to repeat, with target state as the final evidence.

Checked sources

These sources support the concepts and methods described here. Examples and test scope are labeled separately; check the version of the tools you use.

Back to AI Wiki ↗