https://github.com/openai/openai-agents-python
A lightweight, powerful framework for multi-agent workflows
https://github.com/openai/openai-agents-python
agents ai framework llm openai python
Last synced: 1 day ago
JSON representation
A lightweight, powerful framework for multi-agent workflows
- Host: GitHub
- URL: https://github.com/openai/openai-agents-python
- Owner: openai
- License: mit
- Created: 2025-03-11T03:42:36.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-04-29T16:30:55.000Z (10 months ago)
- Last Synced: 2025-04-29T17:31:39.123Z (10 months ago)
- Topics: agents, ai, framework, llm, openai, python
- Language: Python
- Homepage: https://openai.github.io/openai-agents-python/
- Size: 4.47 MB
- Stars: 9,631
- Watchers: 132
- Forks: 1,268
- Open Issues: 149
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ai-agents - OpenAI Agents (Python) - agents-python) | Lightweight, provider-agnostic agent framework | (🚀 Specialized Agents / 🗣️ Programming Language Agents)
- awesome-openclaw-money-maker - **OpenAI Agents Python** - OpenAI's lightweight, powerful framework for multi-agent workflows. (AI Agent Frameworks / General Agent Frameworks)
- awesome-ChatGPT-repositories - openai-agents-python - A lightweight, powerful framework for multi-agent workflows (NLP)
- Awesome-Vibe-Coding - OpenAI Agents SDK
- StarryDivineSky - openai/openai-agents-python - agents-python是一个轻量级且强大的多智能体工作流框架。它旨在简化构建复杂的多智能体系统的过程,允许开发者轻松创建和协调多个智能体之间的交互。该框架的核心优势在于其灵活性和可扩展性,可以适应各种不同的应用场景。通过该框架,开发者可以定义智能体的角色、目标和行为,并设计它们之间的通信协议。该项目提供了丰富的工具和示例,帮助开发者快速上手并构建自己的多智能体应用。它支持各种不同的智能体类型,包括基于语言模型的智能体和基于规则的智能体。该框架还提供了强大的调试和监控功能,方便开发者诊断和优化智能体系统的性能。总之,openai/openai-agents-python为开发者提供了一个高效且易用的平台,用于构建和部署复杂的多智能体系统。 (A01_文本生成_文本对话 / 大语言对话模型及数据)
- awesome-generative-ai-data-scientist - OpenAI Agents - agent workflows. | [GitHub](https://github.com/openai/openai-agents-python) | (LLM Providers)
- AiTreasureBox - openai/openai-agents-python - 11-03_17019_1](https://img.shields.io/github/stars/openai/openai-agents-python.svg)|A lightweight, powerful framework for multi-agent workflows| (Repos)
- awesome-hacking-lists - openai/openai-agents-python - A lightweight, powerful framework for multi-agent workflows (Python)
- awesome-data-analysis - openai-agents-python - Official OpenAI framework for building AI agents. (🧠 AI Applications & Platforms / Tools)
- awesome-ai-agents - openai/openai-agents-python - The OpenAI Agents SDK is a lightweight and powerful framework for building, orchestrating, and tracing multi-agent workflows using large language models with configurable instructions, tools, and safety features. (AI Agent Frameworks & SDKs / Multi-Agent Collaboration Systems)
- Awesome-LLMOps - OpenAI Agents SDK - agent workflows.    (Orchestration / Agent Framework)
- awesome-production-genai - OpenAI Agents SDK - agents-python.svg?cacheSeconds=86400) - 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. (Agent Development)
- awesome - openai/openai-agents-python - A lightweight, powerful framework for multi-agent workflows (<a name="Python"></a>Python)
- Awesome-Prompt-Engineering - GitHub
- awesome-local-llm - openai-agents-python - a lightweight, powerful framework for multi-agent workflows (Tools / Agent Frameworks)
- awesome-workflow-automation - OpenAI Agents SDK - agent workflows. Provider-agnostic (100+ LLMs), built-in tracing and guardrails. Released March 2025. (🧩 Agent Frameworks & Dev Libraries / Multi-Agent Orchestration)
README
# OpenAI Agents SDK [](https://pypi.org/project/openai-agents/)
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](https://github.com/openai/openai-agents-js).
### Core concepts:
1. [**Agents**](https://openai.github.io/openai-agents-python/agents): LLMs configured with instructions, tools, guardrails, and handoffs
1. **[Agents as tools](https://openai.github.io/openai-agents-python/tools/#agents-as-tools) / [Handoffs](https://openai.github.io/openai-agents-python/handoffs/)**: Delegating to other agents for specific tasks
1. [**Tools**](https://openai.github.io/openai-agents-python/tools/): Various Tools let agents take actions (functions, MCP, hosted tools)
1. [**Guardrails**](https://openai.github.io/openai-agents-python/guardrails/): Configurable safety checks for input and output validation
1. [**Human in the loop**](https://openai.github.io/openai-agents-python/human_in_the_loop/): Built-in mechanisms for involving humans across agent runs
1. [**Sessions**](https://openai.github.io/openai-agents-python/sessions/): Automatic conversation history management across agent runs
1. [**Tracing**](https://openai.github.io/openai-agents-python/tracing/): Built-in tracking of agent runs, allowing you to view, debug and optimize your workflows
1. [**Realtime Agents**](https://openai.github.io/openai-agents-python/realtime/quickstart/): Build powerful voice agents with full features
Explore the [examples](https://github.com/openai/openai-agents-python/tree/main/examples) directory to see the SDK in action, and read our [documentation](https://openai.github.io/openai-agents-python/) 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
```bash
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](https://docs.astral.sh/uv/), installing the package would be even easier:
```bash
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
```python
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](https://github.com/openai/openai-agents-python/blob/main/examples/basic/hello_world_jupyter.ipynb)_)
Explore the [examples](https://github.com/openai/openai-agents-python/tree/main/examples) directory to see the SDK in action, and read our [documentation](https://openai.github.io/openai-agents-python/) for more details.
## Acknowledgements
We'd like to acknowledge the excellent work of the open-source community, especially:
- [Pydantic](https://docs.pydantic.dev/latest/) (data validation) and [PydanticAI](https://ai.pydantic.dev/) (advanced agent framework)
- [LiteLLM](https://github.com/BerriAI/litellm) (unified interface for 100+ LLMs)
- [MkDocs](https://github.com/squidfunk/mkdocs-material)
- [Griffe](https://github.com/mkdocstrings/griffe)
- [uv](https://github.com/astral-sh/uv) and [ruff](https://github.com/astral-sh/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.