Compare v0 and v1
Both versions use the openai-agents distribution name. The import selects the runtime. A v0 release provides the Python agent loop, or harness, under agents. In v1, openai_agents runs the embedded Codex core. Classic, under openai_agents.classic, packages the v0 Python loop as a supported transition path. Classic is planned for removal in a future release. There is no agents alias in v1. Install v1 in a separate environment to try the same request with both versions.
The same tutor, side by side
Both examples use Runner.run. The import changes which code runs when you call it. Set OPENAI_API_KEY and OPENAI_MODEL in each environment as described in the quickstart.
Save either example as tutor.py and run python tutor.py in its environment. Each makes a billable request. To run the v0 example with the v1 wheel, change its import to from openai_agents.classic import Agent, Runner.
What changes when you choose Codex?
| Task | Python loop (v0) | Codex runtime (v1 default) |
|---|---|---|
| Define an agent | Agent(name=...) requires a name and can use a default model. |
Agent(model=...) requires a model ID. The name is optional. Instructions extend the Codex base instructions. |
| Run a turn | await Runner.run(agent, prompt) |
The same call, or await agent.run(prompt). |
| Read the answer | result.final_output can be text or a typed value. |
result.output_text is text or None. result.final_output returns the same value. |
| Register a function | Use a Python-loop tool, such as agents.function_tool. |
Use openai_agents.codex.function_tool. Register the function with the Codex agent. |
| Stream a turn | Runner.run_streamed(agent, prompt), then iterate over result.stream_events(). |
async with agent.stream(prompt) as events, then iterate over events. Use await events.get_final_result() for the result. The event types differ. |
| Continue a conversation | Pass a session to Runner.run or reuse result.to_input_list(). |
Open a Codex session for multiple turns, pass state=result.state to the next run, or resume by ID with Codex storage. |
Keep a workflow on the Python loop
Classic lets you move one workflow at a time. Support during v1.x focuses on major bugs and security fixes. For an existing v0 installation, the version menu takes you back to the v0 guides and their original imports. If you've installed v1, use the following paths for the Python APIs.
| v0 import | v1 import |
|---|---|
from agents import Agent, Runner |
from openai_agents.classic import Agent, Runner |
from agents import function_tool |
from openai_agents.classic import function_tool |
from agents.voice import VoicePipeline |
from openai_agents.classic.voice import VoicePipeline |
from agents.realtime import RealtimeAgent |
from openai_agents.realtime import RealtimeAgent |
Keep Classic tools with Classic and Realtime agents. If a workflow depends on Python model adapters, handoffs, guardrails, typed outputs, or tracing, you can keep it on Classic while you decide what to port. Classic also retains the experimental codex_tool that lets the Python runner delegate a task to the Codex CLI. With the v1 root import, Codex runs the whole conversation.
Changing imports doesn't convert tools or saved state. Keep existing sessions with their original loop and give new Codex conversations a separate store. See the full migration guide for optional dependencies and more import mappings, or follow a Codex tool call.