New Tool Radar

AI Agents & Automation

How to Pause a LangGraph Graph for Human Approval Before a Risky Node

Compile a LangGraph graph with interrupt_before on a risky node so the graph genuinely stops and waits for a person.

Schematic diagram with three steps: Add the checkpointer, Set interrupt_before, then Test the pause.

Pausing for human approval before a consequential step is one of the most direct safeguards for an agent, and it needs real infrastructure: a graph has to genuinely stop, potentially for hours, and later resume in exactly the state it left off. LangGraph checkpointing provides that, and interrupt_before names the node where the pause happens.

Before you start

You need a LangGraph graph compiled with a checkpointer, because interrupts need saved state to resume from. Pick the risky node first: the one that sends money, writes data or contacts a customer.

Compile with interrupt_before on the risky node

Pass interrupt_before with the risky node name when you compile the graph, for example interrupt_before=["process_refund"]. The graph reaches that point and genuinely pauses, returning control to your application rather than continuing automatically. A checkpointer is required for this to work.

Test the pause with a real approval wait

Run the graph with a request that reaches the risky node and check the run stops before the node executes. Read the saved state to confirm what is waiting, then approve and resume. If the node runs anyway, the interrupt name does not match the node name.

Worked example: A refund pause for a fictional shop agent

Maple Shop is a fictional online shop. Its graph pauses before processing a refund of 750 dollars for customer cust-123. The example values come from the LangGraph human-in-the-loop guide we checked.

Step What happens
1 Graph reads the refund request for 750 dollars
2 Graph pauses before the process_refund node
3 A person reviews the request and approves it
4 Graph resumes and processes the refund

Expected result (UNTESTED): the run pauses before the refund node, the saved state shows the request amount of 750 and the customer cust-123, and nothing is processed until approval. We checked the LangGraph human-in-the-loop guide, which shows the interrupt_before pattern with the same example values, but we did not run the graph on this machine.

Limits

An interrupt needs a persistent checkpointer for a wait of hours: MemorySaver loses the state on restart. The approval also needs a real rejection path, not just an approve button, or a bad request has nowhere to go.

Sources

See all