Core Concepts
Agents
Agents are instructions + functions. Simple and composable:
agent = Agent(
name="Support",
instructions="You handle customer support.",
functions=[lookup_order, check_status, escalate],
)Handoffs
Agents transfer control by returning another agent:
def transfer_to_billing():
return billing_agent # Control passes to billingContext Variables
Share state across agents without global variables:
response = client.run(agent=triage,
messages=[...],
context_variables={"user_id": "123", "plan": "premium"})Routines
Multi-step procedures encoded as agent instructions — like a playbook for the agent to follow.
FAQ
Q: What is OpenAI Swarm? A: An educational framework by OpenAI exploring lightweight multi-agent orchestration with handoffs, tool calling, and context variables. 21K+ stars, MIT licensed.
Q: Should I use Swarm in production? A: OpenAI explicitly states Swarm is educational, not a production framework. For production, consider OpenAI Agents SDK, LangGraph, or CrewAI.