OpenAI Swarm: the pedagogical framework for multi-agent orchestration

OpenAI releases Swarm on 11 October 2024: an experimental educational framework with Agents, handoffs, routines, context variables. Not intended for production. Evolved into OpenAI Agents SDK in 2025. MIT licence.

Open SourceAI Open SourceSwarmOpenAIMulti-AgentAgenticLLMAI

A deliberately educational release

On 11 October 2024, OpenAI publishes Swarm on GitHub under the MIT licence. The project documentation explicitly states that Swarm is “experimental, educational” and not intended for production use. The reference product for agentic use cases remains, at the time of release, the Assistants API (later evolved into the Responses API).

Swarm’s value therefore lies not in proposing an industrial runtime, but in making a conceptual model explicit. The code is compact — a few hundred lines of pure Python — and clearly exposes recurring patterns in building multi-agent systems.

Agents, handoffs, routines

The framework articulates four primitives. An Agent is defined by instructions (the system prompt) and a set of tool functions. Routines are the agent’s execution flow: model requests, tool invocation, iteration until completion.

Handoffs are the distinctive mechanism: a tool function can return another Agent as its result, transferring control of the conversation to a new agent with different prompt, tools and rules. The handoff is stateless — the new agent receives the message history — and allows complex decision paths to be modelled as composition of specialised agents, without introducing an explicit orchestrator.

Context variables are a state dictionary shared between agents, passed as a parameter to tool functions. They keep application information (user ID, preferences, session variables) outside the model context.

The handoff paradigm

The core idea is that multi-agent orchestration does not require a centralised workflow engine: the individual agent decides, based on current input, to delegate control to a more suitable peer. The result is a programming pattern close to decentralised state machines, in which each state (agent) knows its possible transitions (the other agents it can invoke).

This paradigm will significantly influence the ecosystem: later frameworks such as OpenAI Agents SDK (2025), CrewAI and others will adopt variants of the handoff mechanism.

From experiment to product

During 2025 OpenAI incorporates the lessons from Swarm into the OpenAI Agents SDK, the production-ready framework that replaces its role. Swarm remains the canonical reference for understanding how the handoff pattern was formalised and continues to serve as a minimalist example of educational value.

Link: github.com/openai/swarm

Need support? Under attack? Service Status
Need support? Under attack? Service Status