AITraining2U

Programs

Resources

Case Studies

Quick Links

Enquire Now
Domain 4 · 18%% of exam

Idempotency, partial success and safe retries

The property that decides whether retrying a tool is safe at all.

5 min read · Lesson 9 of 10 in this domain

Retry logic and idempotency are the same conversation. An operation is idempotent when performing it twice leaves the same state as performing it once — reading a record, setting a field to a value, deleting by id. An operation is not idempotent when repetition compounds — appending, incrementing, charging a card, sending a message. This matters because network failures are ambiguous: a timeout tells you the response was lost, not whether the work happened. Retrying a non-idempotent operation after a timeout can double-charge a customer. The standard remedy is an idempotency key supplied by the caller, so the server can recognise a repeat and return the original result instead of acting again.

Key points
  • Idempotent: repeating leaves the same state. Reads, absolute sets, delete-by-id.
  • Not idempotent: repeating compounds. Appends, increments, payments, sending messages.
  • A timeout is ambiguous — it says the response was lost, not that the work failed. That is why blind retries are dangerous.
  • Use a caller-supplied idempotency key so the server can detect a repeat and return the original outcome.
  • Partial success needs its own representation: a batch tool that half-succeeds must report which items succeeded, not a single pass/fail.
  • Report partial results as structured data, so the agent can retry only the failures rather than the whole operation.
Exam trap

Uniform retry policies ignore idempotency. Retrying a payment after an ambiguous timeout is how customers get charged twice.

Check your understanding

Which operation is safe to retry blindly after a timeout?

Correct answer: A — Setting a status field to a fixed value
Setting a field to an absolute value is idempotent: doing it twice leaves exactly the same state as doing it once. The other three compound with each repetition.

A tool updates 50 records and 6 fail. What should it return?

Correct answer: A — Structured per-item results identifying the 6 failures
Per-item results let the agent retry only the six that failed. A single overall status forces it to choose between redoing all 50 or abandoning the 44 that worked.

Practise this domain with 18%%-weighted questions in the study app.

Open in study app

Source: Claude Docs — Tool use overview · Independent study aid, not affiliated with or endorsed by Anthropic.