Human-in-the-Loop LangGraph: Interrupt, Approve, and Resume
Advanced · 30 minutes · 5 tasks, checked automatically · 100 points
Build a LangGraph agent that pauses before executing a destructive tool call, waits for human approval, and resumes from a persisted checkpoint. You will wire together a MemorySaver checkpointer, an interrupt_before directive, and the graph's update_state / invoke resume pattern — all powered by GPT-4o on your own OpenAI account.
What you’ll learn
- Install LangGraph and its dependencies, then verify the environment is ready
- Implement a StateGraph with a MemorySaver checkpointer and a simulated destructive tool (delete_records)
- Compile the graph with interrupt_before so execution pauses before the tool node runs
- Run the graph until it hits the interrupt, inspect the pending tool call in the checkpoint, then approve and resume
- Confirm the full execution trace is captured in a JSON log and the destructive tool ran exactly once after approval
How this lab works
- Start the lab: One click starts a sandbox with a local model and the agent’s toolbox: no API key and no token bill.
- Work through 5 tasks: Each task says what to build or fix. You do it yourself, in a real terminal, with hints when you get stuck.
- Check your work: Check my work inspects the agent, its config and its output, and says what passed and what to fix.
- Finish and keep going: 100 points, your progress saved, and the next lab to try.
What it runs on
- Runs: Locally, against a model on your computer: no API key, no tokens
- Model: gpt-4o
- Open source: github.com/langchain-ai/langgraph
What you need
- A free LearnXops account
- The LearnXops desktop app for macOS, Windows or Linux
- OpenAI API key added once in the LearnXops Agent Playground (stored encrypted in OS keyring)
- OPENAI_API_KEY available in the toolbox container environment
Topics: langgraph, human-in-the-loop, interrupt, checkpoint, resume, MemorySaver, tool-approval, gpt-4o, hosted-model, StateGraph
Create a free account to start this lab.
Keep going
- Compose Subgraphs: Parent Graph Orchestrating a Self-Contained Child Graph
- Time Travel with LangGraph: Rewind and Re-execute Checkpointed State
- Wire an MCP Server into an Agent Loop with a Local Model
- Install, Inspect, and Disable an OpenClaw Plugin from ClawHub
- OpenClaw Message Queue Channel: Agent-Powered Request/Reply
- Shape Agent Behaviour with SOUL.md, USER.md and AGENTS.md