openai-agents-sdk
Skill4 starsChanged 3 months agoMITView on GitHub
Multi-Agent Systems & Handoff Architectures using OpenAI Agents SDK and Swarm patterns. Covers @function_tool decorators, Agent & Runner primitives, Handoffs via handoff_description metadata, Manager (Agent-as-Tool) vs Peer Handoff topologies, and Input/Output Guardrails with Tripwires.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- abdullahqureshi27/TaskCortextheir own version, first seen Nov 8, 2026
- laguagu/claude-code-nextjs-skillstheir own version, first seen Oct 26, 2026
- sheikh-mohammad/agent-factory-claude-skillstheir own version, first seen Aug 4, 2026
- AbdulSamad94/Personal-Portfoliotheir own version, first seen Jun 17, 2026
- mm-mazhar/agent-skills-configtheir own version, first seen Feb 10, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- laguagu/claude-code-nextjs-skills★ 72same name
- sheikh-mohammad/agent-factory-claude-skills★ 6same name
- AbdulSamad94/Personal-Portfolio★ 2same name
- abdullahqureshi27/TaskCortex★ 0same name
- mm-mazhar/agent-skills-config★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- agent-introspection-debuggingSkill
- airops-programmatic-content-engineSkill
- api-designSkill
- code-review-and-qualitySkill
- enterprise-rag-knowledge-systemsSkill
- eval-harnessSkill
- geo-aeo-agent-optimizationSkill
- langchain-agent-patternsSkill
- mcp-server-patternsSkill
- multi-agent-crew-patternsSkill
- pgvector-hybrid-searchSkill
- prd-criticSkill
- product-spec-generatorSkill
- prompt-engineerSkill
- security-and-hardeningSkill
- security-reviewSkill
- signal-based-ai-agentSkill
- tdd-workflowSkill
- ui-ux-pro-maxSkill
The file
Files
🤖 OpenAI Agents SDK & Multi-Agent Handoff Patterns
The OpenAI Agents SDK provides an ergonomic framework for orchestrating single-agent ReAct loops and multi-agent topologies (Swarm pattern).
🏗️ Core Primitives
┌────────────────┐
│ Runner │ (Executes ReAct Loop)
└───────┬────────┘
│
┌───────────────────┴───────────────────┐
▼ ▼
┌───────────────────┐ ┌───────────────────┐
│ Parent Agent │─ ─ ─ Handoff ─ ─ ─►│ Specialist Agent │
│ (Triage / Router) │ (handoff_descr.) │ (Domain Expert) │
└─────────┬─────────┘ └─────────┬─────────┘
│ │
▼ ▼
[@function_tool A] [@function_tool B]1. Defining Tools (@function_tool)
The @function_tool decorator automatically inspects Python type annotations and docstrings to generate JSON schemas for the model:
from agents import function_tool
@function_tool
def check_inventory(sku: str, warehouse_id: str = "main") -> str:
"""
Checks real-time inventory stock for a given product SKU in a specific warehouse.
Args:
sku: The unique product stock keeping unit ID.
warehouse_id: The target warehouse identifier (default: 'main').
"""
# Tool execution logic
stock = 42
return f"SKU {sku} has {stock} units available in {warehouse_id}."2. Multi-Agent Handoffs (handoff_description)
Handoffs transfer dialogue ownership from a primary triage agent to a specialist agent.
from agents import Agent, Runner
# 1. Specialist Agent
billing_agent = Agent(
name="Billing Specialist",
instructions="You handle invoice disputes, refunds, and subscription upgrades.",
tools=[check_inventory],
handoff_description="Handles all billing issues, payments, refunds, and invoice inquiries."
)
# 2. Primary Triage Agent
triage_agent = Agent(
name="Customer Support Triage",
instructions="Determine customer intent. If their request involves billing or refunds, hand off to the Billing Specialist.",
handoffs=[billing_agent]
)
# 3. Runner Orchestration
result = Runner.run_sync(triage_agent, "I need a refund for my last invoice!")
print(result.final_output)3. Delegation Topologies: Handoffs vs. Manager Pattern
| Dimension | Handoff Pattern (Swarm) | Manager Pattern (Agent-as-Tool) |
| Control Transfer | Complete transfer of conversation ownership | Manager retains control; sub-agent runs as a tool call |
| Response Routing | Specialist responds directly to user | Sub-agent returns output to Manager to synthesize |
| Best For | Multi-step workflows (Support $\rightarrow$ Sales) | Data aggregation from multiple experts (Research $\rightarrow$ Report) |
4. Guardrails & Tripwires
Enforce safety policies before inputs reach the agent or before outputs are returned to users.
from agents import GuardrailFunctionOutput
def validate_input_guardrail(ctx, agent, input_message) -> GuardrailFunctionOutput:
forbidden_terms = ["system_prompt", "ignore instructions", "jailbreak"]
if any(term in input_message.lower() for term in forbidden_terms):
return GuardrailFunctionOutput(
tripwire_triggered=True,
output_info="Security Violation: Input flagged by safety guardrail."
)
return GuardrailFunctionOutput(tripwire_triggered=False, output_info=input_message)Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

