OpenAI Agents SDK

OpenAI Agents SDK is a lightweight, MIT-licensed Python and TypeScript framework for building multi-agent workflows using a minimal set of primitives: agents, tools, handoffs, guardrails, sessions, and tracing.

multi-agent frameworkOpenAIPython SDKTypeScript SDKhandoffsguardrailstracingopen sourceMIT license
OpenAI Agents SDK hero image
Overview

What is OpenAI Agents SDK?

OpenAI Agents SDK is a code-first framework for building agentic applications with a deliberately small surface area. It is the production-oriented successor to OpenAI's experimental Swarm prototype, released in March 2025 and maintained as an MIT-licensed Python package with a TypeScript counterpart. The SDK's design philosophy favors readability and minimal abstraction over maximum flexibility: an Agent is an LLM configured with instructions and tools, a Handoff transfers control between agents, a Guardrail runs parallel validation on inputs or outputs, and a Runner executes the agent loop while managing state and tool calls[reference:0].

Unlike general-purpose graph frameworks such as LangGraph, the Agents SDK does not model workflows as explicit state machines. It is positioned for teams already building on OpenAI's stack who want an officially supported, low-ceremony way to orchestrate multi-agent patterns—especially handoffs and agent-as-tool delegation—without adopting a heavier orchestration layer. The SDK is technically provider-agnostic through LiteLLM, but its defaults, tracing integration, and optimization targets lean on OpenAI-native capabilities including function calling, structured outputs, and the Responses API[reference:2].

Workflow

How does OpenAI Agents SDK work?

A typical application defines one or more Agent objects with instructions and a tool list. The Runner executes the agent loop, invoking the model and tools until the task completes or a handoff occurs. Handoffs pass control between agents based on intent, while guardrails run asynchronously alongside the agent to validate inputs or outputs and can halt a run before unsafe or off-topic requests reach expensive downstream steps[reference:3].

Sessions persist conversation history in SQLite, Redis, or SQLAlchemy, reducing the need for custom multi-turn storage code. Built-in tracing records every model call, tool call, handoff, and guardrail event; by default this data flows to OpenAI's Traces dashboard, and it can be redirected to a custom processor or disabled entirely[reference:4]. For long-running or failure-prone workflows, the SDK does not include durable execution; a paused run can be saved as RunState, but crash recovery requires integration with an external engine such as Temporal or DBOS[reference:5].

The April 2026 update added Sandbox Agents for containerized execution, tighter MCP integration, and Realtime Agents for voice-driven experiences, extending the SDK's scope beyond text-based orchestration while keeping the core primitive set unchanged[reference:6].

Use cases

Use Cases

  • Building multi-agent customer-support or task-routing systems where handoffs between specialized agents are the primary orchestration pattern
  • Adding input and output guardrails to production agents that need early validation before expensive tool calls or downstream processing
  • Prototyping OpenAI-native agent workflows with minimal boilerplate and growing into Sandbox Agents or Realtime Agents as requirements expand
  • Instrumenting agent runs with tracing for debugging and evaluation, particularly when the team is already using OpenAI's platform
  • Orchestrating mixed-provider agent systems through LiteLLM while retaining the SDK's runner loop and session management
Pricing

Pricing

Pricing model: Free

Plan Price Billing Included usage Notes
Open Source SDK Free — MIT-licensed Python and TypeScript library. No runtime fee for the SDK itself. Users pay only for model API calls made through the SDK. Built-in tracing sends run data to OpenAI's Traces dashboard by default at no additional charge, and can be redirected to a custom processor. —
Free tier: The SDK is free and open source under the MIT license. There is no paid tier for the SDK. Costs come from the underlying model API calls, not from the framework.
Limitations

Common Limitations

  • Tracing data default · Built-in tracing is enabled by default and sends run data—including model calls, tool calls, handoffs, and guardrails—to OpenAI's Traces dashboard, even when using non-OpenAI models through LiteLLM. This can be disabled via environment variable or replaced with a custom tracing processor, but the default behavior requires explicit attention for teams with data locality or vendor-isolation requirements.
  • Durable execution gap · The SDK does not include built-in crash recovery or durable execution. A paused run can be saved as RunState for later resumption, but recovery from process failure or long-running interruption requires an external engine such as Temporal or DBOS.
  • No built-in governance or visual tooling · The SDK provides no visual builder, SSO, role-based access control, audit logs, or hosted server. Teams that need a managed control plane, organizational permissions, or a graphical agent editor must use OpenAI's broader platform offerings or assemble those layers themselves.
  • Provider-agnosticism in practice · While the SDK can call Anthropic, Gemini, and local models through LiteLLM or custom adapters, its architecture is optimized for OpenAI-native capabilities. Non-OpenAI providers lose built-in tracing integration and may encounter differences in structured output, function calling, and realtime support. The Python SDK does not support WebRTC for realtime agents; it uses server-side WebSocket or SIP transport.
Features

Key Features

  • Agent, Tool, Handoff, Guardrail, Session, and Runner primitives
  • Built-in tracing with OpenAI Traces dashboard by default
  • Input and output guardrails with parallel execution
  • Sessions backed by SQLite, Redis, or SQLAlchemy
  • Handoffs and agents-as-tools for multi-agent delegation
Comparison

OpenAI Agents SDK vs. LangGraph and CrewAI

This comparison focuses on documented architecture, execution model, and governance scope using current official sources. It does not rank subjective output quality or speed.

Tool Positioning Key differences Best fit Pricing note
OpenAI Agents SDK Agents SDK overview GitHub repository A lightweight, MIT-licensed SDK for building multi-agent workflows with a minimal set of OpenAI-native primitives. Uses agents, handoffs, guardrails, sessions, and a runner loop rather than explicit state graphs. Tracing is built in and defaults to OpenAI's dashboard. Durable execution and enterprise governance are not included. Teams already on OpenAI's stack that want fast multi-agent orchestration with handoffs and guardrails, and are comfortable adding external systems for durability or governance. Free and open source under MIT. Costs come from model API calls. No paid SDK tier.
LangGraph LangGraph overview LangGraph Platform plans A low-level orchestration framework and runtime for stateful, long-running agents modeled as explicit graphs. Represents workflows as nodes, edges, and shared state, with durable checkpointing, human-in-the-loop interrupts, and time-travel debugging. Does not prescribe an agent architecture or prompt structure. Managed deployment and observability are available through LangSmith. Teams that need explicit graph-level control, durable execution, and complex conditional or cyclic workflows in production. MIT-licensed SDK. LangSmith Developer is free; Plus is $39 per seat per month plus usage-based deployment pricing. Enterprise is custom-quoted.
CrewAI Introduction Pricing An open-source framework for role-playing agent teams (Crews) within structured, stateful Flows, with a hosted enterprise platform. Combines a role-based Crew abstraction with deterministic Flows. The open-source core is MIT-licensed; governance features such as SSO, RBAC, audit trails, and built-in tracing are part of the hosted AMP product. Ships 40+ pre-built tools. Teams that want a readable role/task abstraction for multi-agent pipelines and the option to move to a governed hosted runtime with enterprise controls. Open source is free under MIT. AMP Basic is free with 50 executions per month; Enterprise is custom-quoted.

Comparison checked against official product information on 2026-11-05. Features and pricing may change.

FAQ

Frequently Asked Questions

Is OpenAI Agents SDK really free?

Yes. The SDK is MIT-licensed and has no paid tier. There is no charge for the framework itself. Costs come only from the model API calls your agents make. Built-in tracing sends data to OpenAI's Traces dashboard by default at no additional charge, but this is separate from SDK licensing.

Does OpenAI Agents SDK work with non-OpenAI models?

Technically yes, through LiteLLM or custom adapters. However, the SDK's architecture is optimized for OpenAI-native features such as function calling, structured outputs, and the Responses API. Non-OpenAI providers lose built-in tracing integration and may encounter differences in realtime and structured-output support. Provider-agnosticism is practical but not first-class.

Where does tracing data go by default?

By default, traces are sent to OpenAI's Traces dashboard, even when the underlying model is from another provider. Teams with data-locality or vendor-isolation requirements should disable tracing via the OPENAI_AGENTS_DISABLE_TRACING environment variable or configure a custom tracing processor before running agents in production.

Does the SDK handle long-running or crash-prone workflows?

Not on its own. The SDK can pause a run and save it as RunState for later resumption, but it does not include durable execution or automatic crash recovery. Workflows that span extended periods or must survive process failures need an external engine such as Temporal or DBOS.

How is OpenAI Agents SDK different from LangGraph?

OpenAI Agents SDK uses a small set of agent-centric primitives (agents, handoffs, guardrails) and is optimized for OpenAI's ecosystem. LangGraph models workflows as explicit state graphs with nodes, edges, and durable checkpointing, and is designed for complex conditional workflows and time-travel debugging. The Agents SDK favors minimal abstraction and fast onboarding; LangGraph favors explicit control and production durability.

Alternative Tools

OpenAI Agents SDK hero image