Install v1 and run your first agent
Install v1, check that the embedded Codex runtime loads, and run the history tutor from the v0 quickstart. A release wheel contains the Python SDK and compiled Rust runtime. pip installs the matching helper binaries. Installing a wheel needs Python and pip, without a Rust toolchain or separate Codex CLI installation. Building from source requires additional tools.
1. Choose a Python environment
Use your project's Python environment with 64-bit CPython 3.10–3.14. If you are starting a new project, you can create and activate a virtual environment.
macOS or Linux
Windows PowerShell
2. Install v1
If you need v0 and v1 installed side by side, use separate environments. Both versions use the openai-agents distribution name, so installing v1 replaces v0 in that environment.
Open GitHub Releases and choose a v1 release whose examples import openai_agents. Earlier v1 releases use the old agents imports and cannot run this guide. If no compatible release exists, Linux x86-64 users can build from source, while other platforms need a matching release wheel.
Use the wheel for the system running Python.
| System | Platform tag |
|---|---|
| Linux x86-64, glibc 2.28 or newer | manylinux_2_28_x86_64 |
| Linux ARM64, glibc 2.28 or newer | manylinux_2_28_aarch64 |
| macOS 11 or newer, Apple Silicon | macosx_11_0_arm64 |
| Windows x64 | win_amd64 |
Copy the install command for your platform from the release notes and run it in your active environment. The command pins the wheel URL and SHA-256 digest. pip verifies the digest and installs the wheel and dependencies. An unpinned install by distribution name can still select v0.
Build from source
For a source build on Linux x86-64, install Git, Rust 1.99.1 or later with Cargo, a C/C++ compiler, CMake, pkg-config, and OpenSSL development headers. The build also needs access to GitHub, crates.io, and your Python package index. Choose a v1 tag or branch containing src/openai_agents/. Replace V1_REF with that ref. For example, use the v1-alpha branch. Run the following commands in your project environment.
git clone --depth 1 --branch V1_REF https://github.com/openai/openai-agents-python.git
cd openai-agents-python
python -m pip install .
This compiles the Rust extension. See the source build instructions for prerequisites and supported build steps.
3. Check the installation
This loads the native extension and prints the linked Codex runtime version, not the Agents SDK version. It needs no API key and makes no model request. If Python cannot find openai_agents, run python -m pip show openai-agents in the active environment and check the release or source ref you installed.
4. Run the tutor
Set OPENAI_API_KEY in your environment. Set OPENAI_MODEL to a model ID your project can use with Codex. For example, use export OPENAI_MODEL=gpt-5.4 in a POSIX shell or $env:OPENAI_MODEL = "gpt-5.4" in PowerShell.
Save this as tutor.py.
import asyncio
import os
from openai_agents import Agent, Runner
async def main():
tutor = Agent(
model=os.environ["OPENAI_MODEL"],
instructions="You answer history questions clearly and concisely.",
)
result = await Runner.run(tutor, "When did the Roman Empire fall?")
print(result.output_text)
if __name__ == "__main__":
asyncio.run(main())
Run python tutor.py. The tutor makes a billable model request and prints its answer. Codex runs the loop locally and calls the model over the network. This example grants no shell or file tools.
Next, give the agent a Python tool or compare the same call in v0 and v1.