A payment tool times out.
Your retry logic fires - and the customer is charged twice.
- AIncrease the timeout so the call has time to finish
- BStop retrying timeouts - they are not safe to repeat
- CAsk the user to confirm before every retry and show them the last charge, so a human always decides whether to pay a second time
- DSend an idempotency key, so the retry IS the same operation rather than a second one
Answer: D
Send an idempotency key, so the retry IS the same operation rather than a second one
Why
A timeout tells you nothing about whether the work happened. Only the receiver can settle that - an idempotency key lets it recognise the repeat. Longer timeouts and no-retry both just shift the failure.
- Errors & recoveryAfter a tool returns an error, the agent calmly calls the very same tool with the very same arguments, again and again.
- Errors & recoveryYour main AI provider fails halfway through a streamed answer; the user already sees the first paragraph.
- Errors & recoveryA nightly batch of 20,000 documents on DeepSeek stopped at document 12,000 with HTTP 402.
- Errors & recoveryA tool call fails with an error.
More on Way of the Agent
- Course programThe first three modules are free: start in the browser or the app, no card needed.
- Library: guides, skills and promptsReady prompt templates, grouped into collections.
- AI ChroniclesSourced stories from the history of AI.
- ConceptsPlain-language explainers of agent engineering.
- Learn AI agentsApps and courses for learning AI agents, compared honestly.
Real situations from building agents - with the answer and why.
Solve a new one every day on the Path