OpenAI Swarm
OpenAI Swarm
AI AgentActive

OpenAI Swarm

OpenAI Swarm is an experimental, educational Python framework for routines and agent handoffs, now officially replaced by the production-oriented OpenAI Agents SDK. This review explains its status, safe experiments, migration and alternatives.

215

Views

0

Likes

Mar 2026

Added

github.com

Project link

Tags

OpenAI Swarmmulti-agenthandoffsOpenAI Agents SDKagent orchestrationPython

Product Preview

A quick visual look at OpenAI Swarm before you visit the official site.

Published 3/15/2026
OpenAI Swarm screenshot

Editorial Review

About OpenAI Swarm

OpenAI Swarm review: a clear handoff lesson, not a production framework in 2026

OpenAI Swarm is a small Python framework created to explore multi-agent orchestration through two primitives: agents and handoffs. Its README now labels the project experimental and educational, says it has been replaced by the OpenAI Agents SDK, and recommends migrating every production use case. That statement should appear before any feature list: Swarm is useful source code and a teaching pattern, not OpenAI's current production recommendation.

The repository is not marked archived on GitHub. The latest commit we verified was 15 April 2026, pinning pre-commit hooks to immutable revisions. That is a maintenance/supply-chain change, not a new runtime release. The repository has no formal GitHub Releases and installation still points to the Git repository. “Not archived” therefore does not overturn the explicit replacement notice.

Swarm remains worth studying because the implementation is unusually legible. A routine is essentially instructions plus functions. A handoff occurs when a function returns another Agent. Context variables let application data influence instructions and functions, while the client loop sends Chat Completions, executes tool calls, merges context updates and optionally changes the active agent. This compactness makes behavior inspectable—and exposes how much production infrastructure is missing.

OpenAI Swarm handoff flow with production guardrails and Agents SDK migration boundary
Original AIDreamHub diagram based on Swarm's two primitives and the current Agents SDK handoff, context, state, guardrail and tracing documentation.

Status in 2026

QuestionVerified answer on 20 Aug 2026Practical decision
Official positioningExperimental, educational; replaced by OpenAI Agents SDKDo not start a new production system on Swarm
GitHub archived flagFalseRepository visibility is not production endorsement
Latest verified commit6af0b4c, 15 Apr 2026; pre-commit pinningMaintenance activity, not a feature release
Formal releasesNo GitHub ReleasesPin a commit for any reproducible experiment
LicenseMITOpen source, while APIs/models have separate terms
Runtime/APIPython 3.10+; Chat Completions; client-side stateless loopApplication must persist messages and state
Current successorOpenAI Agents SDKAdds maintained handoffs, sessions/state, guardrails and tracing

What Swarm actually teaches

PrimitiveSwarm behaviorBoundary to test
AgentName, instructions, functions, optional model/tool choiceA prompt persona is not a security principal
RoutineInstructions plus the tools available for one focused jobInstructions are probabilistic, not workflow constraints
Function/toolPython callable exposed through a schemaArguments need authorization and side-effect controls
HandoffA function returns another Agent, which becomes activeCycles, wrong routing and context disclosure are possible
context_variablesMutable dictionary available to instructions/functionsIt is not durable session storage or automatic LLM context
ResultA tool can return value, new agent and context updatesMerge and serialization semantics belong to the app
Client.runRepeated model/tool calls until completion or max turnsOne process loop; no queue, checkpoint or distributed lease
StreamingYields delimiters and response chunksReconnect and exactly-once tool execution are not supplied

A runnable handoff experiment

Build one bounded experiment: a triage agent routes either to sales or refunds; sales may only query a read-only catalog, while refund can only prepare—not execute—a refund. Pass customer_id, locale and verified order ownership in context_variables. Make transfer functions return the destination agent, log source/destination/reason, and cap max_turns at five. Use a fake provider or sandboxed tools first. The experiment demonstrates routing without granting the model real financial authority.

Test routines independently before testing the network. Give triage a labeled set of billing, sales, ambiguous and adversarial requests; measure destination and unnecessary handoffs. For each specialist, remove all tools it does not need and test its refusal outside scope. Then exercise A→B→A cycles, parallel tool calls, malformed arguments, a tool exception, an attempted cross-tenant lookup and prompt injection embedded in an order note. The expected result must include safe failure, not merely a fluent answer.

Context variables are local application data, not a secret channel and not automatic conversation memory. A dynamic instruction may insert their values into the model prompt, and a function may return updates. Classify each key as model-visible or code-only, never let the model select tenant identity, and avoid placing long-lived credentials in a mutable dictionary. Persist the authoritative state in a database with versioning; reconstruct the minimal context for each run.

Migration and evaluation workflow

  1. Pin the Swarm Git commit, Python environment and model configuration; never depend on an unpinned Git install.
  2. Draw every agent, outgoing handoff, tool, context key and terminal state; flag cycles and privilege increases.
  3. Create a redacted golden set with routing labels, specialist answers, refusals, tool results and expected safe failures.
  4. Run Swarm in a sandbox with fake/read-only tools, max_turns, timeouts and a deterministic side-effect ledger.
  5. Record active agent, handoff source/destination/reason, model request, tool call ID, arguments hash, result and usage.
  6. Build the same workflow in OpenAI Agents SDK using handoffs or agents-as-tools and typed RunContextWrapper.
  7. Add session/run-state strategy, approvals, tool guardrails, server authorization, idempotency and sensitive trace policy.
  8. Shadow both implementations on the same inputs; compare routing, answer quality, tool success, turns, latency and cost.
  9. Canary with read-only traffic, then narrowly scoped writes requiring approval; rehearse timeout, crash and rollback.
  10. Retire the Swarm dependency after parity and safety gates pass, while retaining tests and the explicit handoff graph.

What to measure

MetricMethodWhy
Handoff accuracyLabeled destination and confusion matrixA fluent specialist is useless after wrong routing
Cycle rateRepeated agent-edge sequences per runMulti-agent loops burn tokens without progress
Tool authorizationAllowed/denied tests by user, tenant and resourceSchema validity is not permission
Side-effect integrityIdempotency and duplicate simulationRetries can repeat financial or messaging actions
Answer qualityTask rubric and evidence checksRouting success does not guarantee correct work
Turns and usageRequests/tokens by agent and handoffA network can hide cost amplification
Latencyp50/p95 total and per tool/model stepHandoffs add serial calls
RecoveryCrash, timeout, approval pause and resume testsSwarm itself offers no durable checkpoint
Trace privacySensitive-field detection in exported eventsObservability can become a data leak

Migration starts with behavior, not class names. Inventory Swarm agents, instructions, functions, transfer edges, context keys, model settings, maximum turns, streaming events and external side effects. Draw the actual handoff graph and mark cycles, terminal agents and privilege changes. Capture redacted transcripts and tool traces for a golden set. Pin the Swarm commit and model snapshot long enough to establish a baseline before moving to the Agents SDK.

Map Agent to the maintained SDK's Agent, transfer functions to handoffs or a customized handoff(), and context variables to typed RunContextWrapper data. Use a handoff when the specialist should take over the user-facing conversation; use Agent.as_tool() when a manager should retain control. Choose exactly one conversation-memory strategy—session, to_input_list(), or OpenAI-managed continuation—to avoid duplicate history.

Add production controls during migration rather than recreating Swarm. Tools can require approval, timeouts and input/output guardrails; runs can preserve state for interruption and resumption; tracing records generations, tools, handoffs and guardrails. Tracing is enabled by default in the Agents SDK and may contain sensitive inputs/outputs, so configure redaction or disable it where policy requires. A guardrail library still does not replace server-side authorization.

Security, state and operational limits

RiskMinimum controlWhy Swarm alone is insufficient
Wrong handoffAllowlisted edges, descriptions, labeled eval and human routeRouting is model-selected
Privilege escalationSeparate tool sets and server-side authorizationActive agent is not a trusted identity
Infinite loopmax_turns, cycle detector, progress invariantAgents can return one another repeatedly
Duplicate actionIdempotency key and transaction ledgerClient loop lacks exactly-once semantics
Lost stateDatabase/session and versioned resume tokenChat Completions loop is stateless across calls
Prompt injectionData/instruction separation, output validation, destination limitsTool content re-enters model context
Secret leakageCode-only context, redaction and least privilegeDynamic instructions can expose context values
Silent failureStructured traces, usage and alertsNo built-in production observability

Swarm versus current alternatives

OptionChoose it whenCompared with Swarm
OpenAI Agents SDKYou want the official maintained evolution with OpenAI modelsHandoffs plus sessions/state, approvals, guardrails and tracing
LangGraphDurable checkpoints, explicit graphs, interrupts and provider flexibility dominateMore engineering; stronger state/control model
AutoGen AgentChat/CoreEvent-driven or distributed multi-agent teams and message protocols matterBroader runtime and team patterns; more conceptual surface
CrewAIRole-based crews plus business flows and fast templates suit the teamMore opinionated composition and ecosystem
Single agent + toolsOne model can route tools without conversation takeoverSimpler evaluation, context and cost; often the best baseline
Deterministic workflowKnown sequence, auditability and exact state transitions matterLess autonomous, much easier to reason about
SwarmLearning the minimal routine/handoff loopSmall and inspectable, officially superseded for production

Swarm has no built-in durable state, scheduler, distributed execution, authentication, tenant isolation, retry ledger, cost budget or production trace store. A process crash between a side effect and its tool result can produce ambiguity on retry. Use idempotency keys tied to business operations, transactional outboxes for consequential actions, tool-specific timeouts, per-user rate limits, maximum turns and a human escalation state. Detect repeated active-agent sequences rather than relying only on a global turn ceiling.

Prompt injection becomes more dangerous when a handoff changes the available tools. Treat all user text, retrieved records and tool outputs as untrusted. Do not allow a document to choose an agent by returning a transfer instruction. Authorize at the tool boundary using server-derived identity, validate target account and amount, restrict network destinations, minimize credentials and require approval for irreversible actions. Log the policy decision separately from model reasoning.

Editorial judgment: Swarm is still one of the best tiny codebases for understanding the handoff idea. Its lack of machinery is pedagogically valuable because developers can see the loop. The same lack makes it a poor foundation for new production work, especially when the official maintainer supplies a successor. Read it, reproduce a small experiment, then migrate the pattern—not the dependency—to the Agents SDK or another runtime chosen for your durability and provider requirements.

Frequently asked questions

Is OpenAI Swarm production-ready?

No. Its own README calls it experimental and educational, says the Agents SDK replaced it, and recommends migration for all production use cases.

Is the repository archived?

GitHub's archived flag was false on 20 August 2026. That does not cancel the official replacement notice.

Is Swarm still maintained?

A maintenance commit was visible in April 2026, but there are no formal releases. Activity is not the same as an actively evolved production framework.

What is a handoff?

A tool-like transfer that changes the active agent. In Swarm it occurs when a function returns another Agent.

Are context_variables conversation memory?

No. They are application data passed through a run. The application must persist authoritative conversation and business state.

Can Swarm work with non-OpenAI models?

Its implementation is built around an OpenAI-compatible client/Chat Completions pattern. Compatibility layers may work, but are not a reason to choose a superseded project.

What replaces Swarm?

OpenAI recommends the OpenAI Agents SDK, which preserves lightweight agent and handoff concepts while adding maintained production-oriented features.

Do Agents SDK guardrails replace authorization?

No. Guardrails can validate or block stages; server-side identity, tenant and resource authorization remain mandatory.

Should every workflow use multiple agents?

No. Start with one agent and tools or a deterministic workflow. Add handoffs only when distinct instructions/tool scopes and direct specialist conversation improve measured outcomes.

How should I migrate?

Freeze a baseline, map the handoff graph and context, recreate it with typed SDK primitives, add controls, shadow, canary and remove Swarm after parity.

Sources

Independent review dated 20 August 2026. Repository flags, commits and successor APIs can change; verify the official README and current Agents SDK before implementation.

Review OpenAI Swarm at its official source

Open the official repository, documentation, or model resources.

View official source

Quick Info

Project link
github.com
Category
AI Agent
Added
3/13/2026
Published
3/15/2026
Updated
9/10/2026

Share This Tool

Have an AI tool to share?

Submit it to AI Dreamhub

Get your product in front of people actively exploring AI tools.

Submit Your Tool
Manus

Manus

Manus is a hosted general-purpose AI agent that uses cloud VMs, browser automation, files, code and integrations to complete multi-step tasks. This independent guide covers plans and credits, Cloud Browser vs Browser Operator, authenticated actions, privacy, approvals, task design, evaluation and alternatives.

ai-agentfree
3600
Gemini CLI

Gemini CLI

An open-source AI agent that brings the power of Gemini directly into your terminal.

ai-agentfree
3190
AgentScope

AgentScope

AgentScope is an Apache-2.0 agent framework with ReAct agents, tools, skills, memory, planning, human steering, evaluation, fine-tuning, MCP/A2A integrations, realtime voice, and multi-agent orchestration.

ai-agentfree
3680
Auto-GPT

Auto-GPT

Auto-GPT is an open-source autonomous-agent project and platform from Significant Gravitas for building, running, and managing AI assistants and workflows.

Auto-GPTAI agentautonomous agents
3250