OpenAI Agents SDK

January 30, 2026

The OpenAI Agents SDK is OpenAI's official framework for building production agent systems. It evolved from the experimental Swarm framework into a production-ready toolkit with multi-agent orchestration, built-in tools, and observability.

From Swarm to Production

Swarm was OpenAI's experimental multi-agent framework. The Agents SDK is its production evolution:

OpenAI just released the Agents SDK, a powerful evolution of the Swarm SDK, designed for seamless AI agent development.

Key upgrades:

Core Primitives

Agent

The fundamental unit — an autonomous system with tools and instructions:

from openai_agents import Agent

agent = Agent(
    name="research-agent",
    instructions="You research topics thoroughly before responding.",
    tools=[web_search, file_reader],
)

Handoff

Transfer control between agents:

from openai_agents import Handoff

# Define when to hand off to a specialist
handoff = Handoff(
    target="specialist-agent",
    trigger="When the user asks about legal matters",
)

Guardrail

Constraints on agent behavior:

from openai_agents import Guardrail

guardrail = Guardrail(
    rule="Never share personal information",
    action="refuse",
)

Built-in Tools

The SDK includes powerful built-in tools:

from openai_agents.tools import web_search, code_interpreter

agent = Agent(
    name="research-assistant",
    tools=[web_search, code_interpreter],
)

Multi-Agent Orchestration

Build systems where agents collaborate:

# Specialized agents
researcher = Agent(name="researcher", tools=[web_search])
analyst = Agent(name="analyst", tools=[code_interpreter])
writer = Agent(name="writer", instructions="Write clear, concise reports")

# Orchestrator that coordinates them
orchestrator = Agent(
    name="orchestrator",
    instructions="Coordinate research, analysis, and writing tasks",
    handoffs=[researcher, analyst, writer],
)

As one developer noted:

seamless flow for hierarchical communication between orchestrator/minion agents (handoffs). Everyone in the space has written boilerplate that handles similar problems. This library does it super well.

Observability

Built-in tracing for debugging and monitoring:

from openai_agents import trace

with trace() as t:
    result = agent.run("Research quantum computing")
    
# Inspect the trace
print(t.steps)  # All decisions and tool calls
print(t.tokens)  # Token usage
print(t.duration)  # Time taken

TypeScript Support

Full-featured TypeScript SDK:

import { Agent, Runner } from "@openai/agents";

const agent = new Agent({
  name: "assistant",
  instructions: "You are a helpful assistant",
  tools: [getWeather, searchWeb],
});

const runner = new Runner(agent);
const result = await runner.run("What's the weather in Tokyo?");

The Responses API

The Agents SDK builds on the new Responses API, which combines:

from openai import OpenAI

client = OpenAI()

response = client.responses.create(
    model="gpt-4o",
    tools=[{"type": "web_search"}],
    input="What happened in AI today?",
)

When to Use It

Good fit:

Consider alternatives when:

Installation

# Python
pip install openai-agents

# TypeScript
npm install @openai/agents

Migration from Swarm

If you used Swarm:

# Swarm (deprecated)
from swarm import Swarm, Agent

# Agents SDK
from openai_agents import Agent, Runner

Key differences:


Sources


See also: Claude SDK · Orchestration · Tools & Function Calling