Source profileQuality 95/100

yonatangross/orchestkit/src/skills/langgraph/SKILL.md

langgraph

LangGraph 1.x (LTS) Python workflow patterns for state management, delta channels, resilience (node timeouts, error handlers, graceful drain), routing, parallel execution, supervisor-worker, tool calling, checkpointing, human-in-loop, streaming (v2 format), subgraphs, and functional API. Use when building LangGraph pipelines, multi-agent systems, or AI workflows.

Source repository stars
224
Declared platforms
1
Static risk flags
0
Last source update
2026-08-28
Source checked
2026-08-28

Decision brief

What it does: where it fits

Comprehensive patterns for building production LangGraph workflows. LangGraph 1.x is LTS (Long Term Support) — the first stable major release, powering agents at Uber, LinkedIn, and Klarna. Each category has individual rule files in rules/ loaded on-demand.

Best for

  • Use when building LangGraph pipelines, multi-agent systems, or AI workflows.

Not for

  • Forgetting add reducer (overwrites instead of accumulates)
  • Mutating state in place (breaks checkpointing)

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeDeclaredSource recordInstall path and trigger
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/yonatangross/orchestkit --skill "src/skills/langgraph"
Safe inspection promptEditorial

Inspect the Agent Skill "langgraph" from https://github.com/yonatangross/orchestkit/blob/1ff988bd66daf223028ed44767b591fecc8510c2/src/skills/langgraph/SKILL.md at commit 1ff988bd66daf223028ed44767b591fecc8510c2. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Quick Start Example

    Review the “Quick Start Example” section in the pinned source before continuing.

    Review and apply the “Quick Start Example” source section.
  2. 02

    Quick Reference

    Total: 41 rules across 12 categories

    Total: 41 rules across 12 categories
  3. 03

    State Management

    State schemas determine how data flows between nodes. Wrong schemas cause silent data loss.

    State schemas determine how data flows between nodes. Wrong schemas cause silent data loss.
  4. 04

    Resilience

    Fault tolerance for nodes that talk to the outside world. New in 1.2 — before it, the only lever was retrypolicy, which cannot help a node that never fails because it never returns.

    Fault tolerance for nodes that talk to the outside world. New in 1.2 — before it, the only lever was retrypolicy, which cannot help a node that never fails because it never returns.
  5. 05

    Routing & Branching

    Control flow between nodes. Always include END fallback to prevent hangs.

    Control flow between nodes. Always include END fallback to prevent hangs.

Permission review

Static risk signals and limitations

No configured static risk pattern was detected

This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score95/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars224SourceRepository attention, not individual Skill quality
Compatibility1 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
yonatangross/orchestkit
Skill path
src/skills/langgraph/SKILL.md
Commit
1ff988bd66daf223028ed44767b591fecc8510c2
License
MIT
Collected
2026-08-28
Default branch
main
View the original SKILL.md

LangGraph Workflow Patterns

Comprehensive patterns for building production LangGraph workflows. LangGraph 1.x is LTS (Long Term Support) — the first stable major release, powering agents at Uber, LinkedIn, and Klarna. Each category has individual rule files in rules/ loaded on-demand.

LangGraph 1.2 (shipped 2026-05-12) — the fault-tolerance release. Everything below is on StateGraph.add_node(...) unless noted:

  • Per-node timeoutstimeout= accepts float | timedelta | TimeoutPolicy. TimeoutPolicy(run_timeout=, idle_timeout=, refresh_on="auto"|"heartbeat") separates a hard wall-clock cap from an idle cap that progress refreshes. On expiry LangGraph raises NodeTimeoutError (carrying kind="idle"|"run" and elapsed), drops that attempt's writes, and defers to the retry policy. Cooperative: it rides asyncio cancellation, so a node blocking the GIL is not interrupted. See rules/resilience-node-timeouts.md.
  • Node error handlerserror_handler= registers a recovery node that runs once the retry budget is exhausted. It receives failure context by declaring a parameter typed NodeError (fields node, error) and returns a Command to update state and reroute. See rules/resilience-error-handlers.md.
  • RunControl (langgraph.runtime) — cooperative graceful shutdown. request_drain(reason) from any thread; nodes poll runtime.drain_requested and stop at a checkpoint boundary, leaving a resumable thread instead of a half-applied superstep. See rules/resilience-graceful-drain.md.
  • DeltaChannel (langgraph.channels.delta, beta) — checkpoints store only incremental writes and replay them through a batch reducer, with a snapshot every snapshot_frequency updates. Fixes checkpoint cost growing with thread length. Its reducer takes a batch and must be batching-invariant. See rules/state-delta-channel.md.
  • runtime.heartbeat() — explicit progress signal, the only one that refreshes an idle timeout under refresh_on="heartbeat".

Landed earlier, in 1.1 — not 1.2 (they are current and supported; only their release attribution was wrong in prior versions of this skill): deferred nodes (defer=True), node-level caching (CachePolicy + graph.compile(cache=...)), and model middleware (before_model / after_model) on create_agent.

Quick Reference

CategoryRulesImpactWhen to Use
State Management5CRITICALDesigning workflow state schemas, accumulators, reducers, delta channels
Resilience3CRITICALNode timeouts, error handlers, graceful drain (1.2+)
Routing & Branching4HIGHDynamic routing, retry loops, semantic routing, cross-graph
Parallel Execution3HIGHFan-out/fan-in, map-reduce, concurrent agents
Supervisor Patterns3HIGHCentral coordinators, round-robin, priority dispatch
Tool Calling4CRITICALBinding tools, ToolNode, dynamic selection, approvals
Checkpointing3HIGHPersistence, recovery, cross-thread Store memory
Human-in-Loop3MEDIUMApproval gates, feedback loops, interrupt/resume
Streaming3MEDIUMReal-time updates, token streaming, custom events
Subgraphs3MEDIUMModular composition, nested graphs, state mapping
Functional API3MEDIUM@entrypoint/@task decorators, migration from StateGraph
Platform3HIGHDeployment, RemoteGraph, double-texting strategies

Total: 41 rules across 12 categories

State Management

State schemas determine how data flows between nodes. Wrong schemas cause silent data loss.

RuleFileKey Pattern
TypedDict Staterules/state-typeddict.mdTypedDict + Annotated[list, add] for accumulators
Pydantic Validationrules/state-pydantic.mdBaseModel at boundaries, TypedDict internally
MessagesStaterules/state-messages.mdMessagesState or add_messages reducer
Custom Reducersrules/state-reducers.mdAnnotated[T, reducer_fn] for merge/overwrite
Delta Channels (1.2, beta)rules/state-delta-channel.mdDeltaChannel(reducer, snapshot_frequency=) for large accumulators

Resilience

Fault tolerance for nodes that talk to the outside world. New in 1.2 — before it, the only lever was retry_policy, which cannot help a node that never fails because it never returns.

RuleFileKey Pattern
Node Timeoutsrules/resilience-node-timeouts.mdadd_node(..., timeout=TimeoutPolicy(run_timeout=, idle_timeout=))
Error Handlersrules/resilience-error-handlers.mdadd_node(..., error_handler=) + param typed NodeErrorCommand
Graceful Drainrules/resilience-graceful-drain.mdRunControl().request_drain() + runtime.drain_requested
from langgraph.types import RetryPolicy, TimeoutPolicy
from langgraph.errors import NodeError

builder.add_node(
    "call_vendor",
    call_vendor,
    timeout=TimeoutPolicy(run_timeout=300, idle_timeout=30),
    retry_policy=RetryPolicy(max_attempts=3),
    error_handler=lambda state, error: Command(
        update={"failure": f"{error.node}: {error.error}"}, goto="degraded_path"
    ),
)

Routing & Branching

Control flow between nodes. Always include END fallback to prevent hangs.

RuleFileKey Pattern
Conditional Edgesrules/routing-conditional.mdadd_conditional_edges with explicit mapping
Retry Loopsrules/routing-retry-loops.mdLoop-back edges with max retry counter
Semantic Routingrules/routing-semantic.mdEmbedding similarity or Command API routing
Cross-Graph Navigationrules/routing-cross-graph.mdCommand(graph=Command.PARENT) for parent/sibling routing

Parallel Execution

Run independent nodes concurrently. Use Annotated[list, add] to accumulate results.

RuleFileKey Pattern
Fan-Out/Fan-Inrules/parallel-fanout-fanin.mdSend API for dynamic parallel branches
Map-Reducerules/parallel-map-reduce.mdasyncio.gather + result aggregation
Error Isolationrules/parallel-error-isolation.mdreturn_exceptions=True + per-branch timeout

Supervisor Patterns

Central coordinator routes to specialized workers. Workers return to supervisor.

RuleFileKey Pattern
Basic Supervisorrules/supervisor-basic.mdCommand API for state update + routing
Priority Routingrules/supervisor-priority.mdPriority dict ordering agent execution
Round-Robinrules/supervisor-round-robin.mdCompletion tracking with agents_completed

Tool Calling

Integrate function calling into LangGraph agents. Keep tools under 10 per agent.

RuleFileKey Pattern
Tool Bindingrules/tools-bind.mdmodel.bind_tools(tools) + tool_choice
ToolNode Executionrules/tools-toolnode.mdToolNode(tools) prebuilt parallel executor
Dynamic Selectionrules/tools-dynamic.mdEmbedding-based tool relevance filtering
Tool Interruptsrules/tools-interrupts.mdinterrupt() for approval gates on tools

Checkpointing

Persist workflow state for recovery and debugging.

RuleFileKey Pattern
Checkpointer Setuprules/checkpoints-setup.mdMemorySaver dev / PostgresSaver prod
State Recoveryrules/checkpoints-recovery.mdthread_id resume + get_state_history
Cross-Thread Storerules/checkpoints-store.mdStore for long-term memory across threads

Node-Level Caching (1.2+)

Independent of checkpointing. Cache individual node output so re-runs with identical inputs skip execution entirely.

from langgraph.graph import StateGraph
from langgraph.types import CachePolicy
from langgraph.cache.sqlite import SqliteCache

graph = StateGraph(State)
graph.add_node(
    "expensive_fetch",
    fetch_fn,
    cache_policy=CachePolicy(ttl=3600, key_func=lambda s: s["query"]),
)
# RedisCache(url=...) for distributed workers
compiled = graph.compile(cache=SqliteCache("cache.db"))

Use when a node is idempotent and expensive (embeddings, external APIs). Do not use for nodes whose output depends on wall-clock time or mutable external state unless key_func captures that variance.

Deferred Nodes & Model Middleware (1.2+)

# defer=True — node execution is deferred until the run is about to end,
# i.e. after every other upstream node has completed
graph.add_node("aggregate", aggregate_fn, defer=True)

# Model middleware — no subclassing required.
# create_react_agent is @deprecated since v1.0; use create_agent from langchain.agents.
# The legacy pre_model_hook/post_model_hook are now before_model/after_model middleware.
from langchain.agents import create_agent

agent = create_agent(
    model=model,
    tools=tools,
    middleware=[compress_history, redact_pii],  # before_model / after_model hooks
    system_prompt="...",                          # prompt= renamed to system_prompt
)

Human-in-Loop

Pause workflows for human intervention. Requires checkpointer for state persistence.

RuleFileKey Pattern
Interrupt/Resumerules/human-in-loop-interrupt.mdinterrupt() function + Command(resume=)
Approval Gaterules/human-in-loop-approval.mdinterrupt_before + state update + resume
Feedback Looprules/human-in-loop-feedback.mdIterative interrupt until approved

Streaming

Real-time updates and progress tracking for workflows. LangGraph 1.2 supports version="v2" (introduced in 1.1), an opt-in streaming format with full type safety on stream(), astream(), invoke(), and ainvoke().

RuleFileKey Pattern
Stream Modesrules/streaming-modes.md5 modes: values, updates, messages, custom, debug
Token Streamingrules/streaming-tokens.mdmessages mode with node/tag filtering
Custom Eventsrules/streaming-custom-events.mdget_stream_writer() for progress events
Streaming v2rules/streaming-v2-format.mdversion="v2" for typed streaming (LG 1.1+)

Subgraphs

Compose modular, reusable workflow components with nested graphs.

RuleFileKey Pattern
Invoke from Noderules/subgraphs-invoke.mdDifferent schemas, explicit state mapping
Add as Noderules/subgraphs-add-as-node.mdShared state, add_node(name, compiled_graph)
State Mappingrules/subgraphs-state-mapping.mdBoundary transforms between parent/child

Functional API

Build workflows using @entrypoint and @task decorators instead of explicit graph construction.

RuleFileKey Pattern
@entrypointrules/functional-entrypoint.mdWorkflow entry point with optional checkpointer
@taskrules/functional-task.mdReturns futures, .result() to block
Migrationrules/functional-migration.mdStateGraph to Functional API conversion

Platform

Deploy graphs as managed APIs with persistence, streaming, and multi-tenancy.

RuleFileKey Pattern
Deploymentrules/platform-deployment.mdlanggraph.json + CLI + Assistants API
RemoteGraphrules/platform-remote-graph.mdRemoteGraph for calling deployed graphs
Double Textingrules/platform-double-texting.md4 strategies: reject, rollback, enqueue, interrupt

Quick Start Example

from langgraph.graph import StateGraph, START, END
from langgraph.types import Command
from typing import TypedDict, Annotated, Literal
from operator import add

class State(TypedDict):
    input: str
    results: Annotated[list[str], add]

def supervisor(state) -> Command[Literal["worker", END]]:
    if not state.get("results"):
        return Command(update={"input": state["input"]}, goto="worker")
    return Command(goto=END)

def worker(state) -> dict:
    return {"results": [f"Processed: {state['input']}"]}

graph = StateGraph(State)
graph.add_node("supervisor", supervisor)
graph.add_node("worker", worker)
graph.add_edge(START, "supervisor")
graph.add_edge("worker", "supervisor")
app = graph.compile()

2026 Key Patterns

  • Streaming v2 (LG 1.1): Use version="v2" for type-safe streaming — fully typed stream() and astream() returns. Default remains "v1" for backwards compat.
  • Command API: Use Command(update=..., goto=...) when updating state AND routing together
  • context_schema: Pass runtime config (temperature, provider) without polluting state
  • CachePolicy: Cache expensive node results with TTL via SqliteCache (prod) or InMemoryCache from langgraph.cache.memory (dev)
  • RemainingSteps: Proactively handle recursion limits
  • Store: Cross-thread memory separate from Checkpointer (thread-scoped)
  • interrupt(): Dynamic interrupts inside node logic (replaces interrupt_before for conditional cases)
  • add_edge(START, node): Not set_entry_point() (deprecated)
  • LTS release: LangGraph 1.x is LTS — will remain ACTIVE until v2.0

Key Decisions

DecisionRecommendation
State typeTypedDict internally, Pydantic at boundaries
Entry pointadd_edge(START, node) not set_entry_point()
Routing + state updateCommand API
Routing onlyConditional edges
AccumulatorsAnnotated[list[T], add] always
Dev checkpointerMemorySaver
Prod checkpointerPostgresSaver
Short-term memoryCheckpointer (thread-scoped)
Long-term memoryStore (cross-thread, namespaced)
Max parallel branches5-10 concurrent
Tools per agent5-10 max (dynamic selection for more)
Approval gatesinterrupt() for high-risk operations
Stream modes["updates", "custom"] for most UIs
Subgraph patternInvoke for isolation, Add-as-Node for shared state
Functional vs GraphFunctional for simple flows, Graph for complex topology

Common Mistakes

  1. Forgetting add reducer (overwrites instead of accumulates)
  2. Mutating state in place (breaks checkpointing)
  3. No END fallback in routing (workflow hangs)
  4. Infinite retry loops (no max counter)
  5. Side effects in router functions
  6. Too many tools per agent (context overflow)
  7. Raising exceptions in tools (crashes agent loop)
  8. No checkpointer in production (lose progress on crash)
  9. Wrapping interrupt() in try/except (breaks the mechanism)
  10. Not transforming state at subgraph boundaries
  11. Forgetting .result() on Functional API tasks
  12. Using set_entry_point() (deprecated, use add_edge(START, ...))

Evaluations

See test-cases.json for consolidated test cases across all categories.

Related Skills

  • ork:agent-orchestration - Higher-level multi-agent coordination, ReAct loop patterns, and framework comparisons
  • temporal-io - Durable execution alternative
  • ork:llm-integration - General LLM function calling
  • type-safety-validation - Pydantic model patterns

Frequently asked questions

What to verify before installation and use

What does the langgraph source document cover?

Comprehensive patterns for building production LangGraph workflows. LangGraph 1.x is LTS (Long Term Support) — the first stable major release, powering agents at Uber, LinkedIn, and Klarna. Each category has individual rule files in rules/ loaded on-demand.

How do I install langgraph?

The source record exposes this install command: npx skills add https://github.com/yonatangross/orchestkit --skill "src/skills/langgraph". Inspect the command and pinned source before running it.

Which Agent platforms does the source record declare?

The pinned source record declares support for: claude code.

Alternatives

Compare before choosing