skills/langgraph/SKILL.md
LangGraph (Python) — build stateful, controllable agent graphs with checkpointing, streaming, persistence, interrupts, fault tolerance, and durable execution. Covers both Graph API (StateGraph) and Functional API (@entrypoint/@task).
npx skillsauth add enuno/claude-command-and-control langgraphInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert assistance for building LangGraph agents in Python: stateful graphs, checkpointing, human-in-the-loop interrupts, streaming, fault tolerance, and deployment.
Two APIs to choose from:
StateGraph, nodes, edges: explicit DAG control flow@entrypoint, @task: imperative Python-style workflowsReference corpus: 30 LangGraph pages in references/llms-txt.md (5.4 MB) and references/llms.md (104 KB). For full content with code, use ../langchain-deepagents/references/llms-full.md.
Activate when:
@entrypoint / @task for imperative agent logicInMemorySaver or PostgresSaver checkpointersinterrupt() to pause and resume executionlanggraph.json configfrom typing import TypedDict
from langgraph.graph import START, StateGraph
from langgraph.checkpoint.memory import InMemorySaver
class State(TypedDict):
foo: str
def my_node(state: State) -> State:
return {"foo": state["foo"].upper()}
# Build graph
graph = StateGraph(State)
graph.add_node("my_node", my_node)
graph.add_edge(START, "my_node")
# Compile with checkpointer for persistence
checkpointer = InMemorySaver()
app = graph.compile(checkpointer=checkpointer)
# Invoke with thread_id for stateful conversations
result = app.invoke({"foo": "hello"}, config={"configurable": {"thread_id": "1"}})
from typing import TypedDict
from langgraph.graph import StateGraph
class InputState(TypedDict):
user_input: str
class OutputState(TypedDict):
graph_output: str
class OverallState(TypedDict):
foo: str
user_input: str
graph_output: str
# Graph sees OverallState internally; caller sees InputState/OutputState
graph = StateGraph(OverallState, input=InputState, output=OutputState)
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.func import entrypoint, task
from langgraph.types import RetryPolicy
@task(retry=RetryPolicy(max_attempts=3))
def fetch_data(query: str) -> str:
return call_api(query)
@entrypoint(checkpointer=InMemorySaver())
def my_workflow(inputs: dict) -> dict:
data = fetch_data(inputs["query"]).result()
return {"output": process(data)}
from langgraph.types import interrupt
def review_node(state: State) -> State:
# Pauses here and returns control to caller
human_decision = interrupt({"question": "Approve this action?", "data": state["action"]})
if human_decision == "approve":
return {"approved": True}
return {"approved": False}
# Resume by invoking with Command
from langgraph.types import Command
app.invoke(Command(resume="approve"), config={"configurable": {"thread_id": "1"}})
# Stream state values after each node
for chunk in app.stream({"foo": "hello"}, config={"configurable": {"thread_id": "1"}},
stream_mode="values"):
print(chunk)
# Stream only updates (deltas)
for chunk in app.stream(inputs, config=config, stream_mode="updates"):
print(chunk)
# Stream LLM tokens (messages mode)
for chunk in app.stream(inputs, config=config, stream_mode="messages"):
print(chunk)
from langgraph.graph import StateGraph
from langgraph.types import RetryPolicy
graph = StateGraph(State)
graph.add_node(
"flaky_node",
my_node,
retry=RetryPolicy(max_attempts=3, backoff_factor=2.0),
)
# Get thread history
history = list(app.get_state_history(config={"configurable": {"thread_id": "1"}}))
# Pick a prior checkpoint and replay from it
past_checkpoint = history[2].config
result = app.invoke(None, config=past_checkpoint)
# Update state at a checkpoint before replaying
app.update_state(config=past_checkpoint, values={"foo": "corrected"})
| Concept | Graph API | Functional API |
|---------|-----------|----------------|
| Entry point | graph.add_edge(START, node) | @entrypoint decorator |
| Unit of work | Node function | @task function |
| State | TypedDict class | Input dict |
| Persistence | compile(checkpointer=...) | @entrypoint(checkpointer=...) |
| Streaming | app.stream(stream_mode=...) | Same |
| Interrupts | interrupt() inside node | interrupt() inside task |
| File | Location | Contents |
|------|----------|----------|
| references/llms-txt.md | This skill | 5.4 MB — full site corpus summaries |
| references/llms.md | This skill | 104 KB — all doc URLs with descriptions |
| llms-full.md | ../langchain-deepagents/references/ | 10 MB — complete content + all code |
Key pages at docs.langchain.com/oss/python/langgraph/:
| Topic | Path |
|-------|------|
| Overview | /overview |
| Graph API | /graph-api and /use-graph-api |
| Functional API | /functional-api and /use-functional-api |
| Quickstart | /quickstart |
| Persistence | /persistence |
| Memory | /add-memory |
| Interrupts / HITL | /interrupts |
| Streaming | /streaming |
| Fault tolerance | /fault-tolerance |
| Durable execution | /durable-execution |
| Time travel | via /persistence (checkpoint replay) |
| Choosing APIs | /choosing-apis |
| Deployment | /deploy |
| Local server | /local-server |
| Observability | /observability |
| Testing | /test |
| Backward compat | /backward-compatibility |
| Agentic RAG | /agentic-rag |
| SQL agent | /sql-agent |
skill-seekers scrape --url "https://docs.langchain.com/oss/python/langgraph/overview" --name langgraph
tools
MemPalace local-first AI memory system. Use when setting up persistent memory for Claude Code sessions, mining project files or conversation transcripts, querying past context, configuring MCP tools, managing the knowledge graph, or troubleshooting palace operations.
tools
LangSmith Python SDK — trace, evaluate, and monitor LLM applications. Covers @traceable decorator, trace context manager, Client API, evaluate() / aevaluate(), comparative evaluation, custom evaluators, dataset management, prompt caching, ASGI middleware, and pytest plugin.
development
LangGraph Graph API (Python) — build explicit DAG agent workflows with StateGraph, typed state, nodes, edges, Command routing, Send fan-out, checkpointers, interrupts, and streaming. Use when you need explicit control flow and graph topology.
development
LangGraph Functional API (Python) — build stateful agent workflows with @entrypoint and @task decorators. Imperative Python style with LangGraph persistence, streaming, HITL, and durable execution. Ideal for wrapping existing agents (CrewAI, AutoGen, Strands) or complex parallel task logic.