agentsop-langgraph
Decision protocol for building, debugging, and operating LangGraph-based agent systems. Activates when a coder agent is asked to design a stateful LLM workflow, add human-in-the-loop, choose a multi-agent pattern (supervisor / swarm / hierarchical), pick a checkpoint backend, or migrate a fragile chain into a durable graph. LangGraph is positioned by its maintainers as a "low-level orchestration framework for building, managing, and deploying long-running, stateful agents" — this skill encodes the *when* and *why*, not the API.
npx skills add agentsope/SkillAlchemy --skill agentsop-langgraph --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Activates a coder agent to decide when to apply LangGraph, a stateful orchestration framework, and to guide how to design, debug, and run LangGraph-based agent workflows. It focuses on when to use graph-based approaches, human-in-the-loop, multi-agent patterns, checkpoint backends, and migrating existing chains to a durable graph.
How it works
Follows a stepwise protocol:
- Step 1: Decide whether a graph is warranted using criteria like presence of cycles, crash survivability needs, human inspection, or multiple specialized agents.
- Step 2: Pick the API surface from options such as create_react_agent for standard tool-calling, @entrypoint/@task for imperative style, StateGraph for multi-agent topology, or MessageGraph for chat-only history.
- Step 3: Design the state schema before writing nodes, using TypedDict or Pydantic, with reducers for parallel writes, and ensuring serializable, pure-function node updates.
- Step 4: Choose multi-agent topology (Supervisor, Swarm, or Hierarchical) based on whether there is a user-facing persona and cross-agent coordination, with benchmarks referenced.
- Step 5: Add human-in-the-loop only on irreversible actions using interrupt(value) and resume via Command(resume=...).
- Step 6: Pick a checkpointer backend (InMemorySaver, SqliteSaver, PostgresSaver, RedisSaver) and run migrations via CI/CD rather than in-app runtime.
- Step 7: Add observability and bounded loops (LangSmith, recursion_limit adjustments) to ensure traceability and termination guarantees.
OPs (specific actions) describe concrete code patterns, such as:
- Bootstrap a ReAct agent in <10 lines by calling from langgraph.prebuilt import create_react_agent and passing model/tools.
- Promote to a manual StateGraph by re-implementing with StateGraph(MyTypedDict) and wiring nodes and edges.
- Add a reducer via Annotated[list[X], operator.add] or add_messages for parallel writes.
- Spawn dynamic workers with Send(...) in a conditional edge and reduce results with operator.add.
- Insert an interrupt gate for irreversible actions and resume with graph.invoke(Command(resume=...)).
- Encapsulate a subgraph as a child, wiring parent.add_node and handling schema differences.
- Switch checkpointer to PostgresSaver for production and run saver.setup() in a migration job.
- Stream tokens and state via graph.stream with modes including messages and updates.
- Bound a loop by counting retries in state and raising recursion_limit only as diagnostic.
When to use it
Activate when LangGraph, StateGraph, MessageGraph, or related activation keywords are involved, or when the user needs a stateful workflow, human-in-the-loop, a multi-agent pattern, a checkpoint backend, or migration to a durable graph. Do not activate for a single LLM call or stateless pipelines.
What it can touch
Actions reference exact tool names and code points, including:
- create_react_agent
- StateGraph(MyTypedDict)
- Annotated[list[X], operator.add]
- add_messages
- Send
- interrupt
- Command(resume=...)
- PostgresSaver / AsyncPostgresSaver
- graph.stream
- Endpoints like graph.invoke
Caveats
Mentions licenses and backends (MIT in top), and cautions that over-graphing simple flows is an anti-pattern. It emphasizes durability, explicit control flow, and observability, with potential verbosity in configuration and state schemas. No outcomes are promised beyond following the protocol steps and concrete OPs.
# LangGraph · SOP > Source posture: every non-trivial claim is cited inline. Citations use short > tags like `[lc-docs]`, `[lc-blog/interrupt]`, `[gh/6731]`, `[zenml/uber]` — > resolve them against `references/*.md` for the full URL. --- ## 何时激活 (Activation Rules) Activate this skill when **any** of the following triggers fire: - The task mentions LangGraph, `StateGraph`, `MessageGraph`, `create_react_agent`, `interrupt(`, `Command(resume=`, `add_messages`, `checkpointer`, `PostgresSaver`, `Send(`, or `entrypoint` / `task` decorators. - The user wants to build a **stateful** agent (memory across turns, long-running, must survive a process crash) — LangGraph's stated sweet spot `[lc-docs/why-langgraph]`. - The user wants **human-in-the-loop** (approve a tool call, edit state, multi-turn validation) — LangGraph offers a first-class `interrupt()` primitive that competitors require "duct-taping" to achieve `[bswen/hitl]`. - The user is hitting **`GRAPH_RECURSION_LIMIT`** errors, infinite loops, or `InvalidUpdateError` on parallel branches — these are LangGraph-specific failure modes with known fixes `[lc-docs/errors]` `[cheatsheet/gotchas]`. - The user is choosing between LangGraph and
- 何时激活 (Activation Rules)
- 核心心智模型 (Core Mental Model)
- SOP 工作流 (Agentic Protocol)
- Step 1 · Decide whether a graph is actually warranted
- Step 2 · Pick the API surface
- Step 3 · Design the state schema before writing nodes
- Step 4 · Choose the multi-agent topology
- Step 5 · Add human-in-the-loop only on irreversible actions
- Step 6 · Pick the checkpointer to match the durability requirement
- Step 7 · Add observability + bounded loops before shipping
- 操作模型 (Operation Models)
- OP-1 · Bootstrap a ReAct agent in <10 lines
- OP-2 · Promote a prebuilt agent to a custom StateGraph
- OP-3 · Add a reducer to fix InvalidUpdateError
What does the agentsop-langgraph skill do?
Decision protocol for building, debugging, and operating LangGraph-based agent systems. Activates when a coder agent is asked to design a stateful LLM workflow, add human-in-the-loop, choose a multi-agent pattern (supervisor / swarm / hierarchical), pick a checkpoint backend, or migrate a fragile chain into a durable graph. LangGraph is positioned by its maintainers as a "low-level orchestration framework for building, managing, and deploying long-running, stateful agents" — this skill encodes the *when* and *why*, not the API.
How do I install it?
Run `npx skills add agentsope/SkillAlchemy --skill agentsop-langgraph --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From agentsope/SkillAlchemy, a repository with 255 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
