跳到主内容
@wquguru
精选85OpenAI Agents SDK Python(GitHub Releases)AI 编程与模型

OpenAI Agents SDK v1.0.0-alpha.3:默认切换Codex,弃用旧别名

OpenAI Agents SDK v1.0.0-alpha.3

原文
发到 X
推荐理由

依赖 OpenAI Agents SDK 的开发者必须注意:v1.0.0-alpha.3 已移除根级 agents 别名并默认启用 Codex,旧版 import 路径将直接报错。请检查代码中的 Agent/Runner 导入位置,并按文档调整至 openai_agents.classic 或 openai_agents 新命名空间。

OpenAI Agents SDK v1.0.0-alpha.3

Build agents in Python with the Codex harness. This release runs the same agent loop as the Codex CLI inside your Python process. Your application supplies tools, access checks, approvals, and storage.

使用 Codex 框架在 Python 中构建智能体。此版本在您的 Python 进程中运行与 Codex CLI 相同的智能体循环。您的应用程序提供工具、访问检查、审批和存储。

What's changed

变更内容

  • from openai_agents import Agent, Runner now selects Codex. The wheel includes the compiled engine.
  • Existing Python workflows can use openai_agents.classic, including Voice and Python model adapters. Use openai_agents.realtime for speech-to-speech applications.
  • Codex agents can react to tool results, compact long conversations, and resume saved checkpoints on another worker.
  • Unlike alpha.2, this release uses the openai_agents namespace and always runs Codex from the root API. There is no agents alias or provider switch at the root.
  • from openai_agents import Agent, Runner 现在选择 Codex。该 wheel 包含编译后的引擎。
  • 现有的 Python 工作流可以使用 openai_agents.classic,包括语音和 Python 模型适配器。对于语音到语音的应用程序,请使用 openai_agents.realtime。
  • Codex 智能体可以响应工具结果、压缩长对话,并在另一个工作节点上恢复保存的检查点。
  • 与 alpha.2 不同,此版本使用 openai_agents 命名空间,并且始终从根 API 运行 Codex。根级别没有 agents 别名或提供商切换。

Install

安装

This GitHub-only prerelease provides four platform wheels and SHA256SUMS, as alpha.2 did. It is not published to PyPI.

此仅限 GitHub 的预发布版本提供了四个平台 wheel 文件和 SHA256SUMS,正如 alpha.2 所做的那样。它未发布到 PyPI。

Use a standard 64-bit CPython 3.10 through 3.14 environment. Run the command for your platform. Each command pins the wheel and its SHA-256 digest, which pip checks before installation.

使用标准的 64 位 CPython 3.10 至 3.14 环境。运行适用于您平台的命令。每个命令都固定了 wheel 及其 SHA-256 摘要,pip 会在安装前进行检查。

Linux x86-64 (glibc 2.28 or newer)

Linux x86-64(glibc 2.28 或更高版本)

代码 · 1 行
python -m pip install --only-binary=:all: "https://github.com/openai/openai-agents-python/releases/download/v1.0.0-alpha.3/openai_agents-1.0.0a3-cp310-abi3-manylinux_2_28_x86_64.whl#sha256=69aa2d66eb0fa87e480e6e563adb6e4b3676e004c1387833dbb27cf0f1e2d2d8"

Linux ARM64 (glibc 2.28 or newer)

Linux ARM64(glibc 2.28 或更高版本)

代码 · 1 行
python -m pip install --only-binary=:all: "https://github.com/openai/openai-agents-python/releases/download/v1.0.0-alpha.3/openai_agents-1.0.0a3-cp310-abi3-manylinux_2_28_aarch64.whl#sha256=476146114344b2495cbd29e74dc9e42f225639575b0fb1af37ea4dcfa1e7c896"

macOS 11 or newer on Apple Silicon

Apple Silicon 上的 macOS 11 或更高版本

代码 · 1 行
python -m pip install --only-binary=:all: "https://github.com/openai/openai-agents-python/releases/download/v1.0.0-alpha.3/openai_agents-1.0.0a3-cp310-abi3-macosx_11_0_arm64.whl#sha256=cceaac9e998f590f91fd37e2292d807e246c3af1f24fbb49c3530f120c279ade"

Windows x64

代码 · 1 行
python -m pip install --only-binary=:all: "https://github.com/openai/openai-agents-python/releases/download/v1.0.0-alpha.3/openai_agents-1.0.0a3-cp310-abi3-win_amd64.whl#sha256=a23ef9969f083da80b3ec0d36f2f5451687da57f1ba0ccb40fb2887d0e6e37a9"

For environment setup, optional dependencies, or source builds, see the installation guide. An unpinned install by distribution name can select v0.

有关环境设置、可选依赖项或源码构建,请参阅安装指南。按发行版名称进行未固定版本的安装可以选择 v0。

Run a first turn

运行首次交互

Set OPENAI_API_KEY and OPENAI_MODEL in your environment. Use a model ID available to your project. Save this as first_turn.py.

在环境中设置 OPENAI_API_KEY 和 OPENAI_MODEL。使用您的项目可用的模型 ID。将其保存为 first_turn.py。

代码 · 8 行
import asyncio
import os
from openai_agents import Agent, Runner
async def main():
    agent = Agent(model=os.environ["OPENAI_MODEL"])
    result = await Runner.run(agent, "Pick a neighborhood in Lisbon.")
    print(result.output_text)
asyncio.run(main())

Run python first_turn.py to print the reply. The request is billable.

运行 python first_turn.py 以打印回复。该请求会产生费用。

Migrate an existing workflow

迁移现有工作流

  • To keep the Python loop, change from agents import Agent, Runner to from openai_agents.classic import Agent, Runner.
  • Move Realtime imports to openai_agents.realtime. Voice remains under Classic.
  • To use Codex, import Agent and Runner from openai_agents and Codex tools from openai_agents.codex. Read result.output_text instead of Classic's result.final_output.
  • Test in a separate environment. Code and saved conversations do not migrate automatically. Keep existing conversations on their original loop until you have verified compatibility.
  • 若要保留 Python 循环,请将 from agents import Agent, Runner 更改为 from openai_agents.classic import Agent, Runner。
  • 将 Realtime 导入移至 openai_agents.realtime。Voice 仍位于 Classic 下。
  • 要使用 Codex,请从 openai_agents 导入 Agent 和 Runner,并从 openai_agents.codex 导入 Codex 工具。读取 result.output_text 而不是 Classic 的 result.final_output。
  • 在独立环境中进行测试。代码和保存的对话不会自动迁移。在验证兼容性之前,请将现有对话保留在其原始循环中。

For Classic imports, copy the migration prompt. Compare v0 and v1 to choose a migration path, or start with the v1 documentation for more examples.

对于 Classic 导入,请复制迁移提示。比较 v0 和 v1 以选择迁移路径,或者从 v1 文档开始以获取更多示例。

Release build

Release 构建

Build and install checks

构建与安装检查

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件