AGENTING · Builder Lab
By Ravindra Dastikop
An agent drafts an email asking a client to move a meeting. The date is wrong. Can the reviewer stop the workflow before it reaches the send step?
LangGraph lets you build that decision into the workflow. In this lab, a preset draft stands in for an agent’s output. The graph pauses, waits for a reviewer’s decision, then either simulates a send or closes the run.
Check access
Availability checked on 28 November 2026. LangGraph 1.2.24 was published on 20 November. You can install it locally from PyPI. This demo uses a preset draft and a simulated send, so the only service you need to reach is PyPI during installation.
LangGraph releases · LangGraph 1.2.24 on PyPI
Build the approval step
In a Python virtual environment, run python -m pip install "langgraph==1.2.24". Save the code as approval_demo.py and run python approval_demo.py.
from typing import Literal, TypedDict
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.graph import END, START, StateGraph
from langgraph.types import Command, interrupt
class State(TypedDict, total=False):
draft: str
outcome: str
def review(state: State) -> Command[Literal["simulate_send", "__end__"]]:
approved = interrupt({"draft": state["draft"]})
if approved is True:
return Command(goto="simulate_send")
return Command(update={"outcome": "Rejected"}, goto=END)
def simulate_send(state: State) -> dict:
return {"outcome": f"Simulated send: {state['draft']}"}
builder = StateGraph(State)
builder.add_node("review", review)
builder.add_node("simulate_send", simulate_send)
builder.add_edge(START, "review")
builder.add_edge("simulate_send", END)
graph = builder.compile(checkpointer=InMemorySaver())
config = {"configurable": {"thread_id": "approval-demo"}}
paused = graph.invoke(
{"draft": "Could we move our meeting to Tuesday at 3 p.m.?"},
config,
)
print("Review request:", paused["__interrupt__"][0].value)
answer = input("Approve? Type yes or no: ").strip().lower()
result = graph.invoke(Command(resume=(answer == "yes")), config)
print(result["outcome"])
interrupt() pauses execution and gives the reviewer the draft. The second call uses the same thread ID to resume that run. Only an explicit yes reaches the simulated send step.
LangGraph restarts the review node from the beginning on resume, so keep actions such as sending an email out of the code before interrupt(). The in-memory checkpointer is suitable for this exercise while the script is running. Use a persistent checkpointer if a reviewer needs to resume after the process exits.
LangChain documentation — Interrupts
Test approval and rejection
- Run 1. Type
no. The output should sayRejected. - Run 2. Restart the script and type
yes. The output should start withSimulated send:and include the draft you reviewed. - Run 3. Restart the script and press Enter. The output should say
Rejected. A blank response should never count as consent.
Try the same design on another workflow. Pick the exact action that needs approval, then decide what the reviewer needs to see before saying yes.
