LangChain 助手
- 作者仓库星标 0
- 作者仓库 skills-registry
LangGraph: editorial guidance
For API reference (signatures, imports, exhaustive method lists), use the mcpdoc MCP tools: fetch_docs("https://docs.langchain.com/oss/python/langgraph/..."). This skill is the opinions layer; the docs are the facts layer.
When to drop down to raw StateGraph
Most agents do NOT need this. Use create_agent(...) + middleware first (see the langchain-agents-middleware skill). Drop down to StateGraph only when:
- Multiple LLM calls in a single graph with custom routing between them.
- Branches that run in parallel and merge.
- Non-message state (custom dataclasses, dicts, dataframes flowing through nodes).
- Multi-graph workflows where one graph calls another as a subgraph.
If your problem fits "one model, some tools, in a loop" — even if the loop is complex — create_agent is the right tool. Don't reach for StateGraph out of habit.
Things the docs won't warn you about
- A node returning
{}is a no-op; returnNoneto signal "no state change" cleanly. add_conditional_edgesmappings must includeENDif any branch terminates — leaving it out is a silent bug, not an error.compile()is not idempotent acrossbind_tools— rebind tools, then re-compile.langgraph devreloads on file change; if it stops reloading, the graph likely failed to import — check the terminal for the exception.- A graph with
interrupt()calls but no checkpointer will throw at invoke time, not at compile time. Always pairinterrupt()withcompile(checkpointer=...).
Production essentials (rules of thumb)
- Always pass a
thread_idinconfig={"configurable": {"thread_id": ...}}for any agent with persistent state. A missingthread_idsilently starts a fresh thread. InMemorySaveris for dev only. Production =PostgresSaver(multi-instance safe) orSqliteSaver(single-node, low-volume). State dies with the process forInMemorySaver.- Resume an interrupted thread by passing
Noneas input with the samethread_id. The runtime picks up where the interrupt fired. - Custom state schemas need reducers.
Annotated[list, add_messages]appends; without the reducer, each node replaces the field instead of accumulating. - For node-level retries on raw
StateGraph, useRetryPolicy. Forcreate_agentagents, preferToolRetryMiddleware/ModelRetryMiddleware— same effect, cleaner composition.
Doc URLs to fetch with mcpdoc
https://docs.langchain.com/oss/python/langgraph/graph-api.md—StateGraph, nodes, edgeshttps://docs.langchain.com/oss/python/langgraph/durable-execution.md— checkpointers +thread_idhttps://docs.langchain.com/oss/python/langgraph/streaming.md—stream_modemodeshttps://docs.langchain.com/oss/python/langgraph/persistence.md— Postgres / Sqlite checkpointershttps://docs.langchain.com/oss/python/langgraph/subgraphs.md— multi-graph composition
When the user is mid-task and you need a method signature or import path, fetch from these URLs. Don't guess.
<!-- tomevault:4.0:skill_md:2026-05-23 -->Source: cwijayasundara/agent_cli_langchain — distributed by TomeVault.
- 流狐分类
- AI 智能
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @tomevault-io · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 需简单配置
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- macOS · Linux · Windows
- 底层运行要求
- Node.js · Python
- 检测到的文件与系统行为
-
- 只读
- Shell 执行
- 检测到的网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 Most agents do NOT need this. Use createagent(...) + middleware first (see the langchain-agents-middleware skill). Drop down to StateGraph only when: Multiple LLM calls in a single graph with custom routing between them.
A node returning {} is a no-op; return None to signal "no state change" cleanly. addconditionaledges mappings must include END if any branch terminates — leaving it out is a silent bug, not an error. compile() is not idempotent across bindtools — rebind tools,…
Always pass a threadid in config={"configurable": {"threadid": ...}} for any agent with persistent state. A missing threadid silently starts a fresh thread. InMemorySaver is for dev only. Production = PostgresSaver (multi-instance safe) or SqliteSaver…
https://docs.langchain.com/oss/python/langgraph/graph-api.md — StateGraph, nodes, edges https://docs.langchain.com/oss/python/langgraph/durable-execution.md — checkpointers + threadid https://docs.langchain.com/oss/python/langgraph/streaming.md — streammode…
# LangGraph: editorial guidance
For API reference (signatures, imports, exhaustive method lists), use the **`mcpdoc` MCP tools**: `fetch_docs("https://docs.langchain.com/oss/python/langgraph/...")`. This skill is the *opinions* layer; the docs are the *facts* layer.
## When to drop down to raw `StateGraph`
Most agents do NOT need this. Use `create_agent(...)` + middleware first (see the `langchain-agents-middleware` skill). Drop down to `StateGraph` only when:
- Multiple LLM calls in a single graph with custom routing between them.
- Branches that run in parallel and merge.
- Non-message state (custom dataclasses, dicts, dataframes flowing through nodes).
- Multi-graph workflows where one graph calls another as a subgraph.
If your problem fits "one model, some tools, in a loop" — even if the loop is complex — `create_agent` is the right tool. Don't reach for `StateGraph` out of habit.
## Things the docs won't warn you about
- A node returning `{}` is a no-op; return `None` to signal "no state change" cleanly.
- `add_conditional_edges` mappings must include `END` if any branch terminates — leaving it out is a silent bug, not an error.
- `compile()` is not idempotent across `bind_tools` — rebind tools, then re-compile.
- `langgraph dev` reloads on file change; if it stops reloading, the graph likely failed to import — check the terminal for the exception.
- A graph with `interrupt()` calls but no checkpointer will throw at *invoke time*, not at *compile time*. Always pair `interrupt()` with `compile(checkpointer=...)`.
## Production essentials (rules of thumb)
- **Always pass a `thread_id`** in `config={"configurable": {"thread_id": ...}}` for any agent with persistent state. A missing `thread_id` silently starts a fresh thread.
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> When to drop down to raw StateGraph → Things the docs won't warn you about → Production essentials (rules of thumb) → Doc URLs to fetch with mcpdoc
要点 -> mcpdoc MCP tools · Always pass a threadid · InMemorySaver is for dev only. · Resume an interrupted thread by passing None as input · Custom state schemas need reducers. · For node-level retries on raw StateGraph, use RetryPolicy.
文件/命令 -> mcpdoc · fetchdocs("https://docs.langchain.com/oss/python/langgraph/...") · StateGraph · createagent(...) · langchain-agents-middleware · createagent · None · addconditionaledges
内容 SHA-256 -> 37cd5df31a65
原文结构
适用与边界
原文中的明确线索
mcpdoc、fetchdocs("https://docs.langchain.com/oss/python/langgraph/...")、StateGraph、createagent(...)、langchain-agents-middleware、createagent、None、addconditionaledges