OpenAI Agents SDK v1.0.0-alpha.4 发布
OpenAI Agents SDK v1.0.0-alpha.4

OpenAI Agents SDK v1.0.0-alpha.4 发布,自定义指令可替换 Codex 基础提示词,支持在返回调用者前验证最终答案的 JSON Schema,并连接 MCP 服务器及使用 A2A 客户端。
OpenAI Agents SDK v1.0.0-alpha.4
Custom instructions now replace the Codex base prompt when supplied to Agent. When you omit instructions, the default prompt stays in place. Set instructions_mode="codex" to append your instructions to the base prompt as in alpha.3.
Highlights
- Validate final answers against JSON Schema before returning them to callers.
- Apply tool policies and defer individual function definitions. Let Codex recover from invalid arguments in the same turn for decorated functions without approval or an input transform.
- Connect MCP servers, including stdio servers running in sandboxes. Call another agent as a tool.
- Use the A2A client to contact approved endpoints and continue tasks that need more input.
- Store session checkpoints in Redis, filter conversation snapshots before storage, and trace streams with OpenTelemetry.
- Test offline with scripted Responses API replies and explore new sandbox examples.
Upgrade
- Replace deprecated Codex
Runnercalls withagent.run(). Omit the deprecatedAgent.name. - Replace
RealtimeRunnerwithagent.start(). - Upgrade all workers sharing a SQLite session database together.
For v0 applications, keep the Python loop by moving most agents imports to openai_agents.classic. Move Realtime imports to openai_agents.realtime. See the v1 import mapping.
Install
Install the compiled GitHub release wheel for your platform. The wheels support standard 64-bit CPython 3.10-3.14 and include the Codex runtime. No Rust toolchain is needed.
Use a virtual environment. Keep v0 in a separate environment because both versions use the openai-agents package name.
Choose your platform below. pip verifies the SHA-256 digest.
Linux x86-64 (glibc 2.28 or newer)
python -m pip install --only-binary=:all: "https://github.com/openai/openai-agents-python/releases/download/v1.0.0-alpha.4/openai_agents-1.0.0a4-cp310-abi3-manylinux_2_28_x86_64.whl#sha256=d2a45e49bae501d10a196b812ae3ba2b252be384e3e60891b9c51158fb7017e9"Linux ARM64 (glibc 2.28 or newer)
python -m pip install --only-binary=:all: "https://github.com/openai/openai-agents-python/releases/download/v1.0.0-alpha.4/openai_agents-1.0.0a4-cp310-abi3-manylinux_2_28_aarch64.whl#sha256=dd4589c1ebac43b76d4f85036725092fa153788fce28c5b993a26f46cf94014d"macOS 11 or newer on Apple Silicon
python -m pip install --only-binary=:all: "https://github.com/openai/openai-agents-python/releases/download/v1.0.0-alpha.4/openai_agents-1.0.0a4-cp310-abi3-macosx_11_0_arm64.whl#sha256=f70e1696a01c83a8082e8e3fed676022005681e6d1987e3d18a9fe77baf6dd6e"Windows x64
python -m pip install --only-binary=:all: "https://github.com/openai/openai-agents-python/releases/download/v1.0.0-alpha.4/openai_agents-1.0.0a4-cp310-abi3-win_amd64.whl#sha256=1295f9d12af5fbb447b6e71757a71a38513c7e8e6591a9336c00f32388d270b0"
Check the installation offline. This check is unbilled and requires no API key.
python -I -m openai_agents.codex
Expect Codex runtime version 0.172.0.
Run a history tutor
Set OPENAI_API_KEY to your OpenAI API key and OPENAI_MODEL to a Codex-compatible model available to your project.
Save this as tutor.py.
import asyncio import os from openai_agents import Agent async def main(): agent = Agent( model=os.environ["OPENAI_MODEL"], instructions="Answer history questions clearly.", ) prompt = "When did the Western Roman Empire fall?" result = await agent.run(prompt) print(result.output_text) asyncio.run(main())
Run the tutor to make a billable OpenAI Responses API request.
python tutor.py
Expect an answer mentioning 476 CE.
Release details
来源: OpenAI Agents SDK releases · github.com