Skip to content

LangGraph vs Swarm

Which should you use? A side-by-side look at what each one does, who it suits, what it costs, how hard it is to set up, and where each falls short.

LangGraph

Open source · MIT

A Python framework for building long-running agents that keep state and can resume after failures.

Swarm

Open source · MIT

Experimental OpenAI library for lightweight multi-agent handoffs; now superseded by the Agents SDK.

The short answer

Choose LangGraph if you need…

  • Python developers building multi-step AI agents that must survive failures or long waits
  • Teams that want fine-grained control over agent state and execution flow
  • Projects that need a human to review or edit an agent's state partway through a run
  • Developers who want a lower-level base instead of a higher-level agent package

Choose Swarm if you need…

  • Developers who want to learn how multi-agent handoffs work with a small codebase
  • Learners reading example code for function calling and agent routing
  • Prototyping a triage or routing flow between a few specialized agents
  • Readers comparing older patterns with the newer OpenAI Agents SDK

Side-by-side

LangGraphSwarm
TypeLibraryLibrary
PriceFree and open sourceFree and open source
LicenceMITMIT
GitHub stars44.3k22.1k
Setup difficultyIntermediateIntermediate
How you get itInstall with a package managerInstall with a package manager
Main languagePythonPython
Last code update4 days ago7 months ago

What each one is

LangGraph

LangGraph is a low-level framework for building workflows and AI agents that keep track of their state over time. It is designed for tasks that run for a long stretch, can pause for human review, and need to pick up where they left off after an interruption. It is produced by LangChain Inc, but the README says it can be used without LangChain.

Swarm

Swarm is a Python library from OpenAI for building systems where several AI agents, each with its own instructions and tools, pass a conversation between them. An agent can hand off to another agent at any point. It is described as an educational project for learning how multi-agent orchestration works, not as a production framework. The README says it is now replaced by the OpenAI Agents SDK and recommends migrating for production use.

Best for

LangGraph

  • Python developers building multi-step AI agents that must survive failures or long waits
  • Teams that want fine-grained control over agent state and execution flow
  • Projects that need a human to review or edit an agent's state partway through a run
  • Developers who want a lower-level base instead of a higher-level agent package

Swarm

  • Developers who want to learn how multi-agent handoffs work with a small codebase
  • Learners reading example code for function calling and agent routing
  • Prototyping a triage or routing flow between a few specialized agents
  • Readers comparing older patterns with the newer OpenAI Agents SDK

Strengths

LangGraph

  • Built-in durable execution that resumes workflows from where they stopped, per the README
  • Supports human-in-the-loop checkpoints and both short-term and long-term memory
  • Open source under the MIT license with extensive documentation and a free course

Swarm

  • Small, readable design built on two primitives: Agents and handoffs
  • Includes multiple example projects in the repository
  • Licensed under MIT

Not ideal for

LangGraph

  • Beginners who just want a ready-made agent: the README points to Deep Agents, a higher-level package built on LangGraph, for quicker starts
  • Non-programmers, since it is a Python library that requires writing code
  • JavaScript/TypeScript-only teams, who are pointed to the separate LangGraph.js project

Swarm

  • Production systems, because the README says the project is replaced by the Agents SDK and recommends migrating
  • Projects needing hosted conversation state or memory, because Swarm is stateless between calls and relies on the Chat Completions API

Trade-offs

LangGraph

  • It is a low-level framework, so it has a steeper learning curve than higher-level tools
  • Several of the most useful features (debugging, deployment) point to LangSmith, a separate product
  • The README is truncated and does not show full API details, so the depth of specific features is hard to verify from it alone

Swarm

  • The README says it is replaced by the OpenAI Agents SDK, so it is not the recommended path for new production work
  • Stateless design means the developer must manage conversation history and any memory themselves
  • Requires an OpenAI API key and Chat Completions access, implied by its design but the README excerpt does not detail setup beyond install

Getting started

LangGraph

Install LangGraph

pip install -U langgraph
Step-by-step guide: how to use LangGraph

Swarm

Install from GitHub over HTTPS

pip install git+https://github.com/openai/swarm.git
Step-by-step guide: how to use Swarm

Frequently asked questions

What is the difference between LangGraph and Swarm?

LangGraph: A Python framework for building long-running agents that keep state and can resume after failures. Swarm: Experimental OpenAI library for lightweight multi-agent handoffs; now superseded by the Agents SDK. LangGraph suits python developers building multi-step ai agents that must survive failures or long waits, while Swarm suits developers who want to learn how multi-agent handoffs work with a small codebase.

Are LangGraph and Swarm free?

LangGraph: Free and open source. Swarm: Free and open source.

Is LangGraph or Swarm more popular?

LangGraph has more GitHub stars (44.3k) than Swarm (22.1k). Popularity isn't the same as fit — check which one matches your use case above.

What are other alternatives to LangGraph and Swarm?

Other options people compare them with include CrewAI, Deep Agents, OpenAI Agents SDK, PageIndex, LEANN.

Keep comparing

Built from our catalogue entries for both products: open-source details come from each project's README (AI-assisted, refreshed weekly) and GitHub data; AI-tool details are editorial. Spotted something wrong? Let us know from either product's page.