Not every tool is safe to retry. A read is safe: calling it twice returns the same answer and changes nothing. A write is not: calling it twice can create two records, send two messages, or charge twice. The rule is to retry automatically only the tools that are safe to repeat, and to pause on the rest, handing the decision to a person. LangGraph’s own guidance points the same way: side effects before an interrupt should be idempotent, because the node re-runs from the top on resume. Mark each tool safe or unsafe when the agent is built, and let the retry logic read that mark, not guess.
What you need
- A list of the agent’s tools, marked safe to repeat or not
- A retry rule that reads the mark: automatic for safe tools, pause for unsafe ones
- One safe tool and one unsafe tool to test the rule on
Step 1: Mark each tool safe to repeat or not
Go through the tool list and mark each one: a read, or a write with an idempotency key, is safe to repeat; a write without one is not. A tool with no mark is treated as unsafe.
Step 2: Retry safe tools automatically, pause on unsafe ones
When a safe tool fails, retry it automatically with a growing pause. When an unsafe tool fails, stop and ask a person, with the state of the write shown. Never retry an unsafe tool blindly.
Step 3: Test both marks with a forced failure
Force a failure in a safe tool and confirm it retries and succeeds, then force a failure in an unsafe tool and confirm it pauses instead of retrying. If the unsafe tool retries, the mark is not wired into the retry logic.
Worked example: synthetic retry safety check
The table below is a synthetic example. It shows the expected result of retrying only safe tools; no tool was retried live.
| Tool | Safe to repeat? | On failure |
|---|---|---|
| search_docs | Yes | Retried, succeeded |
| lookup_order | Yes | Retried, succeeded |
| send_message | No | Paused for a person |
| No unsafe retry happens | Yes | Pass |
Expected result (UNTESTED). the two safe tools retry automatically and succeed, and the unsafe send pauses for a person instead of retrying. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- A mark is only as good as the review behind it; a write wrongly marked safe will double-write.
- A retry can still fail, so cap the retries even for safe tools.
- A paused unsafe tool needs a person watching, or the run stalls.
- Idempotency keys can make a write safe; without them, assume it is not.
