Swarm (Experimental, Educational)

A lightweight, ergonomic multi-agent orchestration framework focusing on agent coordination and handoffs.

Source repo
openai/swarm
Stars
★ 22k
Last updated
7mo ago
FARS reviewed
Nov 07, 2026
License
MIT
Primary language
Python

At a glance

How it runs
Library / SDKFramework
Works with
Platform-specificOpenAI API
Cost
Free software; you pay for model usage
Setup effort
Low · running in minutes
You'll need
Python 3.10+Shell / CLINetwork access
Typical use
Developers learning to build multi-agent orchestration with function calling and handoffs.
Not a fit if
  • Teams needing a production-ready, maintained framework; this is deprecated
  • Teams that must use non-OpenAI or local models
  • Developers who need built-in session state and memory management
Maintenance
No commits for 6+ monthslast commit 2026-04-15+3.9 ★/day over 7 days

What does this agent do, and when should you use it?

Swarm is an experimental, educational framework maintained by the OpenAI Solutions team that demonstrates how to build lightweight, highly controllable multi-agent orchestration systems. It is built on two primitive abstractions: Agent and handoffs. An Agent encapsulates instructions and tools, and can hand off a conversation to another Agent at any point. Swarm runs entirely on the client and is stateless between calls, powered entirely by the Chat Completions API. It provides a client.run() method to execute tool calls, handle agent switches, update context variables, and supports streaming responses. The project is deprecated in favor of the OpenAI Agents SDK for production use.

Swarm centers on the Swarm client and Agent class. The client.run() method takes an initial agent and messages, then loops over: getting a completion from the current agent, executing tool calls, switching agents if needed, and updating context variables. Agents can be defined with instructions and functions. Functions can be plain Python functions, and if they return an Agent, execution transfers to that Agent. Swarm automatically converts functions into JSON Schema for Chat Completions tools. It also supports updating context variables via a Result object, streaming via the stream=True parameter, and a demo REPL loop.

  1. Developers learning to build multi-agent orchestration with function calling and handoffs.
  2. Scenarios requiring many independent capabilities or instructions that are hard to encode in a single prompt.
  3. Building customer service bots, such as the airline support example with multiple specialized agents.
  4. Developers needing a lightweight, testable orchestration layer without fully-hosted threads.
  5. Educational or prototyping purposes to demonstrate agent transfer and tool invocation.

Key setup facts

Pulled from the install and usage notes below. The project README has the current values.

Install / run
  • pip install git+ssh://[email protected]/openai/swarm.git
  • pip install git+https://github.com/openai/swarm.git
Runtime
Python 3.10+

How do you install or deploy this agent?

Requires Python 3.10+. Install from GitHub with:

pip install git+ssh://[email protected]/openai/swarm.git

or with HTTPS:

pip install git+https://github.com/openai/swarm.git

How do you use this agent?

Set your OpenAI API key. Then instantiate Swarm client, define agents with instructions and functions, and call client.run with the initial agent and messages. Example:

from swarm import Swarm, Agent

client = Swarm()

def transfer_to_agent_b():
    return agent_b

agent_a = Agent(
    name="Agent A",
    instructions="You are a helpful agent.",
    functions=[transfer_to_agent_b],
)

agent_b = Agent(
    name="Agent B",
    instructions="Only speak in Haikus.",
)

response = client.run(
    agent=agent_a,
    messages=[{"role": "user", "content": "I want to talk to agent B."}],
)
print(response.messages[-1]["content"])

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)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Not found in source — apply before daily use
  • dependency security — Pin versions and run a dependency audit (npm audit, pip-audit) before installing; prefer running it in a container.
  • 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?

Pros
  • Lightweight and stateless, using only the Chat Completions API, making it easy to integrate and test.
  • Simple abstractions of Agent and handoffs allow flexible composition of workflows and agent networks.
  • Supports streaming and a demo REPL for quick testing and debugging.
  • Maintained by the OpenAI team with rich examples covering airline support, weather, and shopping agents.
Limitations
  • Experimental and deprecated; replaced by the OpenAI Agents SDK for production use.
  • Locked into OpenAI's API; cannot be used with other model providers.
  • Limited documentation and no built-in state management; developers handle session state.
  • Requires git and Python 3.10+, and API usage may incur costs.
  • Function schema generation may be incomplete, e.g., no per-parameter descriptions.

How does this agent compare with similar options?

Swarm is distinct from OpenAI's Assistants API, which offers fully-hosted threads and built-in memory management. Swarm runs entirely on the client, is stateless, and resembles the Chat Completions API. Officially, production users are advised to migrate to the OpenAI Agents SDK.

Key facts side by side with the most closely related agents.

Agent Source review Form / cost Stars Updated Language Full support on
Swarm (Experimental, Educational) This agent 58 · Major gaps Library / SDKFree + model costs ★ 22k 7mo ago Python OpenAI API
Langroid 72 · Some gaps Library / SDKFree + model costs ★ 4.2k 5d ago Python Claude Code · OpenAI API
CaveAgent 63 · Some gaps Library / SDKFree + model costs ★ 226 2mo ago Python OpenAI API · Claude API
Agent Craft 52 · Major gaps CLIFree + model costs ★ 542 1mo ago Python OpenAI API

How does FollowAgents rate this agent?

FollowAgents source review · FARS-2.1
Major gaps
58/ 100 5-point scale 2.9 / 5
Trust 10/29
Reliability 8/14
Adaptability 12/18
Convention 14/18
Effectiveness 9/13
Verifiability 5/8
Why each dimension lost points
Trust10 / 29 · 1.7/5

The README says Swarm uses Chat Completions, executes tools by default, and offers execute_tools=false to stop tool execution. This makes the main execution path reasonably visible, but per-tool authorization and per-action user confirmation are not described, so least privilege and confirmation receive only partial credit. The README describes function calls, handoffs, and context_variables flow, and SECURITY.md points to a disclosure policy; the files do not explain sensitive-data handling, control of external side effects, or rollback. The provided pyproject.toml lists no runtime dependencies or update constraints, leaving dependency security unsupported. Core contributors are listed in the README and copyright is stated in LICENSE, supporting attribution.

Reliability8 / 14 · 2.9/5

The README describes the run loop, messages, handoffs, response fields, and lack of persistent state. Test files show mock cases for a simple call, tool execution, disabled tool execution, and handoff, supporting ordinary behavioral consistency. The README requires Python 3.10+ and gives installation commands, but the provided pyproject.toml lists only a build backend and no runtime dependencies, so dependency availability is thinly documented. The README says missing functions, argument errors, and function errors are appended as error responses for agent recovery, providing some evidence of failure handling.

Adaptability12 / 18 · 3.3/5

The README clearly positions Swarm as an educational and experimental framework, explains suitable scenarios, and points to examples across several domains, so audience and scenario coverage is strong. It describes direct function calls, handoffs, context transfer, and its Chat Completions basis with no cross-call state, but gives limited detail on capability boundaries or security limits. Routing depends mainly on the model selecting tools and on function definitions; the material does not show more precise trigger constraints. Python 3.10+, installation, and streaming and non-streaming usage are documented, while platform and deployment fit remain lightly covered.

Convention14 / 18 · 3.9/5

The README has a table of contents, organized sections, parameter tables, a process outline, and multiple example entry points. Installation notes give a Python requirement and SSH/HTTPS commands, but the provided pyproject.toml has no project metadata or runtime dependency list, so the instructions are incomplete. Core terms such as Agent, handoff, functions, and Response are used consistently, but the files provide no compatibility policy. The README points to extensive examples and evaluation examples, though it has no FAQ section. It documents statelessness and handoffs, and warns that Swarm has been replaced by the Agents SDK and is not recommended for production, but does not provide a comprehensive limitations list. LICENSE explicitly grants MIT terms. No release history or changelog is present in the material, so versioning evidence is limited. The README identifies the OpenAI Solution team as maintainer, names core contributors, and points to the successor product, giving clear maintenance responsibility evidence.

Effectiveness9 / 13 · 3.5/5

The README shows tool calls, handoffs, context variables, streaming events, and response structure, making outputs usable by developers for follow-on handling; examples offer limited coverage of production safeguards or output-quality guarantees. The lightweight Agent and handoff abstractions and multiple examples demonstrate potential value for orchestration, but no comparative evaluation or measured benefit is provided, so the score is moderate. Installation and API guidance make initial experimentation understandable, but the files provide no dependency inventory, resource use, or production operations costs, limiting the cost-benefit evidence.

Verifiability5 / 8 · 3.1/5

The README gives concrete API tables, code samples, and output examples; LICENSE, SECURITY.md, pyproject.toml, and mock tests provide some cross-source support. Claims about evaluation guidance and maintenance transition are documented, but the packet contains no evaluation results or release history, so actual outcomes cannot be confirmed. The README states the educational positioning, stateless behavior, and production-use recommendation explicitly; this assessment treats them as documented claims and does not infer execution results or independent verification.

Risks and how to mitigate them
  • Not found in source: dependency securityPin versions and run a dependency audit (npm audit, pip-audit) before installing; prefer running it in a container.
  • 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 README labels Swarm experimental and educational, and recommends migrating production use to the Agents SDK; examples are not evidence of production safety or validated results.
  • Python functions execute as tools by default. Keep externally consequential actions within controlled functions and add confirmation and recovery mechanisms as needed for the application.
  • The provided pyproject.toml has no runtime dependency list, and the packet has no changelog; check dependencies and compatibility before deployment.
Evidence confidence: Low Reviewed Nov 07, 2026 Reviewed revision 6af0b4caf37d
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/swarm.svg)](https://followagents.com/en/agents/swarm)
<a href="https://followagents.com/en/agents/swarm"><img src="https://followagents.com/badge/swarm.svg" alt="FARS review"></a>

FAQ

Is Swarm production-ready?
No. Swarm is experimental and educational, and has been replaced by the OpenAI Agents SDK. The official recommendation is to use Agents SDK for production.
Do I need to pay or apply for access?
Swarm is MIT-licensed open source, but using it requires an OpenAI API key and incurs API costs.
Does Swarm support streaming?
Yes, client.run accepts stream=True and returns a stream compatible with Chat Completions API streaming events, with additional delim and response events.
What happens if a function call fails?
Error messages are appended to the conversation so the agent can recover gracefully.
Can I use Swarm with other model providers?
No, Swarm is built solely on OpenAI's Chat Completions API and does not support other providers.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts