Claude Certified Architect – Foundations Practice Question 63: Retry Safe Side Effect Tools

Claude Certified Architect, Foundations · Test 7 · question 3 of 10

Agent Architecture & Orchestrationhard

An agent has a charge_customer tool that calls an external payment API. In production, the payment API occasionally processes a charge but the response is lost, so the tool's HTTP call times out. The agent's retry logic then calls the tool again, and some customers are charged twice. The team wants retries and agent autonomy to stay. Which change addresses the root cause?

Select one answer
Show answer and explanation

Answer:

  • B. Send a deterministic idempotency key, derived from the order and action, with every payment call

B is correct. A timeout is ambiguous: the client cannot tell whether the side effect happened. Agent loops and harnesses commonly retry failed tool calls, so any side-effecting tool should be safe to run at least once more than intended. The standard fix, general distributed-systems practice rather than anything Claude-specific, is to make the operation idempotent: derive a stable key from the business intent (for example, order ID plus "charge") and pass it to the payment provider, which returns the original result instead of charging again. The key must be stable across retries, not a fresh random value per attempt.

A is wrong because a prompt rule is probabilistic and does not stop the harness or SDK retrying after a timeout. C is wrong because it removes resilience for every transient error and still leaves the user unsure whether they were charged. D is wrong because annotations are hints that change no behavior of the handler, and marking a charging tool read-only would be inaccurate and could wrongly allow it to run in parallel with other read-only tools.

Reference: Stripe API - Idempotent requests

Practice Test 7 ›

Study guides for Claude Certified Architect, Foundations