一键导入
langgraph-interrupt-pattern
Use when implementing LangGraph workflows that need to pause for user input or external confirmation before continuing execution
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when implementing LangGraph workflows that need to pause for user input or external confirmation before continuing execution
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when producing, editing, or reviewing Traditional Chinese technical writing, including comments, documentation, explanations, and Chinese answers that must avoid translationese, casual phrasing, template language, and weak logic.
Audit NixOS impermanence state — find files still on the current filesystem device. Use when the user wants to check for untracked files, audit impermanence, or runs /impermanence-audit.
去除文字中的 AI 生成痕跡。適用於編輯或審閱文字,使其聽起來更自然、更像人類書寫。 基於維基百科的「AI 寫作特徵」綜合指南。偵測並修復以下模式:誇大的象徵意義、 宣傳性語言、以 -ing 結尾的膚淺分析、模糊的歸因、破折號過度使用、三段式法則、 AI 詞彙、否定式排比、過多的連接性短語。
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.
| 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=...) |