Study FAQ
How do I retry a Claude client tool action safely after a timeout?
Also asked as 2
- How can a Claude tool loop avoid duplicate writes after retries or repeated calls?
- What should I do if a client tool might have committed a change but lost its response?
Answer
Reserve an application operation record for the approved business action before dispatch, and check the tool's authoritative downstream state if a timeout leaves the outcome uncertain. Retry only when you can safely resume or deduplicate that exact operation. A generated tool_use ID correlates the result with the current request. A later turn can request the same business action with a different call ID. Handle tool calls Building effective agents
Use a business-operation identifier that distinguishes an intentional repeat from a retry, and bind it to the authorized actor, target, action, and material parameters. Reserve it atomically so concurrent attempts share the same record. On a retry, use the prior recorded result or the downstream idempotency mechanism where available. If you cannot establish whether a mutation committed, stop for reconciliation or human review. Building effective agents
Record the policy and approval decisions, operation key, status, and safe correlation identifiers. Give Claude an explicit failure or unresolved-state result when appropriate, and avoid reporting completion until authoritative evidence confirms it. A transient error on an idempotent read permits a different recovery policy from a potentially committed write. Handle tool calls Demystifying evals for AI agents
Full explanation
Implementing Claude Tools with Safe Execution and Approval Patterns
Study guide · CCDV-F
Read the full explanation