langgraph
Build, run, persist, deploy, and operate LangGraph Python applications using the core runtime, prebuilt agents, checkpointing, CLI, and SDK clients.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- langgraph
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Build, run, persist, deploy, and operate LangGraph Python applications using the core runtime, prebuilt agents, checkpointing, CLI, and SDK clients.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/package-map.md2.7 KB
- 参考文档references/repo-provenance.md2.3 KB
- 参考文档references/repo-routing-metadata.json506 B
- 参考文档references/troubleshooting.md3.1 KB
- 脚本scripts/run_core_smokes.py3.2 KB
03 SKILL.md 正文
LangGraph
Use this skill when a task involves LangGraph, the low-level orchestration framework for building stateful agents and long-running workflows. It covers the Python monorepo packages langgraph, langgraph-prebuilt, langgraph-checkpoint, langgraph-checkpoint-sqlite, langgraph-checkpoint-postgres, langgraph-cli, and langgraph-sdk.
Quick Start
Install the core package for most application work:
pip install -U langgraph
For focused packages or deployment tooling:
pip install -U langgraph-cli
pip install -U langgraph-sdk
pip install -U langgraph-checkpoint-sqlite
pip install -U langgraph-checkpoint-postgres "psycopg[binary]"
Minimal import and graph smoke check:
from typing_extensions import TypedDict
from langgraph.graph import END, START, StateGraph
class State(TypedDict):
value: int
def inc(state: State) -> State:
return {"value": state["value"] + 1}
builder = StateGraph(State)
builder.add_node("inc", inc)
builder.add_edge(START, "inc")
builder.add_edge("inc", END)
app = builder.compile()
assert app.invoke({"value": 1})["value"] == 2
Route by Task
- Custom graphs and runtime behavior: Use
sub-skills/graph-runtime/SKILL.mdforStateGraph, reducers, node signatures, conditional edges,Command,Send, interrupts, streaming, subgraphs, low-levelPregel, and runtime debugging. - Prebuilt agents and tools: Use
sub-skills/prebuilt-agents/SKILL.mdforcreate_react_agent,ToolNode,ValidationNode, injected state/store/runtime, tool-call errors, structured responses, and human interrupt payloads. - Persistence and memory: Use
sub-skills/persistence/SKILL.mdfor checkpointers,thread_id, checkpoint resume, SQLite, Postgres, in-memory savers,InMemoryStore, semantic search, and serde hardening. - CLI and deployment: Use
sub-skills/cli-deployment/SKILL.mdforlanggraph new,dev,up,build,dockerfile,validate,langgraph.json, Docker/server configuration, and local deployment troubleshooting. - SDK clients and streaming: Use
sub-skills/sdk-clients/SKILL.mdfor Python async/sync SDK clients, assistants, threads, runs, cron, store APIs, v3 thread-centric streaming, auth headers, and JS SDK relocation status.
Shared References and Scripts
- Read
references/repo-provenance.mdwhen deciding whether this skill matches a checkout or should be refreshed. - Read
references/package-map.mdto map user requests to the monorepo packages, install commands, import modules, and common optional dependencies. - Read
references/troubleshooting.mdfor cross-cutting install, import, config, service, security, and version-mismatch failures before drilling into a sub-skill’s troubleshooting file. - Run
scripts/run_core_smokes.py --helpor selected smoke checks when validating a LangGraph environment without relying on the original repository checkout.
Common Decisions
- Choose
StateGraphwhen a task needs custom state schemas, deterministic routing, reducers, subgraphs, or precise interrupt/resume control. - Choose prebuilt agent APIs when the task is primarily a tool-calling chat agent and does not need a fully custom graph loop.
- Use an in-memory checkpointer only for tests, local demos, or debugging; use SQLite for lightweight local persistence and Postgres for durable multi-process or production persistence.
- Use
langgraph devfor local hot-reload development,langgraph upfor a local Docker API server,langgraph buildfor an image, andlanggraph dockerfilewhen a user needs to review or customize the generated container recipe. - Use the SDK only when there is a running LangGraph API server or deployment; local graph construction/invocation does not require
langgraph-sdk.
Verification Checklist
- Confirm package imports with the relevant sub-skill smoke script.
- Compile a minimal graph before adding persistence, tools, or deployment configuration.
- If persistence is involved, invoke with
config={"configurable": {"thread_id": "..."}}and verify resume/list behavior. - If serving with the CLI, validate
langgraph.jsonbefore runningdev,up, orbuild. - If using the SDK, verify URL/auth selection and streaming mode against the server being targeted.
Safety and Scope
This skill is self-contained. Do not require the original LangGraph repository checkout for runtime use. The bundled references and scripts distill repo evidence into reusable guidance; original tests and examples remain verification evidence, not runtime dependencies.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).