AI Hints
Home›LangGraph Tutorial›Human in the Loop
LangGraph · Lesson 57 of 120

Resuming

Command(resume).

⏱ 2 min read▶ Video at 1:00:19🎓 Free
Watch this lesson in the LangGraph courseWatch on YouTube ↗Full LangGraph course

The manager has decided. To continue, invoke the graph again on the same thread, with a command holding the decision. Inside the node, interrupt returns that decision, and the node carries on.

Resuming
From the video: Resuming
  • The decision is made
  • Command(resume=...)
  • interrupt returns it

Approve and decline

Our refund graph comes from a helper file. Two refunds, on two threads, both pause. Then we resume each with a command, one with approve, and one with decline. Run it. Each refund finishes, with the status matching the manager's decision.

resume.pypython
from langgraph.types import Command
from refund_graph import graph

for thread, amount, decision in [("r1", 45.0, "approve"), ("r2", 80.0, "decline")]:
    config = {"configurable": {"thread_id": thread}}
    paused = graph.invoke({"amount": amount}, config)
    print(paused["__interrupt__"][0].value["question"])
    done = graph.invoke(Command(resume=decision), config)
    print(f"  manager: {decision} -> status: {done['status']}")
Output
Approve a refund of £45.0?
  manager: approve -> status: refunded
Approve a refund of £80.0?
  manager: decline -> status: declined
Also uses refund_graph.py
from typing import TypedDict
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.graph import StateGraph, START
from langgraph.types import interrupt

class State(TypedDict):
    amount: float
    status: str

def refund(s):
    decision = interrupt({"question": f"Approve a refund of £{s['amount']}?"})
    return {"status": "refunded" if decision == "approve" else "declined"}

b = StateGraph(State); b.add_node(refund); b.add_edge(START, "refund")
graph = b.compile(checkpointer=InMemorySaver())

Resume tips

Resume on the same thread ID, or LangGraph won't find the paused state. The resume value can be anything, a word, a number, or a dictionary. And the paused state waits safely, so the decision can come minutes, or days, later.

keyvalue
Same threadto find the pause
Any valueword, number, dict
Waitsminutes or days
Thennode continues

Summary

Invoke a command with resume, on the same thread, to continue. Interrupt returns the decision inside the node. Next, approving an agent's tool calls.

Key takeaways
  • Command(resume=...)
  • Same thread_id
  • interrupt returns it
Next up: Approving Tool Calls — yes or no