Agent skill · Backend & API

langgraph-graph-api

使用 StateGraph、节点、边、START/END 节点和 Command API 构建图,结合控制流与状态更新

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill langgraph-graph-api --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 10 KB
Bundled scripts: none
Path: skills/agent/langgraph-graph-api/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# langgraph-graph-api (JavaScript/TypeScript) --- name: langgraph-graph-api description: 使用 StateGraph、节点、边、START/END 节点和 Command API 构建图,结合控制流与状态更新 --- ## 概述 LangGraph Graph API 允许您将 Agent 工作流定义为由**节点**(函数)和**边**(控制流)组成的有向图。这提供了对 Agent 编排的细粒度控制。 **核心组件:** - **StateGraph**:构建有状态图的主要类 - **节点**:执行工作并更新状态的函数 - **边**:定义执行顺序(静态或条件) - **START/END**:标记图入口和出口点的特殊节点 - **Command**:结合状态更新与动态路由 ## 决策表:边类型 | 需求 | 边类型 | 何时使用 | |------|-----------|-------------| | 始终转到同一节点 | `addEdge()` | 固定、确定性流 | | 基于状态路由 | `addConditionalEdges()` | 动态分支逻辑 | | 扩散到多个节点 | `Send` API | Map-reduce、并行执行 | | 更新状态并路由 | `Command` | 在单个节点中组合逻辑 | ## 核心概念 ### 1. 图执行模型 LangGraph 使用受 Google Pregel 启发的**消息传递**模型: - 执行以**超级步**(离散迭代)进行 - 并行节点属于同一超级步 - 顺序节点属于不同的超级步 - 当所有节点不活跃且没有消息在传输时,图结束 ### 2. 节点 **节点**是异步函数,它们: - 接收当前状态作为输入 - 执行计算或副作用 - 返回状态更新(部分或全部) ```typescript const myNode = async (state: State): Promise<Partial<State>> => { // 节点只是异步函数! return { key: "updated_value" }; }; ``` ### 3. 边 | 边类型 | 描述 | 示例 | |-----------|-------------|---------| | **静态** | 始终路由到同一节点 | `addEdge("A", "B")` | | **条件** | 基于状态/逻辑路由 | `addConditionalEdges("A", router)` | | **动态 (Send)** | 扩散到多个节点 | `new Send("worker", {...})` | | **Command** | 状态更新

What's inside
Steps it walks through
  1. 概述
  2. 决策表:边类型
  3. 核心概念
  4. 1. 图执行模型
  5. 2. 节点
  6. 3. 边
  7. 4. 特殊节点
  8. 代码示例
  9. 带静态边的基本图
  10. 条件边(分支)
  11. 使用 Command 进行状态 + 路由
  12. 使用 Send API 的 Map-Reduce
  13. 带循环的图
  14. 带选项的编译
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the langgraph-graph-api skill do?

使用 StateGraph、节点、边、START/END 节点和 Command API 构建图,结合控制流与状态更新

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill langgraph-graph-api --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 majiayu000/claude-skill-registry, a repository with 534 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.

Keep going