- Category
- AI Agents
- Rank
- No. 192Tools index
- Pricing
- Open Source
- Type
- AGENT
- Builder
- openai
- GitHub
- 22.0k stars
- Date
About
OpenAI's educational multi-agent orchestration framework — ergonomic primitives for handoffs between agents with shared context.
What it does
Swarm runs a conversation through a loop: ask the active agent for a completion, execute requested Python tools, append their results, switch agents when a tool returns one, update supplied context, and stop when no more tools are requested. Callers retain the messages and context needed for later turns.
Why it's ranked here
Swarm is a compact, readable teaching implementation with enough machinery to demonstrate tool execution, routing, context updates, streaming, and multi-turn control. Its value is now historical and educational. The repository explicitly says it has been replaced by the production-ready OpenAI Agents SDK and recommends migration for production use.
What's good
The control loop is small enough to understand directly. Agents can use fixed or context-derived instructions, invoke ordinary Python functions, transfer control by returning another agent, and update shared context through structured results. Callers can cap turns, disable tool execution for inspection, override models, stream output, and inject a mock client for tests.
Tradeoffs
It stores no conversation state between calls, so the application must carry messages and context forward. It depends on the Chat Completions API and executes tool calls in the client process. Function schema generation recognizes only a small set of Python annotations and otherwise treats parameters as strings. Most importantly, active development moved to its successor.
How to use it well
Use Swarm to learn orchestration mechanics, prototype routing patterns, or test how several narrowly defined capabilities cooperate. Start with triage, tool calling, and handoff examples, then add explicit turn limits and application-managed state. It does not provide hosted threads, built-in memory, retrieval, or a supported production foundation. Choose the OpenAI Agents SDK for production work.
Technical notes+
swarm/core.py implements Swarm.run, Swarm.run_and_stream, tool execution, agent switching, context merging, and OpenAI Chat Completions requests. swarm/util.py derives JSON tool schemas through signature inspection and merges streamed chunks. swarm/types.py defines Pydantic models for Agent, Response, and Result. swarm/repl/repl.py supplies an interactive demo loop. tests/test_core.py covers simple completion, tool execution, disabled execution, and handoff behavior, while tests/test_util.py checks schema conversion. setup.cfg declares Python 3.10+, MIT licensing, setuptools discovery, and runtime dependencies; pyproject.toml selects setuptools.build_meta.
Observed
- License
- MIT
- Primary language
- Python
- Python requirement
- Python 3.10 or newer
- Packaging
- Setuptools package using the setuptools.build_meta backend
- Install surface
- pip installation directly from the Git repository over SSH or HTTPS
- Interface
- Python library with an interactive REPL helper
- Model API
- OpenAI Chat Completions API
- Tests
- Repository includes tests for completions, tool calls, handoffs, execution control, and function schema conversion
Read from README.md, setup.cfg, pyproject.toml, swarm/core.py, swarm/util.py, swarm/types.py, swarm/__init__.py, swarm/repl/repl.py, swarm/repl/__init__.py, tests/test_core.py, tests/test_util.py, tests/mock_client.py, examples/airline/main.py.
What it can do
Orchestrate multiple AI agents to work together
Multiple AI agent configurations and task requirements → Coordinated multi-agent workflow execution
Hand off tasks between different AI agents
Task context and agent specifications → Seamless task transfer with preserved context
Share context across multiple agents
Conversation history and state information → Synchronized agent knowledge and context
Define agent interaction patterns
Agent roles and communication rules → Structured multi-agent conversation flows
Manage agent workflows and execution order
Agent sequence definitions and trigger conditions → Automated agent execution pipeline
Create educational examples of multi-agent systems
Learning objectives and use case requirements → Demonstration multi-agent applications
Intel on Swarm
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.
