langgraph-swarm-py  by langchain-ai

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

Created 7 months ago
1,150 stars

Top 33.5% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
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

1 month ago

Responsiveness

1 day

Pull Requests (30d)
1
Issues (30d)
1
Star History
47 stars in the last 30 days

Explore Similar Projects

Starred by Andrew Ng Andrew Ng(Founder of DeepLearning.AI; Cofounder of Coursera; Professor at Stanford), Thomas Wolf Thomas Wolf(Cofounder of Hugging Face), and
4 more.

ag2 by ag2ai

0.9%
4k
AgentOS for building AI agents and facilitating multi-agent cooperation
Created 10 months ago
Updated 2 days ago
Feedback? Help us improve.