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

OpenAI Agents SDK v0.24.0-alpha.6:破坏性 API 变更与新增会话控制

Agents SDK v0.24.0-alpha.6

原文
发到 X
推荐理由

v0.24.0-alpha.6 引入了多处破坏性 API 变更(如方法重命名、参数移除、对象不可变化),正在使用该 SDK 构建 Agent 应用的开发者必须立即检查代码并迁移,否则将无法编译或运行。

Install the preview

安装预览版

Use standard CPython 3.10–3.14 in a virtual environment. These wheels include the native runtime; no Rust toolchain or source build is needed. This preview is distributed through GitHub Releases, not PyPI.

在虚拟环境中使用标准 CPython 3.10–3.14。这些 wheel 包包含原生运行时;无需 Rust 工具链或源码构建。此预览版通过 GitHub Releases 分发,而非 PyPI。

Run the command for your platform:

运行适用于您平台的命令:

Linux x86_64 (glibc 2.39 or newer)

Linux x86_64(glibc 2.39 或更高版本)

代码 · 1 行
python -m pip install "https://github.com/openai/openai-agents-python/releases/download/v0.24.0-alpha.6/openai_agents-0.24.0a6-cp310-abi3-manylinux_2_39_x86_64.whl"

macOS 11 or newer on Apple Silicon

Apple Silicon 上的 macOS 11 或更高版本

代码 · 1 行
python -m pip install "https://github.com/openai/openai-agents-python/releases/download/v0.24.0-alpha.6/openai_agents-0.24.0a6-cp310-abi3-macosx_11_0_arm64.whl"

Windows x64

代码 · 1 行
python -m pip install "https://github.com/openai/openai-agents-python/releases/download/v0.24.0-alpha.6/openai_agents-0.24.0a6-cp310-abi3-win_amd64.whl"

Wheels are not provided for Intel Macs, ARM Linux, ARM Windows, Alpine/musl, PyPy or free-threaded Python. The cp310-abi3 filenames also support standard CPython 3.11–3.14.

不提供 Intel Mac、ARM Linux、ARM Windows、Alpine/musl、PyPy 或自由线程 Python 的 wheel 包。cp310-abi3 文件名也支持标准 CPython 3.11–3.14。

Check the installed version and native module:

检查已安装的版本和原生模块:

代码 · 1 行
python -c "from importlib.metadata import version; import agents._native; print(version('openai-agents'))"

Expect 0.24.0-alpha.6 or its equivalent Python packaging spelling, 0.24.0a6. SHA256SUMS contains checksums for all three wheels.

预期结果为 0.24.0-alpha.6 或其等效的 Python 打包写法 0.24.0a6。SHA256SUMS 包含所有三个 wheel 包的校验和。

Release notes

发布说明

Changes since 0.24.0-alpha.5. This preview expands conversation control, state recovery, and tool policies, and includes public API changes.

自 0.24.0-alpha.5 以来的更改。此预览版扩展了对话控制、状态恢复和工具策略,并包含公共 API 变更。

Added

新增

  • Control submitted work through a captured Turn, with get_result(), passive events(), manual request handling, steering, and cancellation. Queue prompts with Session.submit(..., if_busy="queue"), or steer the active Turn with if_busy="steer".
  • Add LocalStorage to reopen conversations from a local profile, and extend portable SessionState capture and recovery. Add idle forks, caller-supplied compaction summaries, and checks for feature support and checkpoint readiness. LocalStorage profiles cannot export portable checkpoints.
  • Add NativeOutput for native strict output and PromptedOutput for JSON validated in Python. Optional max_retries performs bounded corrections without tools or replaying the task. LocalStorage requires max_retries=0.
  • Handle live manual tool requests and resume supported pending requests from checkpoints. Add experimental external-job recovery through agents.experimental.deferred and an optional MCP Tasks adapter.
  • Select tools for each submission or model step within the Session's opening permissions. Add native web search, native child checklists, and native goals for local-storage Sessions.
  • Validate Python tool return annotations and add tool policies for inspecting arguments and results. Extend native MCP support with argument replacement, result transforms, and application-managed form and URL interactions over supported HTTP, stdio, and model WebSocket paths.
  • Add NetworkPolicy for native commands on supported Linux and macOS executors, subject to each platform's network and Unix socket limits. Manage remote executor lifetimes through an Environment supplied when opening a Session or running an Agent.
  • Enable native child approvals and form requests with NativeAgents(interactions=True). Children continue to share the Session's tools and application context.
  • Configure native OpenTelemetry export and inspect typed observations. NativeError now exposes available provider status codes, error codes, request IDs, and failure categories.
  • Test real SDK sessions and Python tools against local scripted responses with agents.testing.ScriptedResponses, without a live model or API key.
  • 通过捕获的 Turn 控制提交的工作,包括 get_result()、被动事件 events()、手动请求处理、转向和取消。使用 Session.submit(..., if_busy="queue") 将提示排队,或使用 if_busy="steer" 转向当前活动的 Turn。
  • 添加 LocalStorage 以从本地配置文件重新打开对话,并扩展便携式 SessionState 捕获和恢复功能。添加空闲分支(idle forks)、调用者提供的压缩摘要,以及功能支持和检查点就绪性检查。LocalStorage 配置文件无法导出便携式检查点。
  • 添加用于原生严格输出的 NativeOutput 和用于在 Python 中验证 JSON 的 PromptedOutput。可选的 max_retries 可在不使用工具或重放任务的情况下执行有界修正。LocalStorage 要求 max_retries=0。
  • 处理实时手动工具请求,并从检查点恢复支持的挂起请求。通过 agents.experimental.deferred 添加实验性的外部作业恢复功能,并提供可选的 MCP Tasks 适配器。
  • 在 Session 的初始权限范围内为每次提交或模型步骤选择工具。为本地存储 Session 添加原生网络搜索、原生子清单和原生目标。
  • 验证 Python 工具的返回类型注解,并添加工具策略以检查参数和结果。通过参数替换、结果转换以及在受支持的 HTTP、stdio 和模型 WebSocket 路径上由应用程序管理表单和 URL 交互,扩展原生 MCP 支持。
  • 添加 NetworkPolicy,以在受支持的 Linux 和 macOS 执行器上运行原生命令,同时受各平台网络和 Unix 套接字限制的管理。通过在打开 Session 或运行 Agent 时提供 Environment 来管理远程执行器的生命周期。
  • 使用 NativeAgents(interactions=True) 启用原生子代理审批和表单请求。子代理继续共享 Session 的工具和应用上下文。
  • 配置原生 OpenTelemetry 导出并检查类型化观测数据。NativeError 现在暴露可用的提供程序状态码、错误码、请求 ID 和故障类别。
  • 使用 agents.testing.ScriptedResponses,在没有真实模型或 API 密钥的情况下,针对本地脚本响应测试真实的 SDK Session 和 Python 工具。

API changes

API 变更

  • Use Agent.run() or Agent.run_sync() for one-shot calls; the redundant Runner aliases have been removed.
  • Replace Turn.wait() and Session.wait() with Turn.get_result() on the captured Turn.
  • Replace Session.interrupt() with Turn.cancel() for one root Turn or Session.cancel_all() for the whole Session.
  • Rename Subagent.submit() to Subagent.start(). Unify Python callbacks and manual tools under FunctionTool; remove the separate ManualTool declaration.
  • Agent declarations are immutable. Create a new Agent to change defaults, use with_output_type() for an output-type variant, or use supported idle Session updates for an open conversation.
  • Tool selection and Session updates cannot expand the permissions captured when the Session opened. Restored Sessions use current application tools, credentials, and policies.
  • 使用 Agent.run() 或 Agent.run_sync() 进行一次性调用;已移除冗余的 Runner 别名。
  • 在捕获的 Turn 上,用 Turn.get_result() 替换 Turn.wait() 和 Session.wait()。
  • 对于单个根 Turn,使用 Turn.cancel() 替换 Session.interrupt();对于整个 Session,使用 Session.cancel_all()。
  • 将 Subagent.submit() 重命名为 Subagent.start()。在 FunctionTool 下统一 Python 回调和手动工具;移除单独的 ManualTool 声明。
  • Agent 声明是不可变的。若要更改默认值,请创建新的 Agent;若需输出类型变体,请使用 with_output_type();若需开放式对话,请使用支持的空闲 Session 更新。
  • 工具选择和 Session 更新不能扩展 Session 打开时捕获的权限。恢复的 Session 使用当前的应用工具、凭据和政策。

Fixed

修复

  • Keep each captured Turn's result stable across accepted steering, native continuations, and later submissions. Preserve one-shot manual checkpoints, matching interaction replies, and output-repair state across supported save and restore boundaries.
  • Improve native child cancellation and Session cleanup. Stop native work when result policies expire, and preserve policy failure reasons when reporting root and child results.
  • Reject malformed Python tool result envelopes and preserve server errors through MCP result transforms. Support nested OpenAI extension forms and HTTP telemetry export with client certificates.
  • 确保每个捕获的 Turn 的结果在接受引导、原生延续和后续提交期间保持稳定。在支持的保存和恢复边界之间,保留一次性手动检查点、匹配的交互回复以及输出修复状态。
  • 改进原生子代理取消和 Session 清理。当结果策略过期时停止原生工作,并在报告根结果和子结果时保留策略失败原因。
  • 拒绝格式错误的 Python 工具结果信封,并通过 MCP 结果转换保留服务器错误。支持嵌套的 OpenAI 扩展表单以及带有客户端证书的 HTTP 遥测导出。

Documentation and examples

文档和示例

  • Move the preview source to the public repository. Refocus installation guidance on prebuilt wheels and move SDK build instructions to CONTRIBUTING.md.
  • Add examples for browser applications, AG-UI streaming, deferred jobs, evaluation, observability, and common application tasks. Remove migration guides from the preview documentation.
  • 将预览源代码移至公共仓库。重新聚焦于预构建 wheel 的安装指南,并将 SDK 构建说明移至 CONTRIBUTING.md。
  • 添加浏览器应用、AG-UI 流式传输、延迟作业、评估、可观测性以及常见应用任务的示例。从预览文档中移除迁移指南。

Build and installation checks

构建和安装检查

Source: 2808233a56c32c9d7bb8b4f3bc739fe86e5fc282. Wheels come from the successful Tests run.

源码:2808233a56c32c9d7bb8b4f3bc739fe86e5fc282。Wheels 来自成功的 Tests 运行。

Fresh-install checks passed on CPython 3.10 and 3.14 for Linux, macOS, and Windows: installation verification.

在 Linux、macOS 和 Windows 上的 CPython 3.10 和 3.14 上,全新安装检查已通过:安装验证。

更进一步:量化金融体系

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

进入量化体系 →

相似阅读

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