Skip to content

OpenAI Agents SDK (Python)

The official production-ready replacement for Swarm. Lightweight primitives (Agent, Handoff, Guardrail, Session, Tool) with built-in tracing, MCP support, and provider-agnostic LLM access (OpenAI + 100+ via LiteLLM).

Install

Terminal window
pip install "openai>=2.0" openai-agents

Version

v0.17.4 · May 2026 · Python 3.10+

Best for

Multi-agent handoffs, customer-service bots, tracing-first apps.

  • v0.17.4 (May 2026) — Patch release; stability and dependency improvements. All key symbols (Agent, Runner, Handoff, ShellTool, LocalShellTool, ToolSearchTool, ApplyPatchTool, RetryPolicy, Session, SessionABC, RunState, StopAtTools, RunErrorHandlers, HostedMCPTool, ImageGenerationTool, OpenAIResponsesCompactionSession, OpenAIConversationsSession, ResponsesWebSocketSession) confirmed present in installed openai-agents==0.17.4 (.routine-envs/openai-agents); no DeprecationWarning emissions.
  • v0.17.3 (May 2026) — Patch release; stability and dependency improvements.
  • v0.17.2 (May 12) — Patch release; stability and dependency improvements.
  • v0.17.1 (May 11) — Patch release; stability and dependency improvements.
  • v0.17.0 (May 9) — New tools and retry infrastructure. ShellTool and LocalShellTool for sandboxed shell command execution (from agents.tool); ToolSearchTool for dynamic tool discovery; ApplyPatchTool for code-patch application. RetryPolicy type alias (from agents.retry) for configurable per-agent retry strategies. Session / SessionABC abstractions (from agents.memory.session) for structured session management. All confirmed present in installed openai-agents==0.17.0 (.routine-envs/check-0509-py).
  • v0.16.1 (May 7) — Patch; stability improvements.
  • v0.16.0 (May 6) — Minor release; session management restructured into agents.memory.session.
  • v0.15.3 (May 5) — Patch; dependency updates.
  • v0.15.1 (May 2) — Patch release; stability and dependency updates.
  • v0.15.0 (May 1) — Minor release; stability and dependency updates.
  • v0.14.8 (April 29) — Patch release; stability improvements.
  • v0.14.7 (April 28) — Patch release; stability improvements.
  • Sandbox agents — persistent isolated workspaces with files, directories, Git repos, snapshots. Backends: local Unix, Docker, Blaxel, E2B, Modal, Runloop, Vercel.
  • WebSocket transport for OpenAI Responses models — low-latency multi-turn conversations via responses_websocket_session().
  • Sync function tools now run on worker threads via asyncio.to_thread().
from agents import Agent, Runner
agent = Agent(
name="Assistant",
instructions="You are a helpful assistant.",
)
result = Runner.run_sync(agent, "What is 2 + 2?")
print(result.final_output)

Ready? Start Zero → Hero Step 1 →


DateVersionChangesReviewer
2026-05-270.17.4Version bumped 0.17.3 → 0.17.4; “What’s new” updated; comprehensive guide header updated; revision history entry added. All key symbols (Agent, Runner, Handoff, ShellTool, LocalShellTool, ToolSearchTool, ApplyPatchTool, RetryPolicy, Session, SessionABC, RunState, StopAtTools, RunErrorHandlers, HostedMCPTool, ImageGenerationTool, OpenAIResponsesCompactionSession, OpenAIConversationsSession, ResponsesWebSocketSession) verified with -W error::DeprecationWarning against installed openai-agents 0.17.4 (.routine-envs/openai-agents); no DeprecationWarning emissions.Claude routine
2026-05-190.17.3Version bumped 0.17.2 → 0.17.3; “What’s new” updated; comprehensive guide header updated; revision history entry added. All key symbols verified against installed openai-agents 0.17.3 (.routine-envs/check-0519-py); no DeprecationWarning emissions.Claude routine
2026-05-120.17.2Version bumped 0.17.1 → 0.17.2; “What’s new” section updated; comprehensive guide header updated; revision history entry added. All key symbols (Agent, Runner, Handoff, ShellTool, LocalShellTool, ToolSearchTool, ApplyPatchTool, RetryPolicy, Session, SessionABC, RunState, StopAtTools, RunErrorHandlers, HostedMCPTool, ImageGenerationTool, OpenAIResponsesCompactionSession, OpenAIConversationsSession, ResponsesWebSocketSession) verified with -W error::DeprecationWarning against installed openai-agents 0.17.2 (.routine-envs/check-0512-py).Claude routine
2026-05-110.17.1Version bumped 0.17.0 → 0.17.1; “What’s new” section updated; comprehensive guide header updated; revision history entry added. All key symbols verified with -W error::DeprecationWarning against installed openai-agents 0.17.1 (.routine-envs/check-0511-py).Claude routine
2026-05-090.17.0Version bumped 0.15.1 → 0.17.0 (four releases: 0.15.3, 0.16.0, 0.16.1, 0.17.0); “What’s new” section updated; comprehensive guide header updated; revision history entry added. New symbols ShellTool, LocalShellTool, ToolSearchTool, ApplyPatchTool, RetryPolicy, Session, SessionABC verified against installed openai-agents 0.17.0 (.routine-envs/check-0509-py).Claude routine
2026-05-020.15.1Version bumped 0.15.0 → 0.15.1; “What’s new” heading updated; comprehensive guide header updated; revision history entry added. Agent, Runner, Handoff, guardrail imports verified against installed 0.15.1 (.routine-envs/check-openai-0502).Claude routine
2026-05-010.15.0Version bumped 0.14.8 → 0.15.0; “What’s new” heading updated; comprehensive guide header updated; revision history entry added. Agent, Runner, Handoff, guardrail imports verified against installed 0.15.0 (.routine-envs/check-openai-0501).Claude routine
2026-04-290.14.8Version bumped 0.14.7 → 0.14.8; “What’s new” heading updated; comprehensive guide header updated; revision history entry added. Snippets verified against installed 0.14.8 (.routine-envs/main-py-0429).Claude routine
2026-04-280.14.7Version bumped 0.14.6 → 0.14.7; “What’s new” heading updated; comprehensive guide header updated; revision history entry added. Snippets verified against installed 0.14.7.Claude routine
2026-04-250.14.6Version bumped 0.14.5 → 0.14.6; “What’s new” heading updated; comprehensive guide header updated; revision history entry added. Snippets verified against installed 0.14.6.Claude routine
2026-04-240.14.5Version bumped 0.14.4 → 0.14.5; “What’s new” heading updated; comprehensive guide header updated; revision history entry added.
2026-04-210.14.3Index redesigned with Zero → Hero + Jump-to-topic grid.
2026-04-200.14.3Patch release; no breaking changes from 0.14.2.
April 16, 20260.14.0Sandbox agents; WebSocket transport; openai v2 requirement; Python 3.9 dropped.
November 20250.6.1Initial 2025 features; Swarm migration; MCP; guardrails; sessions.

Note: TypeScript implementation lives at OpenAI Agents SDK (TypeScript).