langgraph-swarm-py  by langchain-ai

SDK for multi-agent systems using LangGraph, enabling dynamic agent handoff

created 5 months ago
1,066 stars

Top 36.0% on sourcepulse

GitHubView on GitHub
Project Summary

This library provides a Python framework for building swarm-style multi-agent systems using LangGraph, enabling specialized agents to dynamically hand off control and context to one another. It's designed for developers creating complex agentic workflows that require collaboration and stateful interactions between distinct AI agents.

How It Works

The core mechanism involves agents created with LangGraph's create_react_agent that incorporate custom create_handoff_tool functions. These tools allow agents to explicitly transfer execution to another agent by name. The create_swarm function orchestrates these agents into a graph, managing the active agent and ensuring continuity. Handoffs can pass the full message history or custom data, and the system supports memory via checkpointers for stateful, multi-turn conversations.

Quick Start & Requirements

Highlighted Details

  • Enables dynamic agent handoffs based on specialization.
  • Supports streaming, short-term, and long-term memory.
  • Allows customization of handoff tools and agent implementations.
  • Built on LangGraph, leveraging its graph-building capabilities.

Maintenance & Community

  • Project maintained by langchain-ai.
  • Further customization examples and guides are available in the repository.

Licensing & Compatibility

  • License: MIT License
  • Compatible with commercial use and closed-source applications.

Limitations & Caveats

Custom handoff tools returning Command require agents to have a tool-calling node and shared state schemas that accommodate Command.update fields. Custom agent implementations necessitate careful state mapping between the swarm and individual agent graphs.

Health Check
Last commit

6 days ago

Responsiveness

1 day

Pull Requests (30d)
8
Issues (30d)
2
Star History
345 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Steven Hao Steven Hao(Cofounder of Cognition), and
6 more.

openai-agents-python by openai

1.5%
13k
Python SDK for multi-agent workflows
created 4 months ago
updated 8 hours ago
Starred by Zhiqiang Xie Zhiqiang Xie(Author of SGLang), Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), and
6 more.

swarm by openai

0.3%
20k
Multi-agent orchestration framework for lightweight agent coordination
created 1 year ago
updated 4 months ago
Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Didier Lopes Didier Lopes(Founder of OpenBB), and
1 more.

langgraph by langchain-ai

2.1%
17k
Agent orchestration framework for building controllable agents
created 2 years ago
updated 14 hours ago
Feedback? Help us improve.