OpenAI Swarm

Stale
GitHub Python MIT

Description

OpenAI Swarm is a lightweight multi-agent collaboration framework focused on simplicity and controllability, ideal for learning and prototyping.

Key Features

  • Lightweight multi-agent framework — Multi-agent collaboration via Agent and Handoff primitives
  • Stateless design — Built entirely on Chat Completions API, no state between calls
  • Function calling integration — Agents can call Python functions and decide next steps from results
  • Context variables — Support passing and updating context variables between agents
  • Streaming output — Streaming responses for intermediate process visibility
  • Testability — Lightweight design makes agent collaboration logic easy to test and debug

Use Cases

💡 Learn and understand multi-agent collaboration patterns
💡 Rapidly prototype multi-agent systems
💡 Build agent networks for task distribution and routing
💡 Implement multi-role collaboration like customer service triage and personal shopping

Strengths & Limitations

Strengths

  • High community interest (21.9k stars)
  • Permissive open-source license (MIT)
  • Established track record (2 years in production)
  • Responsive to issues, low backlog

Quick Start

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

from swarm import Swarm, Agent

client = Swarm()

def transfer_to_agent_b():
    return agent_b

agent_a = Agent(name="Agent A", instructions="You are helpful.", 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": "Talk to agent B."}])
print(response.messages[-1]["content"])

Related Projects

Agency Swarm

4.5k · Python
Active A+

Agency Swarm is a reliable multi-agent orchestration framework built on OpenAI API, providing structured multi-agent collaboration and communication.

multi-agentopenaiorchestration +2
  • · Customizable agent roles with tailored instructions, tools, and capabilities
  • · Orchestrated communication flows with directional `>` operator for explicit agent messaging
  • · Type-safe tools via Pydantic models with automatic argument validation

Edict

16.4k · Python
Active A

A multi-agent orchestration system inspired by ancient governance structures, featuring 9 specialized AI agents with a real-time dashboard, model configuration, and full audit trails for complex multi-agent collaboration scenarios.

pythonmulti-agentagent +6
  • · 12 specialized AI agents organized as the Tang Dynasty Three Departments and Six Ministries system for checks and balances
  • · Menshen (Gate Review) department provides mandatory institutional review with rejection authority before execution
  • · Real-time Kanban dashboard with 10 functional panels including task tracking, agent health monitoring, and memorial archiving

GPTeam

1.7k · Python
Active A

An open-source multi-agent simulation platform where multiple LLM-powered agents collaborate on complex tasks in shared environments, with customizable roles, memory systems, and environment interaction for studying multi-agent collaboration.

pythonmulti-agentagent +3
  • · GPT-4 powered multi-agent simulation with autonomous collaboration on predefined goals
  • · Agent memory and reflection system inspired by Generative Agents research paper
  • · Spatial movement: agents move between locations and perform tasks in different environments

Cultivation World Simulator

2.0k · Python
Active A

An open-source Cultivation World Simulator using Agentic Workflow to create a dynamic, emerging Xianxia world. Showcases multi-agent collaboration in complex scenarios.

multi-agentworkflowagent +1
  • · Every NPC is an independent LLM-driven agent with unique personality, memory, relationships, and decision-making logic
  • · Emergent storytelling with no preset scripts — sect wars, rivalries, and character arcs arise from world rules and AI interactions
  • · Rich cultivation world system including spirit roots, realms, techniques, sects, alchemy, artifacts, and martial tournaments

Related Articles