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

OpenAI Agents SDK v1.0.0-alpha.1:新增 Codex Provider

Agents SDK v1.0.0-alpha.1

原文
发到 X
推荐理由

v1.0 alpha 引入破坏性变更,旧版 Agent.run() 等接口已弃用,依赖此 SDK 的开发者必须立即检查代码并迁移至新的 Runner API,否则将无法正常运行。

Agents SDK v1.0.0-alpha.1

This first preview from feat/simple-codex adds Codex as an opt-in model provider for the Python Agents SDK. The prebuilt openai-agents wheels (version 1.0.0a1) are available exclusively through GitHub Releases.

本次来自 feat/simple-codex 的首次预览版将 Codex 添加为 Python Agents SDK 的可选模型提供商。预构建的 openai-agents wheel(版本 1.0.0a1)仅通过 GitHub Releases 提供。

Highlights

亮点

  • Choose Codex per run. Import CodexProvider from agents.models.codex and create provider = CodexProvider(). Pass RunConfig(model_provider=provider) to the Runner. Codex uses your saved login. For API key authentication, use CodexProvider(api_key=...). The provider selects the model for agents that use a model name or the default model. Run the same agent with either provider
  • Reuse Codex Core inside Python. The wheel embeds unmodified Codex Core rust-v0.166.0 through PyO3. Direct calls to Core eliminate codex app-server startup and JSON-RPC. Reuse the provider to share one ThreadManager across calls. Each call gets a fresh thread. Use an SDK session for history and close the provider with await provider.aclose() when you finish. Thread lifetime and history · Codex source
  • Use SDK tools and approvals. Stream text, hand off to a specialist, pause for approval before a Python tool runs, and validate typed output. Native commands follow Codex's sandbox and approval settings. A native approval prompt ends the model call. Execution and approvals · Supported tools and model settings
  • 按运行选择 Codex。从 agents.models.codex 导入 CodexProvider 并创建 provider = CodexProvider()。向 Runner 传递 RunConfig(model_provider=provider)。Codex 使用您保存的登录信息。对于 API 密钥认证,请使用 CodexProvider(api_key=...)。该提供商为使用模型名称或默认模型的代理选择模型。使用任一提供商运行相同的代理
  • 在 Python 中重用 Codex Core。wheel 通过 PyO3 嵌入了未经修改的 Codex Core rust-v0.166.0。对 Core 的直接调用消除了 codex app-server 启动和 JSON-RPC。重用提供商以在调用之间共享一个 ThreadManager。每次调用都会获得一个新线程。使用 SDK 会话进行历史记录,并在完成时使用 await provider.aclose() 关闭提供商。线程生命周期和历史记录 · Codex 源代码
  • 使用 SDK 工具和审批。流式传输文本、移交专家、在 Python 工具运行前暂停等待审批,以及验证类型化输出。原生命令遵循 Codex 的沙箱和审批设置。原生审批提示会结束模型调用。执行和审批 · 支持的工具和模型设置

Install and try it

安装并试用

Activate a virtual environment with standard CPython 3.10–3.14. Copy the link for your platform and replace WHEEL_URL in the command below. Each link includes the SHA-256 digest that pip checks when it downloads the wheel. Checksums for all four wheels

使用标准 CPython 3.10–3.14 激活虚拟环境。复制适用于您平台的链接,并替换下面命令中的 WHEEL_URL。每个链接都包含 SHA-256 摘要,pip 在下载 wheel 时会检查该摘要。所有四个 wheel 的校验和

Linux x86-64 (glibc 2.28+) · Linux ARM64 (glibc 2.28+) · macOS 11+ on Apple silicon · Windows x64

Linux x86-64 (glibc 2.28+) · Linux ARM64 (glibc 2.28+) · Apple silicon 上的 macOS 11+ · Windows x64

代码 · 1 行
python -m pip install --only-binary=:all: "WHEEL_URL"

To try the wildlife example, check out v1.0.0-alpha.1 and run the command below from the repository root with the wheel installed. If your only credential is a saved Codex login, set OPENAI_AGENTS_DISABLE_TRACING=1 in your shell first. Wildlife example · Authentication

要尝试野生动物示例,请检出 v1.0.0-alpha.1,并在安装了 wheel 的情况下从仓库根目录运行以下命令。如果您的唯一凭据是已保存的 Codex 登录信息,请先在 shell 中设置 OPENAI_AGENTS_DISABLE_TRACING=1。野生动物示例 · 身份验证

代码 · 1 行
python -I examples/model_providers/codex_provider.py --codex

Fixed

已修复

  • Automatic session compaction uses local conversation history for Codex, including after an approval pause. Compaction needs its own OpenAI client or credentials. Session compaction
  • Saved sandbox manifests preserve inline binary files when you resume a run. If you share these manifests, upgrade all readers before saving non-UTF-8 content. Use LocalFile when older SDKs need to read the manifest. Manifest compatibility
  • 自动会话压缩使用本地对话历史用于 Codex,包括在审批暂停之后。压缩需要其自己的 OpenAI 客户端或凭据。会话压缩
  • 保存的沙箱清单会在恢复运行时保留内联二进制文件。如果您共享这些清单,请在保存非 UTF-8 内容之前升级所有阅读器。如果旧版 SDK 需要读取清单,请使用 LocalFile。清单兼容性

Moving from the harness preview

从 harness 预览版迁移

If you use Agent.run() or Session.submit() in v0.24.0-alpha.8, move execution to Runner.run() or Runner.run_streamed() and select CodexProvider in your run config. If you use agents.classic, import Agent, Runner, and RunConfig from agents. Previous harness release · Runner example

如果你在 v0.24.0-alpha.8 中使用 Agent.run() 或 Session.submit(),请将执行迁移到 Runner.run() 或 Runner.run_streamed(),并在运行配置中选择 CodexProvider。如果你使用 agents.classic,请从 agents 导入 Agent、Runner 和 RunConfig。之前的 harness 版本 · Runner 示例

Finish pending native runs and approvals in your alpha.8 environment. Its SessionState checkpoints use a different format from the Runner's RunState. Start a fresh SDK session for conversation history in alpha.1. SDK sessions

在 alpha.8 环境中完成待处理的本地运行和审批。其 SessionState 检查点使用的格式与 Runner 的 RunState 不同。在 alpha.1 中为对话历史启动一个新的 SDK 会话。SDK 会话

Release verification

发布验证

The SDK suite passed on the merged feat/simple-codex commit. CI built all four wheels and tested fresh installs on CPython 3.10 and 3.14 on each platform. We verified all four downloads against SHA256SUMS. Source 87e8f533 · SDK tests · Wheel builds and installation checks

SDK 套件在合并 feat/simple-codex 提交后通过测试。CI 构建了所有四个 wheel 包,并在每个平台上针对 CPython 3.10 和 3.14 测试了全新安装。我们根据 SHA256SUMS 验证了所有四个下载文件。源码 87e8f533 · SDK 测试 · Wheel 构建和安装检查

We also ran the wildlife example with a live model and the Linux x86-64 wheel on CPython 3.12. The specialist identified an American bison from the photo, called the Python catalog tool, and returned a typed report with record ID synthetic-bison-001. Example and assertions

我们还使用实时模型和 Linux x86-64 wheel 包在 CPython 3.12 上运行了野生动物示例。专家系统从照片中识别出一头美洲野牛,调用了 Python catalog 工具,并返回了一份带有记录 ID synthetic-bison-001 的类型化报告。示例和断言

更进一步:量化金融体系

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

进入量化体系 →

相似阅读

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