back to home

openai / openai-agents-python

A lightweight, powerful framework for multi-agent workflows

19,442 stars
3,228 forks
72 issues
PythonShellMakefile

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing openai/openai-agents-python in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Source files are only loaded when you start an analysis to optimize performance.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind.in/repo/openai/openai-agents-python)
Preview:Analyzed by RepoMind

Repository Summary (README)

Preview

OpenAI Agents SDK

PyPI

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.

Image of the Agents Tracing UI

[!NOTE] Looking for the JavaScript/TypeScript version? Check out Agents SDK JS/TS.

Core concepts:

  1. Agents: LLMs configured with instructions, tools, guardrails, and handoffs
  2. Agents as tools / Handoffs: Delegating to other agents for specific tasks
  3. Tools: Various Tools let agents take actions (functions, MCP, hosted tools)
  4. Guardrails: Configurable safety checks for input and output validation
  5. Human in the loop: Built-in mechanisms for involving humans across agent runs
  6. Sessions: Automatic conversation history management across agent runs
  7. Tracing: Built-in tracking of agent runs, allowing you to view, debug and optimize your workflows
  8. 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:

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.