An open-source LLM function calling framework in Rust for deploying serverless AI tools and agents across geo-distributed edge infrastructure.
openai/swarm
Experimental, educational Python framework for lightweight multi-agent orchestration built on Agents and handoffs over the Chat Completions API.
- Stars
- 22,111
- Forks
- 2,351
- Open issues
- 38
- Last commit
- 7 months ago
What is it?
Swarm is a Python framework for coordinating multiple LLM agents. Its two core primitives are Agent, which bundles instructions and callable functions, and handoffs, which let one agent transfer the conversation to another. The client's run() method loops through model completions, tool execution and agent switches until no new function calls are made, then returns the updated messages, active agent and context variables.
Swarm is built entirely on the Chat Completions API and keeps no state between calls, so the caller passes the message history back in on each turn. It supports streaming, per-run context variables that agents and functions can read, and a demo REPL for testing a setup from the command line.
The project is explicitly experimental and educational. OpenAI notes that it has been replaced by the OpenAI Agents SDK, which the team recommends for production use.
Key features
- 01Agent objects combine instructions with Python functions the model can call.
- 02Handoffs let one agent transfer the conversation to another agent.
- 03Context variables are passed into functions and dynamic instructions.
- 04Built on the Chat Completions API with no server-side state.
- 05Supports streaming responses and a command-line demo loop.
Use cases
- Learning how multi-agent handoffs and tool calling work in practice.
- Prototyping a triage flow that routes requests to specialized agents.
- Building customer service demos with separate agents for different tasks.
Quick start
- 1
Install Swarm from GitHub with pip (requires Python 3.10+)
pip install git+https://github.com/openai/swarm.git - 2
Create a Swarm client, define agents and functions, then call client.run() as shown in the README usage example
Things to know
- Swarm is experimental and educational, not intended for production use.
- The README says Swarm has been replaced by the OpenAI Agents SDK, which is recommended for production.
- Swarm is built on the Chat Completions API and keeps no state between calls, so you must manage conversation history yourself.
In collections
Topics
FAQ
- What is swarm?
- Experimental, educational Python framework for lightweight multi-agent orchestration built on Agents and handoffs over the Chat Completions API. Swarm is a Python framework for coordinating multiple LLM agents. Its two core primitives are Agent, which bundles instructions and callable functions, and handoffs, which let one agent transfer the conversation to another. The client's run() method loops through model completions, tool execution and agent switches until no new function calls are made, then returns the updated messages, active agent and context variables.
- Is swarm free to use? What license does it have?
- swarm is open source under the MIT license. Check the license terms before using it in commercial products.
- Is swarm still maintained?
- No commits for 6+ months. The last commit to swarm was on Apr 15, 2026.
- What can I use swarm for?
- Learning how multi-agent handoffs and tool calling work in practice. Prototyping a triage flow that routes requests to specialized agents. Building customer service demos with separate agents for different tasks.
- How do I install swarm?
- Install Swarm from GitHub with pip (requires Python 3.10+): pip install git+https://github.com/openai/swarm.git Create a Swarm client, define agents and functions, then call client.run() as shown in the README usage example
- Where can I get swarm?
- The source code and installation instructions are on GitHub: https://github.com/openai/swarm
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An open-source agent harness in TypeScript for building stateful LLM agents, with a built-in coding agent, CLI, Web UI, and SDKs.
Python client library that wraps multiple AI provider APIs behind one simple interface for text, structured data, and conversations.
A Python library and CLI that lets any supported LLM (OpenAI, Anthropic, Ollama, LMStudio) call tools on one or more MCP servers via natural language.
A Home Assistant custom component that lets an OpenAI-compatible LLM control your devices, call services, and create automations.
Self-hosted personal AI agent framework in Python with a browser WebUI, terminal client, chat app channels, tools, memory and MCP support.