GPTMap

openai-python 3.54–3.55 与 openai-node 7.59–7.60:Live 会话 MCP 工具配置落地,Managed Agents 预算事件先增后删

Live 的 Responses 委派工具从空壳补齐 11 个 MCP 字段(server_url、require_approval、allowed_tools 等);budget_reached 状态与预算事件在 3.54.0/7.59.0 刚进类型、下一个特性版即整批移除;node 侧另落独立 CSAM moderation 类型。

TL;DR
SDK 双包五版(python v3.54.0→v3.55.1、node v7.59.0→v7.60.0;11-20 核对)。Live 委派工具 ToolMcp/Mcp 补齐 11 字段(writeOnly authorization/headers、require_approval 等;connector_id 2026-09-01 后模型弃用)。预算事件:v3.54.0/v7.59.0 类型化(status 加 budget_reached 与 agent.session.budget_reached 事件),v3.55.0/v7.60.0 整批收回(status 回四值,事件、双侧 spend_control、session_budget_exceeded 均删)。node v7.60.0 另落独立 CSAM moderation 类型;python 仅 OpenAPI 参考层。
openai-python v3.54.0–v3.55.1 与 openai-node v7.59.0–v7.60.0 是 2026-11-17 深夜至 11-18(UTC)发布的三个 python 版本与两个 node 版本:Live 会话的 MCP 工具配置在本批从占位类型变成完整字段面,Managed Agents 的预算事件与支出控制类型则走了一条先类型化、再整批移除的两步路线,node 侧另首次落地独立的 CSAM moderation 类型。全部结论出自本站当次的 PR diff 与 tag 源码提取。

官方 SDK 双包在 2026-11-17 深夜到 11-18(UTC)交出两线五版:python 走 v3.54.0→v3.55.0→v3.55.1,node 走 v7.59.0→v7.60.0。三件事值得逐项记录——Live 会话的 MCP 工具配置从占位类型补成完整字段面;Managed Agents 的预算事件类型走了一条罕见的先增后删路线(一个版本刚进类型、下一个特性版整批移除);node 侧首次落地独立的 CSAM moderation 类型而 python 只更新了 OpenAPI 参考文档。全部结论出自本站当次的 GitHub release 对象、PR diff(#4280/#4284/#4289/#3160/#3162/#3166/#3167)与 v3.54.0 / v3.55.0 / v7.59.0 / v7.60.0 四个 tag 的源码提取,2026-11-20 核对。

1. 版本与时间线

包版本GitHub(UTC)registry(UTC)备注
openai-pythonv3.54.02026-11-17T22:42:56ZPyPI 22:43:49Z(后 53 秒)#4284 budget events 类型
openai-nodev7.59.02026-11-17T22:42:24Znpm 22:54:03Z(后 11 分 39 秒)#3162 同标题,与 python 3.54.0 同分钟发布
openai-pythonv3.55.02026-11-18T05:21:54ZPyPI 05:22:42Z(后 48 秒)#4280 Live MCP 配置 + #4289 hide budget
openai-pythonv3.55.12026-11-18T16:04:26ZPyPI 16:05:17Z(后 51 秒)chore 版:#4290 文档化 CSAM 响应字段
openai-nodev7.60.02026-11-18T16:06:00Znpm 16:16:53Z(后 10 分 53 秒)#3160 + #3166 + #3167

python 与 node 在 11-17 深夜几乎同分钟各发一版(22:42:56 与 22:42:24),又是 11-18 下午同时收尾——双包同步节奏延续 11 月以来的形态。批次收尾时 PyPI latest 为 v3.55.1、npm latest 为 v7.60.0;2026-11-20 复核:UTC 11-19 晚双包已各收一版——openai-python 3.56.0(GitHub 2026-11-19T20:56:27Z / PyPI 20:57:13Z 上架)与 openai-node 7.61.0(GitHub 20:57:15Z / npm 21:07:25Z),两版 release notes 均仅一条(gpt-live-1.1 进 Live 模型档),本站 tag 实测两版的 ToolMcp/Mcp 11 字段与四值 status 原样保留、无 budget 类型回场——升级目标相应指向 3.56.0 / 7.61.0。

2. Live MCP 工具配置:从空壳到 11 字段

Live API 的 Responses 委派(delegation type 为 responses)里,工具数组的 MCP 项此前只是一个占位类型。基线对照(tag 实测):python v3.54.0 的 ToolMcp 与 node v7.59.0 的 Mcp 都只有 type: Literal["mcp"] / type: 'mcp' 一行。v3.55.0 / v7.60.0 起补齐 11 个字段(python 四个文件同步:responses_delegation_config.py、responses_delegation_config_param.py、responses_delegation_update_config.py、responses_delegation_update_config_param.py;node 在 live.ts 的两处 Mcp 接口同步):

# openai-python v3.55.0 tag,src/openai/types/live/responses_delegation_config.py(节选)
class ToolMcp(BaseModel):
    type: Literal["mcp"]

    allowed_callers: Optional[List[Literal["direct", "programmatic"]]] = None
    """The tool invocation context(s)."""

    allowed_tools: Optional[ToolMcpAllowedTools] = None
    """A list of MCP tool names that are allowed for this server."""

    authorization: Optional[str] = None
    """This value is omitted from returned Live session data."""

    connector_id: Optional[str] = None
    """The ID of a built-in MCP connector.

    This field is deprecated for models released after September 1, 2026. Use
    `server_url` to connect to a remote MCP server, or `tunnel_id` to connect to a
    local MCP server.
    """

    defer_loading: Optional[bool] = None
    """Whether this MCP tool should be deferred and discovered via tool search."""

    headers: Optional[Dict[str, str]] = None
    """Optional HTTP headers to send when connecting to the MCP server."""

    require_approval: Optional[ToolMcpRequireApproval] = None
    """Controls which MCP tools require explicit user approval before execution."""

    server_description: Optional[str] = None
    """An optional human-readable description of the MCP server."""

    server_label: Optional[str] = None
    """A label used to identify the MCP server."""

    server_url: Optional[str] = None
    """The URL of the MCP server to connect to."""

    tunnel_id: Optional[str] = None
    """The Secure MCP Tunnel ID to use instead of a direct server URL."""

三个子形状(当次提取照录):

  • allowed_tools 二选一:工具名字符串列表,或过滤器对象 ToolMcpAllowedToolsLiveMCPToolFilterParam(read_only 布尔 + tool_names 名称列表)。
  • require_approval 三选一:字面量 "always" / "never",或过滤器对 ToolMcpRequireApprovalLiveMCPRequireApprovalFilterParam(always 为强制批准过滤器、never 为跳过批准过滤器,两者各自可用 read_only + tool_names 组合)。
  • authorization 与 headers 是 writeOnly:OpenAPI 层两者都标 writeOnly、文档串注明 This value is omitted from returned Live session data——写进请求可以,出现在返回的会话数据里不行。

server_label 有格式约束:OpenAPI 层 pattern ^[A-Za-z][A-Za-z0-9_-]*$、最长 128。connector_id 的弃用措辞(对 2026-09-01 之后发布的模型弃用,改用 server_url 或 tunnel_id)与本站 2026-09-18 批次记录的 Responses 侧 MCP connector_id 弃用口径一致(措辞相同),本批把它带进了 Live 委派的类型面。SDK 自带的传输测试(python test_mcp_transport.py / node mcp-transport.test.ts,均随本批新增)把 MCP 字段经 session.delegation.responses.tools 往返验证,说明这批字段在会话事件流里可用而不仅在请求侧。

3. Managed Agents 预算事件:一个版本进、一个版本删

这是本批最值得记录的类型面动向,两步节奏在两包完全同步:

第一步(v3.54.0 / v7.59.0,#4284 / #3162「type Managed Agents budget events」):

  • AgentSession.status 联合从四值扩为五值:idle / in_progress / requires_action / failed / budget_reached;
  • 新增事件类型 AgentSessionBudgetReachedEvent,type 字面量 agent.session.budget_reached,文档串口径 Emitted when a session pauses because its spending limit was reached(python 侧带 event_id、session、obfuscation 字段);
  • 响应侧 SpendControl.limit 从必填 int 改为 Optional[int](文档串:The configured positive limit in USD cents, or null when unlimited),外层文档串改写为 Present when spending-control visibility is enabled; limit is null without a cap. Older server responses may omit this object.——spend_control 设置本身是 2026-10-31 批(v3.42.0 / v7.46–7.47)引入的,本批改的是响应语义。

第二步(v3.55.0 / v7.60.0,#4289 / #3166「hide Managed Agents session budget controls and events」)——上面每一条都被收回:

  • status 回四值(python v3.55.0 与 node v7.60.0 tag 实测均无 budget_reached);
  • AgentSessionBudgetReachedEvent 删除:python 的 beta/init.py 零处导出、agent_session_budget_reached_event.py 文件在 v3.55.0 tag 已 404;node 的 agents.ts 接口与事件联合项移除;
  • AgentSession 响应侧的 spend_control 字段与 SpendControl 类型删除;
  • 请求侧 spend_control 参数一并删除:python 的 session_create_params.py / session_update_params.py 在 v3.55.0 tag 零处出现,node 的 sessions.ts 同——2026-10-31 批引入的会话支出上限设置就此整体退场;
  • session_turn_error 的错误码枚举移除 session_budget_exceeded(该码在 v3.53.0 / v3.54.0 tag 均在);
  • 残留:node 的 lib 层 helpers(src/lib/beta/agents/agent-turn-result-collector.ts 与 src/lib/agents/turn-state.ts)仍保留对 agent.session.budget_reached 的字符串比较分支——类型已删、比较代码还在。
# 状态对照(tag 实测)
# v3.53.0 / v3.54.0:status 四值 + session_budget_exceeded 错误码在列
# v3.54.0:status 五值(+budget_reached)、AgentSessionBudgetReachedEvent 新增
# v3.55.0:status 四值、事件类型文件 404、spend_control 请求/响应双侧零处、session_budget_exceeded 删除

为什么删,PR 正文给了官方口径:#4289/#3166 的 Summary 称这批类型是 alpha budget API——The SDK has been exposing Managed Agents session budget controls as public types. This update removes the alpha budget API from those types——并定性为 alpha breaking change for a minor release、写明 There is no replacement typed budget API in this release(依赖方应留在旧版直至移除引用);该 PR 还一并收编了更窄的 turn-error code 移除(python #4288 / node #3165,即上一条清单里的 session_budget_exceeded 删除)。两包 release notes 的一行标题(hide…)未承载这些内容。对依赖方的可执行结论:不要把 budget_reached 或 spend_control 写进生产代码——前者类型已不存在,后者参数已不存在,且官方明示本版没有替代的 typed budget API。

4. CSAM moderation:node 独立类型,python 只到 OpenAPI 文档层

node v7.60.0 的 #3167「add standalone CSAM moderation types」在 src/resources/moderations.ts 落了真正的独立资源类型(tag 实测):

// openai-node v7.60.0,src/resources/moderations.ts(节选)
export interface CsamModeration {
  flagged: boolean; // Whether either CSAM category was flagged.
  categories: CsamModeration.Categories;
  category_applied_input_types: CsamModeration.CategoryAppliedInputTypes;
  category_scores: CsamModeration.CategoryScores;
}

export namespace CsamModeration {
  export interface Categories {
    'likely-csam': boolean;
    'likely-csam/gen-ai': boolean;
  }
  export interface CategoryAppliedInputTypes {
    'likely-csam': Array<'image'>;
    'likely-csam/gen-ai': Array<'image'>;
  }
  // CategoryScores 同形,值为 number
}

export interface CsamModerationResponse {
  id: string;
  model: 'omni-moderation-csam-latest';
  results: Array<CsamModeration>;
}

python 侧的对应版本 v3.55.1(#4290「document CSAM moderation response fields」)是 chore 版:实际改动只有 api_reference/openapi.transformed.yml(另涉代码生成统计文件)——OpenAPI 参考层新增 CSAMModerationResult / CSAMCategoryFlags / CSAMCategoryScores / CSAMCategoryAppliedInputTypes 四个 schema(与 node 侧类型同构,类别与 applied input types 字面量一致),src 下没有对应资源类型。v3.55.1 的其余条目为依赖与 CI 依赖升级(pytest-asyncio、codeql-action、python-security 组,均 deps 或 deps-dev)。要在 python 里消费 CSAM moderation 响应,当前只能按原始响应处理。

5. 常见错误与排查

  • 升级后 spend_control 报类型错误:这是预期行为——v3.55.0 / v7.60.0 已把请求侧参数与响应侧字段整批删除;把相关代码摘掉,或钉住旧版本并接受它不再收安全修复。
  • 按 agent.session.budget_reached 写暂停处理逻辑:该事件类型与状态值都已移除(node helpers 里残留的字符串比较不构成可用类型);生产逻辑按 status 四值 + 既有错误通道处理。
  • 在 Live 会话里等 authorization / headers 回显:两者是 writeOnly,返回的 Live 会话数据中省略——不要把回显缺失当 bug。
  • 给 2026-09-01 后的模型配 connector_id:Live 侧文档串与 Responses 侧口径一致,该字段对 2026-09-01 之后发布的模型弃用;远程服务器用 server_url,本地经 Secure MCP Tunnel 用 tunnel_id。
  • 在 python 里 import CSAM moderation 类型:python 侧本批没有对应资源类型(只到 OpenAPI 参考层);node 侧才有 CsamModeration。

下一步

关键要点

  • 版本与上架(本站 2026-11-20 经 GitHub releases API、PyPI 与 npm registry JSON 核对):python v3.54.0 GitHub 2026-11-17T22:42:56Z / PyPI 22:43:49Z(后 53 秒);v3.55.0 GitHub 11-18T05:21:54Z / PyPI 05:22:42Z(后 48 秒);v3.55.1 GitHub 16:04:26Z / PyPI 16:05:17Z(后 51 秒;批次收尾时为 PyPI latest);node v7.59.0 GitHub 22:42:24Z / npm 22:54:03Z(后 11 分 39 秒);v7.60.0 GitHub 11-18T16:06:00Z / npm 16:16:53Z(后 10 分 53 秒;批次收尾时为 npm latest)
  • Live MCP 工具配置(#4280/#3160):python 侧 ToolMcp 与 node 侧 Mcp 在基线版本(v3.54.0 / v7.59.0 tag 实测)都是只有 type: mcp 的空壳;3.55.0 / 7.60.0 补齐 11 个字段——allowed_callers(direct 或 programmatic 列表)、allowed_tools(名称列表或 read_only + tool_names 过滤器)、authorization 与 headers(writeOnly,文档串注明返回的 Live 会话数据中省略)、connector_id(文档串标注对 2026-09-01 之后发布的模型弃用,改用 server_url 或 tunnel_id)、defer_loading(经 tool search 发现)、require_approval(always、never 或 always/never 过滤器对)、server_label(pattern 限 ^[A-Za-z][A-Za-z0-9_-]*$、最长 128)、server_description、server_url、tunnel_id
  • 预算事件两步走(#4284/#3162 类型化、#4289/#3166 移除):v3.54.0 / v7.59.0 给 AgentSession.status 加 budget_reached 第五值、新增 agent.session.budget_reached 事件(会话因触达支出上限而暂停时发出)、SpendControl.limit 改可空(unlimited 时为 null);下一个特性版 v3.55.0 / v7.60.0 全部收回——status 回四值、事件类型删除(python beta/__init__ 零处导出、事件类型文件 404;node agents.ts 接口移除)、AgentSession 响应侧 spend_control 删除、session create/update 的 spend_control 参数一并删除、session_turn_error 枚举的 session_budget_exceeded 一并删除;移除的官方口径在 PR 正文:被移除的是 alpha budget API、There is no replacement typed budget API in this release;node 的 lib helpers 内仍保留对该事件字面量的比较分支(类型已删、比较残留)
  • CSAM moderation 双包不同步:node v7.60.0(#3167)在 moderations.ts 落独立类型——CsamModeration(flagged 为是否任一类别命中、categories / category_scores / category_applied_input_types 三组,类别字面量 likely-csam 与 likely-csam/gen-ai,applied input types 仅 image)、CsamModerationResponse 的 model 字段为 omni-moderation-csam-latest;python 侧对应版本 v3.55.1(#4290)只动 api_reference/openapi.transformed.yml 的参考文档层(另涉代码生成统计文件;CSAMModerationResult 等四个 schema),src 下无对应资源类型;v3.55.1 其余为依赖与 CI 依赖升级
  • 请求侧 spend_control 的生命周期:2026-10-31 批(v3.42.0 / v7.46–7.47)作为会话设置引入(limit 为正整数美元分或 null),本批 v3.55.0 / v7.60.0 请求与响应两侧连同事件、错误码整批移除——写过 spend_control 的代码在升级后类型检查会直接失败

常见问题

在 delegation 为 responses 的会话配置里,工具数组放一个 type 为 mcp 的对象:server_url 指向远程 MCP 服务器(或 tunnel_id 指向 Secure MCP Tunnel),server_label 标识该服务器;allowed_tools 限定可用工具名(或用 read_only 加 tool_names 的过滤器对象),require_approval 用 always、never 或 always/never 两个过滤器控制哪些工具需要用户批准;authorization 与 headers 只写不读——返回的会话数据里这两项被省略。connector_id 虽在字段表里,文档串已标注对 2026-09-01 之后发布的模型弃用。

官方参考

相关文章

订阅 GPTMap Weekly

每周一封邮件,精选 OpenAI 重要更新、深度解读与最佳实践。无广告,可随时退订。

提交后将在新标签页打开 Buttondown 完成订阅确认。

GPTMap Editorial发布于 2026-11-20 11 分钟阅读
测试环境(EEAT)
最后测试时间:2026-11-20
使用模型:SDK:openai-python ≥ 3.55.1 / openai-node ≥ 7.60.0