en un clic
langgraph-interrupt-pattern
Use when implementing LangGraph workflows that need to pause for user input or external confirmation before continuing execution
Menu
Use when implementing LangGraph workflows that need to pause for user input or external confirmation before continuing execution
Universal coding standards, best practices, and patterns. Use when developing in any language — triggers on TypeScript, JavaScript, React, Node.js, Python, Nix, ruff, pyright, pytest, uv, flake.nix, justfile, just, recipes, and general code quality topics.
Use when writing git commit messages, reviewing commits, or setting up commit conventions. Triggers on commit, git commit, commit message, changelog, semantic versioning.
A formal evaluation framework for Claude Code sessions, implementing eval-driven development (EDD) principles.
Audit NixOS impermanence configuration — find files on root filesystem not covered by persistence declarations. Use when the user wants to check for untracked files, audit impermanence, or runs /impermanence-audit.
Docker-in-Docker with network_mode host for multi-node simulation
Workaround for @nuxt/eslint not auto-detecting TypeScript, causing vue-eslint-parser to fail on <script lang="ts"> blocks
| name | langgraph-interrupt-pattern |
| description | Use when implementing LangGraph workflows that need to pause for user input or external confirmation before continuing execution |
Pattern for using LangGraph interrupt() to pause graph execution at a node and resume after receiving external input (e.g., user confirmation, selection).
thread_id in the config across stream and resume callsfrom langgraph.types import interrupt
def my_node(state):
# Do work, then pause for input
user_input = interrupt({
"reason": "need_selection",
"options": ["option_a", "option_b"],
"context": "Choose which path to take"
})
# Execution resumes here after user responds
match user_input.get("action"):
case "select":
selected = user_input["selected"]
return state.model_copy(update={"selected": selected})
case "skip":
return state
from langgraph.types import Command
# Resume the graph with user's response
async for event in graph.astream_events(
Command(resume={"action": "select", "selected": chosen_item}),
config={"configurable": {"thread_id": thread_id}},
version="v2",
):
# Process streamed events
pass
state_snapshot = await graph.aget_state(config)
for task in state_snapshot.tasks:
for intr in task.interrupts:
payload = intr.value # The dict passed to interrupt()
reason = payload.get("reason")
options = payload.get("options")
| Mistake | Fix |
|---|---|
| No checkpointer configured | interrupt() silently fails without a checkpointer |
Different thread_id on resume | Must match the original stream's thread_id |
Passing full state to astream_events on resume | Pass Command(resume=...) only, not the state |
| Forgetting to handle the resume value | interrupt() returns whatever was passed in Command(resume=...) |