OpenAI Agents SDK Documentation
Documentation for OpenAI's open source Python framework for building agents with a small set of concepts: agents with instructions and tools, handoffs between agents, guardrails on inputs and outputs, sessions for memory and built-in tracing. It also supports MCP tools, human-in-the-loop steps, and voice and realtime agents, and can work with other model providers. The docs are short enough to read in an evening, which makes them a good way to learn agent vocabulary.
29.7k
GitHub (openai/openai-agents-python) · Sept 2026
MIT
GitHub · Sept 2026
September 2026
GitHub · Sept 2026
Guide
AI & Machine Learning
OpenAI
Intermediate
Free
The core ideas
The SDK is deliberately small. Three primitives do most of the work:
- Agents: a model with instructions and tools.
- Handoffs: one agent passes control to another more suited to the task, such as a triage agent routing to a billing agent.
- Guardrails: checks that run on inputs and outputs, and can stop a run when something is wrong.
Around them are features you need in real applications:
- Function tools with schemas generated automatically from Python functions.
- Sessions for conversation memory across runs.
- Tracing built in, so you can see every model call, tool call and handoff.
- MCP support for using tools from Model Context Protocol servers.
- Human-in-the-loop steps for approvals.
- Voice, realtime and sandbox agents.
Install it with pip as the openai-agents package. It uses OpenAI's Responses API by default, and other providers can be plugged in through its model interfaces. The GitHub repository had about 29,700 stars as of September 2026, is MIT licensed, and was updated that month.
Why read the docs even if you use another framework
The docs are concise and well organised, so they are one of the quickest ways to learn the vocabulary shared by most agent frameworks: the agent loop, tools, handoffs, guardrails, tracing and memory. Once those concepts are clear, LangGraph, Microsoft Agent Framework and others become much easier to read.
A good path through them
- Quickstart: build a single agent with one function tool and run it.
- Agents and tools: understand how instructions, tools and structured output fit together.
- Handoffs: build a triage agent that routes to two specialists.
- Guardrails: add an input check that blocks off-topic or unsafe requests.
- Tracing: inspect the traces of your runs. This is how you will debug everything later.
- Sessions, MCP and human-in-the-loop when your use case needs them.
An evening covers steps 1 to 5; a weekend gets you a small working multi-agent app.
How it compares
- LangGraph gives more explicit control over state and flow as a graph, which suits complex, long-running workflows.
- This SDK is lighter and quicker to learn, with less ceremony for common patterns such as routing and tool use.
- Plain API calls are still fine for simple single-step tasks.
Before you start
You need comfortable Python, including async basics, and an API key for a model provider. Knowing what function calling is helps.
Common questions
Is it tied to OpenAI models? It works best with them, but other providers can be configured.
Is there a JavaScript version? OpenAI also publishes an Agents SDK for JavaScript and TypeScript; check the OpenAI developer docs.
Best for: Python developers who want a lightweight, well documented way to build agents, and anyone learning agent concepts quickly.
Ready to start?
Opens on OpenAI in a new tab.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
Follow along
New writing, resources and project ideas land here first.