OpenAI Agents SDK
The OpenAI Agents SDK is a lightweight, provider-agnostic Python framework for building multi-agent workflows. It provides agents, handoffs, guardrails, tools, sessions, tracing, and support for realtime and voice agents.
Visit openai/openai-agents-pythonOverview
The OpenAI Agents SDK is a production-ready upgrade of Swarm, OpenAI's previous experimentation for agents. It is a lightweight, Python-first framework for building agentic AI apps with very few abstractions, including agents, handoffs, guardrails, sessions, tracing, and sandbox, realtime, and voice agent capabilities.
Key Features
- Agents configured with instructions, tools, guardrails, and handoffs, with a built-in loop that continues until the task is complete.
- Agents as tools and handoffs for delegating work across multiple agents.
- Guardrails for input and output validation that run in parallel with agent execution.
- Function tools, MCP server tool calling, hosted tools, and automatic schema generation with Pydantic-powered validation.
- Sandbox agents, realtime agents, and voice pipelines for isolated workspaces, low-latency voice, and speech-to-text/agent/text-to-speech workflows.
- Sessions for persistent memory and automatic conversation history, plus built-in tracing for visualizing, debugging, and monitoring agentic workflows.
Use Cases
- Building multi-agent workflows that coordinate and delegate work across multiple agents.
- Running coding, review, or document agents inside real isolated sandbox workspaces.
- Building low-latency realtime voice agents and speech-to-text/agent/text-to-speech pipelines.
- Adding guardrails, sessions, tracing, and human-in-the-loop controls to agentic applications.
Getting Started
- Set up a Python environment with Python 3.10 or newer.
- Install the package with pip install openai-agents.
- Set the OPENAI_API_KEY environment variable.
- Create an Agent with instructions and run it with Runner.run_sync.
Deployment & Requirements
- Python 3.10 or newer is required.
- Set the OPENAI_API_KEY environment variable before running examples.
- For voice support, install the optional voice group with pip install 'openai-agents[voice]'.
- For Redis session support, install the optional redis group with pip install 'openai-agents[redis]'.
Before You Adopt
- License: MIT. Review its terms before using, modifying, or distributing the project.
- Requires Python 3.10 or newer.
- The library has optional dependencies including websockets, SQLAlchemy, any-llm, and LiteLLM for additional functionality.
- External contributions are limited: pull requests are accepted only from repository collaborators.