LangGraph Multi-Agent Swarm
Coordinate specialized agents through dynamic handoffs and persistent conversational state.
- Source repo
- langchain-ai/langgraph-swarm-py
- Stars
- ★ 1.6k
- Last updated
- 1mo ago langgraph-swarm==0.1.0
- FARS reviewed
- Nov 08, 2026
- License
- MIT
- Primary language
- Python
- FA score
- 46/100 · Major gaps
At a glance
- How it runs
- Works with
- Portable with changesOpenAI API
- Cost
- Free software; you pay for model usage
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- A Python team building customer support can route a conversation among billing and technical specialists while retaining the currently responsible agent across turns.
- Not a fit if
- Teams wanting a managed service or standalone server
- Those needing per-agent context isolation by default
- Website
- langchain-ai.github.io ↗ set on GitHub
- Maintenance
- Commits in the last 6 monthslast commit 2026-10-28latest release langgraph-swarm==0.1.0 (2025-12-04)+0.6 ★/day over 7 days
- Source review
- 46/100 · Major gaps 2 safety controls not found
What does this agent do, and when should you use it?
LangGraph Multi-Agent Swarm is a Python library for building swarm-style multi-agent applications. It combines specialized agents into a LangGraph StateGraph with create_swarm, while create_handoff_tool lets those agents transfer control and context to one another. The router tracks the last active agent so a later turn can resume with that agent when checkpointing is configured. The graph must be compiled before invocation and can use LangGraph checkpointers, stores, streaming, and human-in-the-loop facilities. This is an application-level orchestration library rather than a hosted service: adopters remain responsible for model access, agent definitions, persistence, and deployment.
A developer creates individual agents with langchain.agents.create_agent or custom StateGraph implementations, assigning each its own tools and system prompt. create_handoff_tool adds callable transfers between agents; by default, a handoff forwards the complete swarm message history and appends a successful-handoff ToolMessage. create_swarm([alice, bob], default_active_agent="Alice") assembles the parent StateGraph and tracks its current controller through active_agent. The developer compiles it with workflow.compile(checkpointer=..., store=...) to add short-term or long-term memory, then sends messages through app.invoke({"messages": [...]}, config) and receives the resulting workflow state. For isolated histories or specialized schemas, developers can wrap child graphs with state transformations and construct routing explicitly through add_active_agent_router.
- A Python team building customer support can route a conversation among billing and technical specialists while retaining the currently responsible agent across turns.
- An application developer can give math, language, or other domain agents distinct prompts and tools, then let the model initiate handoffs according to specialization.
- A team that cannot expose every agent's internal history can define separate message keys and transform state at each parent-to-child graph boundary.
- Existing LangGraph users can add a checkpointer for resumable conversations and a store for memory that persists across threads.
- Engineers designing structured delegation can customize a handoff tool so the calling model supplies a task description or other context for the next agent.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
pip install langgraph-swarmpip install langgraph-swarm langchain-openai
- Environment variables
OPENAI_API_KEY
How do you install or deploy this agent?
A Python environment is required. Install the library with:
pip install langgraph-swarmTo run the documented OpenAI example, install its adapter and provide an API key:
pip install langgraph-swarm langchain-openai
export OPENAI_API_KEY=<your_api_key>How do you use this agent?
Instantiate ChatOpenAI(model="gpt-4o"), then define named agents with create_agent, adding a create_handoff_tool for each allowed transfer. Build the workflow with create_swarm([alice, bob], default_active_agent="Alice"). For a multi-turn application, compile it with InMemorySaver or another checkpointer: app = workflow.compile(checkpointer=checkpointer). Invoke it using a stable thread configuration such as config = {"configurable": {"thread_id": "1"}}, followed by app.invoke({"messages": [{"role": "user", "content": "i'd like to speak to Bob"}]}, config). Reuse that thread_id on later turns so the saved conversation and active-agent state can be restored.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- confirmation before acting — Turn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
- rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.
What are this agent's strengths and limitations?
create_handoff_toolandcreate_swarmprovide concrete primitives for context transfer, agent switching, and active-agent routing.- Compiled workflows can use LangGraph's documented streaming, short-term and long-term memory, and human-in-the-loop capabilities.
- Handoff tools can be customized with different names, descriptions, model-populated arguments, and transferred state.
- Custom child schemas and state-conversion wrappers allow applications to isolate agent histories instead of sharing one global message list.
- Multi-turn operation requires a checkpointer; without one, the swarm loses conversation history and forgets which agent was last active.
- The default handoff exposes the full accumulated message history to the next agent, so privacy or context isolation requires custom implementation.
- A custom handoff returning
Commandneeds a compatible tool-calling node, and both the parent and destination graphs must declare every updated state key. - The only runnable provider setup shown uses
langchain-openai, an OpenAI API key, and network access; no ready-to-run configuration for another provider is documented. - The repository documents an embeddable Python workflow, not a standalone server, container image, or managed deployment.
How does this agent compare with similar options?
Compared with manually assembling a LangGraph StateGraph, create_swarm and create_handoff_tool supply prebuilt active-agent routing and transfer behavior. Applications needing isolated message state or custom transformations can instead assemble nodes themselves and add routing with add_active_agent_router.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| LangGraph Multi-Agent Swarm This agent | 46 · Major gaps | Library / SDKFree + model costs | ★ 1.6k | 1mo ago | Python | OpenAI API |
| Generative AI with LangChain | 41 · Major gaps | Library / SDKFree + model costs | ★ 1.5k | 3mo ago | Jupyter Notebook | OpenAI API · Claude API |
| OpenBot | 59 · Major gaps | Web appFree + model costs | ★ 48 | 15d ago | Python | Claude Code · OpenAI API · Claude API |
| AG2: Open-Source AgentOS | 75 · Good | Library / SDKFree + model costs | ★ 5.1k | 1d ago | Python | OpenAI API |
How does FollowAgents rate this agent?
Why each dimension lost points
The README says the default handoff passes the full message history and shows how to customize the data passed. This makes the main state flow reasonably clear, but sharing all history by default broadens exposure, so least privilege and sensitive-data handling score 1. The supplied files do not show user confirmation before handoff, control of external side effects, or rollback, so those criteria score 0 or 1. The quickstart calls for an API key, project metadata lists dependencies, and the MIT license names a copyright holder; there is no evidence of credential protection or dependency security controls, while source attribution scores 2 based on the file-level attribution and references.
The README's descriptions of graph compilation, persistence, and resuming across turns broadly align with the in-memory checkpoint and two-handoff flow in the test file, supporting a self-consistency score of 2. The project specifies a Python range and bounds its main dependencies, but the packet shows no lock file or availability guarantees, so dependency availability scores 1. The supplied files do not explain how runtime failures are surfaced, so failure messages score 0; no execution outcome is inferred.
The README targets Python developers building multi-agent applications and covers shared state, memory, and custom agent implementations, scoring 2. It describes the need for Command-capable tools and matching state schemas, and notes that shared message history may be undesirable, supporting a score of 2 for capability boundaries. Handoffs are triggered through agent tools, but the packet gives no routing conditions or guidance to prevent unintended transfers, so trigger precision scores 1. The minimum Python version, install command, and LangGraph interface examples provide basic environment-fit guidance, scoring 2.
The README is organized around features, installation, quickstart, memory, and customization, scoring 2. The install command, API-key variable, and concrete examples are reasonably clear, so those criteria score 2. The package name, import name, and project description are aligned, supporting naming stability at 2. The docs call out shared history, checkpoints, and custom-state considerations, but the limitations are incomplete, so known limitations score 1. The repository includes the full MIT license text, scoring 3. Version 0.1.0 appears in project metadata without a changelog, so versioning and changelog score 1. An individual author is named, but maintenance responsibility and an update path are not described, so that criterion scores 1.
Examples show agent handoffs, cross-turn resumption, and custom handoff patterns, making the framework usable for developers, scoring 2. Dynamic transfer and shared state provide a clear capability beyond a single-agent flow, scoring 2 for marginal value. No performance, cost, or resource-use guidance is supplied, so cost-benefit scores 1.
README claims about core capabilities can be traced to examples, and the test file also covers basic handoffs and active-agent state, supporting scores of 2 for claim traceability and cross-source corroboration. The docs sometimes present behavior as fact without consistently separating guarantees, examples, and behavior delegated to the underlying framework; the supplied tests are not independent verification, so fact-inference separation scores 1.
- Not found in source: confirmation before actingTurn on (or add) a confirmation step before it acts, and try it in a sandbox or test environment before real data.
- Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
- The default handoff passes the full message history to the next agent; assess and customize the transferred state when it may contain sensitive information.
- This assessment uses only the supplied static file sample; code was not executed, and files not included in the packet are unknown.
Recent releases
Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.
-
Release notes excerpt
What's Changed * fix: migrate to langchain 1.0 by @philogicae in https://github.com/langchain-ai/langgraph-swarm-py/pull/110 New Contributors * @philogicae made their first contribution in https://github.com/langchain-ai/langgraph-swarm-py/pull/110 Full Changelog: https://github.com/langchain-ai/langgraph-swarm-py/compare/langgraph-swarm==0.0.15...langgraph-swarm==0.1.0View on GitHub ↗ -
Release notes excerpt
What's Changed * chore(bump): allow using with langchain 1.0 by @eyurtsev in https://github.com/langchain-ai/langgraph-swarm-py/pull/103 Full Changelog: https://github.com/langchain-ai/langgraph-swarm-py/compare/langgraph-swarm==0.0.14...langgraph-swarm==0.0.15View on GitHub ↗ -
Release notes excerpt
What's Changed * release: v0.0.14 and prep for langgraph v0.6 by @sydney-runkle in https://github.com/langchain-ai/langgraph-swarm-py/pull/92 New Contributors * @sydney-runkle made their first contribution in https://github.com/langchain-ai/langgraph-swarm-py/pull/92 Full Changelog: https://github.com/langchain-ai/langgraph-swarm-py/compare/langgraph-swarm==0.0.13...langgraph-swarm==0.0.14View on GitHub ↗
FAQ
Is a persistence component required for multi-turn conversations?
workflow.compile(checkpointer=checkpointer); otherwise the swarm forgets the last active agent and loses conversation history.What information is passed during a handoff?
create_handoff_tool forwards the complete message history accumulated by the swarm and adds a tool message confirming the transfer. A custom handoff can change that payload.Must every agent share the same conversation history?
messages is the default, but developers can give child agents separate message keys and write wrappers that translate state between parent and child graphs.What does it cost to operate?
Can it be deployed directly as a service?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.