langgraph 是什么?
Expert in LangGraph - the production-grade framework for building stateful, multi-actor AI applications. Covers graph construction, state management, cycles and branches, persistence with checkpointers, human-in-the-loop patterns, and the ReAct agent pattern. Used in production at LinkedIn, Uber, and 400+ companies. This is LangChain's recommended approach for building agents. Use when: langgraph, langchain agent, stateful agent, agent graph, react agent.
以上为来源原文,中文用途说明尚待整理。
同名项目,请核对仓库和目录
怎么接入你的 Agent?
- 定位完整 Skill 目录
打开本项目来源,核对
SKILL.md及其引用的脚本和资料。 - 交给你正在用的 Agent
在下面选择客户端,展开并复制安装指令,让 Agent 读取来源后选择安装方式。
- 确认识别,再做具体任务
让 Agent 回报安装目录和识别到的名称
langgraph,然后告诉 Agent 你的任务和实际输入,让它先核对触发条件。
展开并复制给 Codex 的安装指令
安装并检查 langgraph
请在 Codex 的当前工作环境中安装并检查 langgraph 这个 Skill。
项目身份:davila7/claude-code-templates / langgraph
来源:https://github.com/davila7/claude-code-templates/blob/c1bc5c1df4ff0bffb9a04d8f7790543681232423/cli-tool/components/skills/ai-research/langgraph/SKILL.md
已定位的源文件:cli-tool/components/skills/ai-research/langgraph/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 Claude Code 的安装指令
安装并检查 langgraph
请在 Claude Code 的当前工作环境中安装并检查 langgraph 这个 Skill。
项目身份:davila7/claude-code-templates / langgraph
来源:https://github.com/davila7/claude-code-templates/blob/c1bc5c1df4ff0bffb9a04d8f7790543681232423/cli-tool/components/skills/ai-research/langgraph/SKILL.md
已定位的源文件:cli-tool/components/skills/ai-research/langgraph/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 Cursor 的安装指令
安装并检查 langgraph
请在 Cursor Agent 的当前工作环境中安装并检查 langgraph 这个 Skill。
项目身份:davila7/claude-code-templates / langgraph
来源:https://github.com/davila7/claude-code-templates/blob/c1bc5c1df4ff0bffb9a04d8f7790543681232423/cli-tool/components/skills/ai-research/langgraph/SKILL.md
已定位的源文件:cli-tool/components/skills/ai-research/langgraph/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。展开并复制给 当前 Agent 的安装指令
安装并检查 langgraph
请在 当前 Agent 的当前工作环境中安装并检查 langgraph 这个 Skill。
项目身份:davila7/claude-code-templates / langgraph
来源:https://github.com/davila7/claude-code-templates/blob/c1bc5c1df4ff0bffb9a04d8f7790543681232423/cli-tool/components/skills/ai-research/langgraph/SKILL.md
已定位的源文件:cli-tool/components/skills/ai-research/langgraph/SKILL.md
1. 先阅读真实 SKILL.md 和它引用的必要文件,确认触发条件、安装方式、依赖与权限;尊重源文件要求的审批步骤。
2. 按当前客户端支持的方式安装完整 Skill 目录,保留已有配置,不只复制一段提示词。涉及缺失凭证、目标目录或权限时先列出缺项并向我确认。
3. 安装后回读实际目录、Skill 名称和识别结果,说明哪些步骤已完成,哪些只是文档检查,不得把安装成功当作任务已经实测。
4. 如来源提供了可安全验证的示例,在我提供所需输入后做一个最小任务;创建、修改、删除、部署或发送内容前,按源文件和我的授权执行。来源原文与资料状态
- 源文件
- 已保存 SKILL.md,抓取于 2026-11-23T04:29:48.865Z
- 中文使用说明
- 尚待整理,保留英文来源内容
- 安装与任务测试
- 本站未执行安装或任务测试
- 来源复核
- 已保留来源记录;当前完整用法未逐项人工复核
展开 SKILL.md 原文、章节与历史收录资料
cli-tool/components/skills/ai-research/langgraph/SKILL.md · 抓取时间 2026-11-23T04:29:48.865Z
以下保留源文件的 description、章节及摘录,供核对中文说明;完整文件通过上方链接打开。
抓取成功不代表已完成安装或任务测试。
Expert in LangGraph - the production-grade framework for building stateful, multi-actor AI applications. Covers graph construction, state management, cycles and branches, persistence with checkpointers, human-in-the-loop patterns, and the ReAct agent pattern. Used in production at LinkedIn, Uber, and 400+ companies. This is LangChain's recommended approach for building agents. Use when: langgraph, langchain agent, stateful agent, agent graph, react agent.
查看源文件章节 / Source sections
- 原文:LangGraph
- 原文:Capabilities
- 原文:Requirements
- 原文:Patterns
- 原文:Basic Agent Graph
- 原文:State with Reducers
- 原文:Conditional Branching
- 原文:Anti-Patterns
- 原文:❌ Infinite Loop Without Exit
- 原文:❌ Stateless Nodes
- 原文:❌ Giant Monolithic State
- 原文:Limitations
- 原文:Related Skills
原文:LangGraph
**Role**: LangGraph Agent Architect You are an expert in building production-grade AI agents with LangGraph. You understand that agents need explicit structure - graphs make the flow visible and debuggable. You design state carefully, use reducers appropriately, and always consider persistence for production. You know when cycles are needed and how to prevent infinite loops.
原文:Capabilities
- Graph construction (StateGraph) - State management and reducers - Node and edge definitions - Conditional routing - Checkpointers and persistence - Human-in-the-loop patterns - Tool integration - Streaming and async execution
原文:Requirements
- Python 3.9+ - langgraph package - LLM API access (OpenAI, Anthropic, etc.) - Understanding of graph concepts
原文:Basic Agent Graph
Simple ReAct-style agent with tools **When to use**: Single agent with tool calling ```python from typing import Annotated, TypedDict from langgraph.graph import StateGraph, START, END from langgraph.graph.message import add_messages from langgraph.prebuilt import ToolNode from langchain_openai import ChatOpenAI from langchain_core.tools import tool # 1. Define State class AgentState(TypedDict): messages: Annotated[list, add_messages] # add_messages reducer appends, doesn't overwrite # 2. Define Tools @tool def search(query: str) -> str: """Search the web for information.""" # Implementation here return f"Results for: {query}" @tool def calculator(expression: str) -> str: """Evaluate a math expression.""" return str(eval(expression)) tools = [search, calculator] # 3. Create LLM with tools llm = ChatOpenAI(model="gpt-4o").bind_tools(tools) # 4. Define Nodes def agent(state: AgentState) -> dict: """The agent node - calls LLM.""" response = llm.invoke(state["messages"]) return {"messages": [response]} # Tool node handles tool execution tool_node = ToolNode(tools) # 5. Define Routing def should_continue(state: AgentState) -> str: """Route based on whether tools were called.""" last_message = state["messages"][-1] if last_message.tool_calls: return "tools" return END # 6. Build Graph graph = StateGraph(AgentState) # Add nodes graph.add_node("agent", agent) graph.add_node("tools", tool_node) # Add edges graph.add_edge(START, "agent") graph.add_conditional_edges("agent", should_continue, ["tools", END]) graph.add_edge("tools", "agent") # Loop back # Compile app = graph.compile() # 7. Run result = app.invoke({ "messages": [("user", "What is 25 * 4?")] }) ```
原文:State with Reducers
Complex state management with custom reducers **When to use**: Multiple agents updating shared state ```python from typing import Annotated, TypedDict from operator import add from langgraph.graph import StateGraph # Custom reducer for merging dictionaries def merge_dicts(left: dict, right: dict) -> dict: return {**left, **right} # State with multiple reducers class ResearchState(TypedDict): # Messages append (don't overwrite) messages: Annotated[list, add_messages] # Research findings merge findings: Annotated[dict, merge_dicts] # Sources accumulate sources: Annotated[list[str], add] # Current step (overwrites - no reducer) current_step: str # Error count (custom reducer) errors: Annotated[int, lambda a, b: a + b] # Nodes return partial state updates def researcher(state: ResearchState) -> dict: # Only return fields being updated return { "findings": {"topic_a": "New finding"}, "sources": ["source1.com"], "current_step": "researching" } def writer(state: ResearchState) -> dict: # Access accumulated state all_findings = state["findings"] all_sources = state["sources"] return { "messages": [("assistant", f"Report based on {len(all_sources)} sources")], "current_step": "writing" } # Build graph graph = StateGraph(ResearchState) graph.add_node("researcher", researcher) graph.add_node("writer", writer) # ... add edges ```
原文:Conditional Branching
Route to different paths based on state **When to use**: Multiple possible workflows ```python from langgraph.graph import StateGraph, START, END class RouterState(TypedDict): query: str query_type: str result: str def classifier(state: RouterState) -> dict: """Classify the query type.""" query = state["query"].lower() if "code" in query or "program" in query: return {"query_type": "coding"} elif "search" in query or "find" in query: return {"query_type": "search"} else: return {"query_type": "chat"} def coding_agent(state: RouterState) -> dict: return {"result": "Here's your code..."} def search_agent(state: RouterState) -> dict: return {"result": "Search results..."} def chat_agent(state: RouterState) -> dict: return {"result": "Let me help..."} # Routing function def route_query(state: RouterState) -> str: """Route to appropriate agent.""" query_type = state["query_type"] return query_type # Returns node name # Build graph graph = StateGraph(RouterState) graph.add_node("classifier", classifier) graph.add_node("coding", coding_agent) graph.add_node("search", search_agent) graph.add_node("chat", chat_agent) graph.add_edge(START, "classifier") # Conditional edges from classifier graph.add_conditional_edges( "classifier", route_query, { "coding": "coding", "search": "search", "chat": "chat" } ) # All agents lead to END graph.add_edge("coding", END) graph.add_edge("search", END) graph.add_edge("chat", END) app = graph.compile() ```
文件 SHA256:765267052885247ec617f60a5f9ae4109c5e236059455952c1295eb55e69c352
仓库许可证记录:MIT;repository-license-recorded-scope-unverified,查看来源。
Expert in LangGraph - the production-grade framework for building stateful, multi-actor AI applications. Covers graph construction, state management, cycles and branches, persistence with checkpointers, human-in-the-loop patterns, and the ReAct agent pattern. Used in production at LinkedIn, Uber, and 400+ companies. This is LangChain's recommended approach for building agents. Use when: langgraph, langchain agent, stateful agent, agent graph, react agent.
历史收录数据
| 来源仓库 | davila7/claude-code-templates |
|---|---|
| Skill源路径 | cli-tool/components/skills/ai-research/langgraph/SKILL.md |
安装前请让使用的Agent先读取这个SKILL.md及其所在目录,确认依赖和所需权限。此页不生成未经来源验证的安装命令。
