← Back to Leaderboard
Llangchain-ai

langchain-ai/langgraph-swarm-py

LangGraph swarm SDK for direct agent handoffs and multi-turn continuity

Engineering Health (Methodology)
A · 86/100
Maintenance Activity
● Updated yesterday
Latest Release
langgraph-swarm==0.1.0
Commercial License Check
MIT · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption20/25
Release Cadence11/20
License Clarity20/20
CLI
Total Stars
★ 1,604
24h Growth
+1
7d Growth
+6
Forks
229

GitHub Star History

Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.

langchain-ai/langgraph-swarm-py Star History (2025-02-24 - 2026-12-04) ALL-TIME STAR HISTORY (2025-02 – 2026-12) +1.6k in 648d · avg +2/day 1.7k 847 0 2025-02-24: ★ 12025-04-05: ★ 6402025-05-17: ★ 8792025-06-28: ★ 9732025-08-09: ★ 1,0662025-09-20: ★ 1,1282025-11-01: ★ 1,1762025-12-13: ★ 1,2852026-01-24: ★ 1,3322026-03-07: ★ 1,3842026-04-18: ★ 1,4462026-05-30: ★ 1,4852026-07-11: ★ 1,5242026-08-22: ★ 1,5502026-10-03: ★ 1,5672026-11-12: ★ 1,5942026-12-04: ★ 1,604 ★ 1.6k 2025-02 2026-01 2026-12

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

LangGraph Swarm is a Python orchestration SDK for direct handoffs between named agents. create_swarm() assembles a parent StateGraph; the application compiles it before use. The entry router uses the default agent when no active agent has been recorded. Once a handoff changes active_agent, a subsequent invocation can enter through that agent if the thread state was checkpointed. A supervisor does not have to make a fresh routing decision on every turn.

Each agent exposes handoff tools for its configured destinations. A custom tool can return a LangGraph Command with graph=Command.PARENT, route to the target, and update parent state. The calling agent needs a tool node that handles Command, and the parent and receiving agent need compatible state keys for the update. For manually assembled graphs, add_active_agent_router() supplies the same entry-routing pattern. The runtime stack is Python 3.11+ with langchain, langchain-core, and langgraph in the 1.x ranges.

Key Capabilities & Differentiators

The default handoff passes the full shared messages history and appends a tool message confirming the transfer. That preserves context when a specialist takes over. Applications can change a handoff tool’s name and description, give the model an argument such as a task brief, or pass a narrower set of messages. To keep internal histories separate, use agent-specific state keys and wrappers that explicitly map inputs and outputs between the parent graph and each agent.

Compiling with a checkpointer preserves conversation state and the active agent for a given thread_id; a store can support longer-lived memory across threads. Streaming and human-in-the-loop controls come from LangGraph. The concrete model integration uses langchain-openai, ChatOpenAI, and gpt-4o; langchain-openai is installed separately from the core package. Other integrations should be evaluated for reliable tool calling, since handoffs depend on it.

Trade-offs & Limitations

Compared with a supervisor graph, a swarm gives specialists control over when to transfer the conversation and lets the receiving agent stay active for the next turn. That suits conversations that remain with one specialist for several turns. The trade-off is that routing decisions live in multiple agents' prompts and tool choices rather than in one policy node. If rules such as mandatory approvals or a fixed sequence must hold on every run, explicit LangGraph edges and application-side checks are easier to reason about.

A shared transcript makes handoffs simple, but it does not isolate one agent’s messages from another. If agents should see different data, define that boundary in the state mappings instead of relying on prompts. As history grows, passing it to the model can increase token usage; repeated transfers can also add model calls. Test misroutes and handoff loops, set execution limits appropriate to the workflow, and compare with a single tool-calling agent before adding roles. The MIT license permits commercial embedding, but model-provider terms and data-handling obligations remain separate.

Hardware & Deployment Guide

Install langgraph-swarm with pip in a Python 3.11+ application. The demonstrated hosted-model path also installs langchain-openai and sets OPENAI_API_KEY. The SDK runs inside the application process; that example needs network access to the model provider but does not run local model weights or require a GPU. Hosting the graph yourself is not the same as running inference offline. The repository includes the langgraph_swarm/ package, examples/, tests/, and a uv.lock; it does not include a container manifest or turnkey service configuration in the listed root tree.

Use InMemorySaver and InMemoryStore for local experiments, not for persistence across restarts. If conversations must survive restarts, choose a durable LangGraph checkpointer and add a durable store only if cross-thread memory is needed. Size the service around concurrent graph runs, tool execution, and retained history rather than a fixed hardware profile. Release 0.0.14 prepared for LangGraph v0.6, 0.0.15 allowed LangChain 1.0, and 0.1.0, released December 4, 2025, moved the package to the LangChain 1.0 generation and pins all three core dependencies to 1.x.

Graph construction: create_swarm() returns a StateGraph for the application to compile; add_active_agent_router() also works with a manually assembled graph.
Thread continuity: A checkpointer and a reused thread_id preserve conversation history and the last active agent across invocations.
Handoff contract: The built-in tool transfers control with the full message history and appends a tool message confirming the transfer.
State customization: Custom handoffs can use Command.PARENT to route to another agent and update parent state; wrappers can map between shared and agent-specific message schemas.
Memory separation: Pass a checkpointer to .compile() for thread state and a store for longer-lived, cross-thread memory.
Compatibility: Version 0.1.0 targets Python 3.11+ and depends on langchain, langchain-core, and langgraph, each at >=1,<2.
Best For

Python teams building multi-turn assistants where specialists hand off directly and the agent that takes over should continue the conversation on the next turn.

Skip If

Routing must follow a centrally enforced sequence, a single tool-calling agent is sufficient, or you need a turnkey hosted service rather than an SDK.

Reviewed on 2026-12-03 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

CLI
pip install langgraph-swarm

Comparison vs. Top Agents & Frameworks Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
langgraph-swarm-py ★1.6k+6PythonMITLangGraph swarm SDK for direct agent handoffs and multi-turn continuity
langchain150.4k+299PythonMITModular Python framework for building agents across model providers
langgraph45.8k+293PythonMITPython graph orchestration for stateful, resumable agents and workflows
deepagents31.8k+138PythonMITA LangGraph-based agent harness for long-running, tool-driven workflows

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/langchain-ai/langgraph-swarm-py.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

langchain-ai/langgraph-swarm-py Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about langgraph-swarm-py

How do I integrate a swarm and keep the active agent across turns?

Build named agents, give each agent handoff tools for its permitted destinations, and pass the agents and a default entry agent to create_swarm(). Compile the returned StateGraph with a checkpointer and reuse the same thread_id across turns to resume with the last active agent and its conversation history.

Does the swarm require a GPU or a fixed amount of VRAM?

Not for the API-backed example. ChatOpenAI calls gpt-4o remotely, so the local process runs Python orchestration, tools, and state handling rather than model inference. Size the host for concurrent runs, tool workloads, and retained history. If you separately integrate a local model, its inference stack determines GPU and VRAM needs; the project provides no fixed sizing figures.

Can I embed it in a commercial product and host it myself?

Yes. MIT permits commercial use and embedding; preserve the copyright and license notices when redistributing the software or substantial portions of it. You can run the orchestration in your own Python service, but that does not make an external model call local. Review provider terms and the data sent to the model separately.

When is a swarm preferable to a supervisor or plain LangGraph?

Choose a swarm when specialists should pass control directly to one another and the receiving agent should stay active on the next turn. Choose a supervisor when a central coordinator needs to choose the route each time, or build a plain LangGraph workflow when transitions must follow explicit application rules. If only tool selection changes and the conversational role does not, start with a single tool-calling agent.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining langchain-ai/langgraph-swarm-py? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature langchain-ai/langgraph-swarm-py on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare