Claude-skill-registry langgraph-multiagent
Architect-level development, audit, and migration of multi-agent systems using LangGraph (v1+) and LangChain (v1+). Use when building or refactoring supervisor/subagent architectures, orchestrator-worker workflows, routing/hand-offs, agentic RAG, memory (short + long-term), state + context engineering, guardrails + human-in-the-loop, MCP tool integration, observability (LangSmith/OpenTelemetry), deployment, and performance/cost optimization — or when migrating off deprecated patterns like `langgraph.prebuilt.create_react_agent` and libraries like `langgraph-supervisor(-py)`, LlamaIndex agents, CrewAI, Agno, or OpenAI Agents.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/langgraph-multiagent" ~/.claude/skills/majiayu000-claude-skill-registry-langgraph-multiagent && rm -rf "$T"
skills/data/langgraph-multiagent/SKILL.mdLangGraph Multi-Agent
What this skill does
Build, review, and modernize production-grade multi-agent systems with LangGraph/LangChain while staying version-accurate by default: always resolve the current APIs from docs + installed versions, and fall back to
opensrc/ source snapshots for under-the-hood edge cases.
Default operating rules (do these every time)
- Treat all LangGraph/LangChain APIs as versioned; never “code from memory” for any API surface that might have changed.
- Establish ground truth before coding:
- Determine installed/pinned versions (repo lockfiles +
).importlib.metadata - Query official docs via
.langchain-docs.SearchDocsByLangChain - Use Context7 for canonical API references and examples.
- Determine installed/pinned versions (repo lockfiles +
- When docs are ambiguous or behavior is subtle, inspect dependency internals via
(read-only):opensrc/- Run
npx opensrc pypi:<package>@<version> --modify=false - Check
and cite exactopensrc/sources.json
paths + versions in your writeup.opensrc/...
- Run
Use
references/research_playbook.md when you need a rigorous doc-sweep, including llms.txt-driven crawling of LangGraph docs.
Workflow decision tree
- Build something new → follow Build workflow.
- Audit/deprecations/migration → follow Audit & migrate workflow.
- Latency/cost/scale issues → follow Performance & scale workflow.
Quick start (repo-aware)
- Generate a deprecations + framework audit report:
- Run
(from the skill folder)python scripts/audit_repo_agents.py --root . - Optional:
python scripts/audit_repo_agents.py --root . --json agent_audit.json - Optional:
python scripts/generate_migration_plan.py --audit-json agent_audit.json --out migration_plan.md
- Run
- If you need “latest docs” for a specific area, start with:
using queries fromlangchain-docs.SearchDocsByLangChainreferences/docs_index.md
- If you hit a behavior edge case, snapshot internals:
- Run
(from the skill folder)python scripts/opensrc_snapshot.py --packages langgraph langchain langchain-core
- Run
- If you need a doc sitemap for LangGraph (for agentic RAG or doc crawling):
- Run
(from the skill folder)python scripts/fetch_llms_txt_urls.py --print --unique
- Run
- If you need to build an offline docs cache (bounded crawl):
- Use seeds in
references/doc_crawl_targets.md - Run
(from the skill folder)python scripts/crawl_docs.py --llms-txt https://langchain-ai.github.io/langgraph/llms.txt --allow-prefixes https://langchain-ai.github.io/langgraph/ --out-dir docs_cache_langgraph
- Use seeds in
Reference map (use these, don’t guess)
:references/langchain_create_agent_middleware.md
+ middleware hooks + migration mappings.create_agent
: choosing between subagents vs handoffs vs multi-node subgraphs.references/langchain_multiagent_handoffs.md
: reducers, Send API, subgraphs, and common error codes.references/langgraph_graph_api_primitives.md
: state vs store vs runtime context; memory design.references/memory_and_context_engineering.md
: MCP client/interceptors and ToolRuntime-driven auth/DI.references/mcp_integration_patterns.md
: tests + eval strategy for safe migrations.references/testing_evaluation.md
:references/deployment_agent_server.md
and Agent Server deployment basics.langgraph.json
: threat model + mitigations for tool calling systems.references/security_threat_model.md
: repeatable upgrade process.references/upgrades_and_versioning.md
: end-to-end audit→plan→execute methodology.references/audit_and_migration_methodology.md
: import-path cheat sheet (verify for your version).references/api_map_python.md
: Next.js App Router (RSC) + React UI integration (Agent Server +references/ui_nextjs_rsc.md
).useStream
: Next.js App Router using AI SDK v6 (references/ui_nextjs_ai_sdk.md
) + Streamdown (alternative UI stack).useChat
: FastAPI backend patterns for in-process agents or Agent Server BFF/proxy.references/ui_fastapi_backend.md
: simple SSE event protocol for custom UI backends.references/ui_streaming_protocol.md
: Streamlit UI integration patterns (streaming + HITL).references/ui_streamlit.md
Build workflow (LangChain v1 + LangGraph v1+)
- Select the right multi-agent topology (start simple):
- Supervisor + subagents (tool-calling): a main “supervisor” calls subagents as tools for context isolation.
- Orchestrator-worker (fan-out): use LangGraph’s worker primitives (e.g., Send-style fanout) for parallelizable tasks; use reducers to avoid concurrent state-update errors.
- Deterministic workflow + agent nodes: keep control-flow explicit; use agents only where needed.
- Define strict tool schemas and failure behavior:
- Make tools idempotent where possible; add timeouts and retries; “fail open” on non-critical model/rerank steps.
- Do context engineering explicitly:
- Use typed state for dynamic runtime context; keep “store” for long-term memory; use runtime context injection for user/org-scoped dependencies.
- Add safety controls early:
- Use middleware guardrails and human-in-the-loop for high-stakes tools (payments, outbound emails, destructive actions).
- Add observability before scaling:
- Enable tracing (LangSmith/OpenTelemetry), record tool latency/cost, and add regression evaluations.
Use
references/patterns.md for design templates and “gotchas” per topology.
Audit & migrate workflow (deprecated patterns → modern stack)
- Inventory current architecture (dependencies + imports + runtime behavior):
- Run
and expand it with repo-specific patterns if needed.scripts/audit_repo_agents.py
- Run
- Identify deprecated patterns and their replacements using official docs:
- Prioritize the LangGraph v1 and LangChain v1 migration guides.
- Verify whether
usage should move tolanggraph.prebuilt.create_react_agent
.langchain.agents.create_agent
- Plan the migration in slices (keep it shippable):
- Preserve external behavior; migrate internals; then upgrade prompts/tools; finally tighten types and add tests.
- Execute migration and harden:
- Replace legacy agent frameworks (LlamaIndex agents, CrewAI, Agno, OpenAI Agents) with LangGraph/LangChain equivalents.
- Add offline tests with fixtures/mocks, and add trace-based regression checks when possible.
Use
references/migration_supervisor.md and references/migration_other_frameworks.md for playbooks.
Performance & scale workflow
- Add measurement first:
- Capture per-node latency, token usage, tool call counts, cache hit rates, and error taxonomy.
- Apply the “cheapest win” stack in order:
- Reduce context size (summaries, retrieval, subagent isolation).
- Cache tool results (deterministic and keyed); add request coalescing.
- Parallelize only where state updates are safe (reducers, fanout collection keys).
- Use smaller/faster models for routing/validation; reserve larger models for synthesis.
- Constrain worst-case behavior:
- Recursion limits, max steps, max tool calls, and circuit breakers for flaky dependencies.
Use
references/performance_cost.md for checklists and tactics.
Bundled resources in this skill
: deterministic helpers (audits,scripts/
extraction,llms.txt
snapshot runner)opensrc
: playbooks + templates for docs research, patterns, migrations, safety, observability, and performancereferences/
: copy/paste templates for Python + UI integrations (Next.js, FastAPI, Streamlit)assets/
Start with
references/docs_index.md and references/research_playbook.md.