Lightweight multi-agent orchestration framework by OpenAI. Production successor to Swarm. Provider-agnostic.
pip install openai-agentsVerified import paths — ran on the pinned version, not inferred.
Minimal single-agent run
pip install 'openai>=2.0.0' before installing openai-agents
Upgrade to Python 3.10+
Migrate to openai-agents. Primitives are similar but not identical.
Update type annotations: replace Agent with AgentBase where type errors appear
Update type annotations to FunctionTool where needed
Pin version if using RealtimeAgent in production. Use GA URL format for Azure.
No action needed unless you want WebSocket mode explicitly
Set the OPENAI_API_KEY environment variable (e.g., export OPENAI_API_KEY='your_key_here') or pass api_key argument to the OpenAI client constructor.
Ensure the package is installed with `pip install openai-agents` and then import using `from openai_agents import Agent, Runner` (or other specific modules) in your code. Also, check that no local file or directory is named 'agents.py' or 'agents' in your project path.
Upgrade the `openai` package to version 1.0.0 or newer (`pip install --upgrade openai`) and update your code to use the new client syntax, e.g., `from openai import OpenAI; client = OpenAI(); client.chat.completions.create(...)`.
Upgrade your `openai` package to version 1.0.0 or newer using `pip install --upgrade openai`.
Review and refine the agent's instructions to clearly define what constitutes a 'final response' and ensure the model has sufficient turns (`max_turns` parameter in `Runner.run`) to complete the task. Enable debug logging (`DEBUG=openai-agents:*`) to understand the agent's internal reasoning and identify where it deviates from producing a final output.