OpenAI Agents SDK
Project description
OpenAI Agents SDK 
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows. It is provider-agnostic, supporting the OpenAI Responses and Chat Completions APIs, as well as 100+ other LLMs.
[!NOTE] Looking for the JavaScript/TypeScript version? Check out Agents SDK JS/TS.
Core concepts:
- Agents: LLMs configured with instructions, tools, guardrails, and handoffs
- Agents as tools / Handoffs: Delegating to other agents for specific tasks
- Tools: Various Tools let agents take actions (functions, MCP, hosted tools)
- Guardrails: Configurable safety checks for input and output validation
- Human in the loop: Built-in mechanisms for involving humans across agent runs
- Sessions: Automatic conversation history management across agent runs
- Tracing: Built-in tracking of agent runs, allowing you to view, debug and optimize your workflows
- Realtime Agents: Build powerful voice agents with full features
Explore the examples directory to see the SDK in action, and read our documentation for more details.
Get started
To get started, set up your Python environment (Python 3.10 or newer required), and then install OpenAI Agents SDK package.
venv
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install openai-agents
For voice support, install with the optional voice group: pip install 'openai-agents[voice]'. For Redis session support, install with the optional redis group: pip install 'openai-agents[redis]'.
uv
If you're familiar with uv, installing the package would be even easier:
uv init
uv add openai-agents
For voice support, install with the optional voice group: uv add 'openai-agents[voice]'. For Redis session support, install with the optional redis group: uv add 'openai-agents[redis]'.
Run your first agent
from agents import Agent, Runner
agent = Agent(name="Assistant", instructions="You are a helpful assistant")
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")
print(result.final_output)
# Code within the code,
# Functions calling themselves,
# Infinite loop's dance.
(If running this, ensure you set the OPENAI_API_KEY environment variable)
(For Jupyter notebook users, see hello_world_jupyter.ipynb)
Explore the examples directory to see the SDK in action, and read our documentation for more details.
Acknowledgements
We'd like to acknowledge the excellent work of the open-source community, especially:
- Pydantic (data validation) and PydanticAI (advanced agent framework)
- LiteLLM (unified interface for 100+ LLMs)
- MkDocs
- Griffe
- uv and ruff
We're committed to continuing to build the Agents SDK as an open source framework so others in the community can expand on our approach.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openai_agents-0.12.2.tar.gz.
File metadata
- Download URL: openai_agents-0.12.2.tar.gz
- Upload date:
- Size: 2.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1746d8c35b6210174d739686fd4f375c2da7982a6938e80e8c146cfb96a342f
|
|
| MD5 |
f47628b1e9f3ac0569b84d33a2b79ce4
|
|
| BLAKE2b-256 |
13fef831651e2e081fd93565383e799ab9f3dcca2f5b8e8ff545a27a314f8be8
|
Provenance
The following attestation bundles were made for openai_agents-0.12.2.tar.gz:
Publisher:
publish.yml on openai/openai-agents-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openai_agents-0.12.2.tar.gz -
Subject digest:
d1746d8c35b6210174d739686fd4f375c2da7982a6938e80e8c146cfb96a342f - Sigstore transparency entry: 1099143456
- Sigstore integration time:
-
Permalink:
openai/openai-agents-python@d216493ed1f06e07643b52bfed88c683bcf8b2e5 -
Branch / Tag:
refs/tags/v0.12.2 - Owner: https://github.com/openai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d216493ed1f06e07643b52bfed88c683bcf8b2e5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file openai_agents-0.12.2-py3-none-any.whl.
File metadata
- Download URL: openai_agents-0.12.2-py3-none-any.whl
- Upload date:
- Size: 449.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56f760fabe1062d87124746748ff51f7e2ed3a843eb3938224a499e95dd60344
|
|
| MD5 |
b0bc935653f48a870d0c2f75886bfa99
|
|
| BLAKE2b-256 |
a949285ea5d15bac82a03eae1167ae69d871edfe08ed596d18dbb73bef018137
|
Provenance
The following attestation bundles were made for openai_agents-0.12.2-py3-none-any.whl:
Publisher:
publish.yml on openai/openai-agents-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openai_agents-0.12.2-py3-none-any.whl -
Subject digest:
56f760fabe1062d87124746748ff51f7e2ed3a843eb3938224a499e95dd60344 - Sigstore transparency entry: 1099143517
- Sigstore integration time:
-
Permalink:
openai/openai-agents-python@d216493ed1f06e07643b52bfed88c683bcf8b2e5 -
Branch / Tag:
refs/tags/v0.12.2 - Owner: https://github.com/openai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d216493ed1f06e07643b52bfed88c683bcf8b2e5 -
Trigger Event:
release
-
Statement type: