A database write is the step that must not run on the agent’s say-so alone. LangGraph interrupts pause the graph at a chosen point and wait for a person, saving state in the checkpointer until the run is resumed with a decision. Put the interrupt before the write node, not after it, and show the person the exact change: the table, the rows affected, and the values. A checkpoint after the write has already happened is decoration, not control. Keep the work before the interrupt read-only, because the node re-runs from the top on resume.
What you need
- A LangGraph graph with a node that writes to a database
- A person who will answer approval requests
- A checkpointer configured so the paused run survives a restart
Step 1: Place the interrupt before the write node
Add an interrupt that pauses before the database write, carrying the exact change as its payload: table, rows affected, and values. Nothing that writes may run before it.
Step 2: Show the change and wait for a decision
Surface the payload to the approver and wait. Approve resumes the run and the write executes; reject routes the run elsewhere and no write happens.
Step 3: Test both answers once
Run the graph, approve once and confirm the write lands, then run it again, reject once and confirm nothing was written. If a rejection still writes, the interrupt is in the wrong place.
Worked example: synthetic database approval
The table below is a synthetic example. It shows the expected result of the approval gate; no graph was run.
| Check | Expected | Result |
|---|---|---|
| Graph pauses before the write | Yes | Pass |
| Approve runs the write | Yes | Pass |
| Reject skips the write | Yes | Pass |
| Nothing writes while waiting | 0 writes | Pass |
Expected result (UNTESTED). the graph pauses before the write, runs it on approval, skips it on rejection, and writes nothing while waiting. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- LangGraph waits indefinitely at an interrupt, so a request nobody answers is a stuck run.
- The paused node re-runs from the top on resume, so work before the interrupt must be safe to repeat.
- An in-memory checkpointer loses the pause on restart; use a durable one in production.
- The approver needs the exact change, not a summary, to make a real decision.
