1:1 mentoring with Big Tech AI engineers
LLM & Agentic

interrupt(): Approval Gates

Pause a LangGraph run for human review with interrupt(), resume it with Command, and build one gate that supports approve, edit and reject without double-charging on re-run.

Last updated

After this section you can

  • Pause a run with interrupt() and resume it with Command(resume=...) on the same thread
  • Build one review node that handles approve, edit and reject without rewriting the model's turn
  • Keep side effects out of the code that re-runs on resume
37

interrupt(): Approval Gates

Any node can stop the run, hand a payload to a person and wait, across a redeploy if it has to. This section shows the call, the resume, the one rule that bites (the node runs again), and approve, edit and reject in one gate.

Key idea

interrupt() saves the state, returns its payload to your caller and ends the call. Resuming is a new call on the same thread with Command(resume=value): the node runs again from its first line, and this time interrupt() returns the value.

interrupt() saves the run and ends the call: the gap before the resume can be days
INVOKE 1 agent proposes a refund review interrupt({…}) checkpoint next: ("review",) process may exit minutes or days a person decides in your own UI INVOKE 2 · SAME THREAD_ID review runs again from line 1 tools refund runs Command(resume={"type": "approve"}) becomes the return value of interrupt() interrupt() ends the call and hands its payload to your code. It does not block a thread or wait in memory. The resumed node re-runs from the top, so anything above interrupt() runs twice. Keep it pure.

Related

More in LLM & Agentic

Get full access to all 74+ sections with code examples, diagrams, and interactive animations.

Unlock Premium