Agents API 正式发布
原题Introducing the Agents API
推荐理由OpenAI 的 Agents API 进入 public beta,把 Codex 背后的 Harness 与运行基础设施开放给开发者:一次调用即可指定任务、模型、工具和计算环境,并获得工具搜索、程序化调用、上下文压缩与子智能体编排。它没有消除 Agent 工程,而是把一部分通用复杂度下沉为托管服务,同时保留 OpenAI 沙箱、自管环境和合作伙伴沙箱等选择。适合正在权衡自建编排、执行隔离与托管运行时的工程团队。
读前速览
OpenAI 公开发布 Agents API 公测版,为开发者提供托管式 harness 与基础设施,只需一次 API 调用即可构建生产级 AI 智能体。
一次调用即可创建智能体,harness 可配置
开发者只需一次 API 调用,定义模型、工具(如 MCP)、环境和可选的 vault ID,即可实例化生产级智能体,由托管 harness 负责上下文、工具使用和可靠性。
多智能体编排实现并行任务执行
Agents API 支持生成独立运行的子智能体,每个子智能体拥有自己的上下文,从而将调查、分析和缓解等复杂工作流并行拆解,无需自定义编排逻辑。
灵活的计算与沙箱选项
智能体可以运行在 OpenAI 托管的沙箱、自管理基础设施,或通过合作伙伴沙箱(Cloudflare、Vercel、Modal 等)运行,让用户根据工作负载匹配性能、成本和部署需求。
高效的工具使用与上下文管理
按需工具搜索、程序化工具调用和自动上下文压缩等功能可减少 token 消耗和成本,同时在长会话中保留相关信息。
完整摘要
OpenAI 宣布 Agents API 进入公测阶段。这是一项托管服务,开发者只需一次 API 调用,指定任务、模型、工具和计算环境,即可创建生产级 AI 智能体。该 API 提供可配置的 harness,负责上下文管理、工具搜索和程序化工具调用,同时支持多智能体编排,让子智能体并行工作并共享结果。开发者可以选择 OpenAI 托管的沙箱、自管理基础设施,或来自 Cloudflare、Vercel、Modal 等公司的合作伙伴沙箱。Agents API 基于开源 Codex harness 构建,提供模型改进的版本化访问、长会话的自动上下文压缩,以及可供审查的透明代码。此次发布还包含代码片段、合作伙伴集成和快速入门指南,帮助开发者上手。
目录 · 10 节
随着我们将 Codex 和 ChatGPT for Work 扩展到全球数百万人,我们了解了要让长时间运行的智能体在实践中良好运作需要些什么。实用的智能体需要一个强大的支架,用于管理上下文、高效使用工具并协调子智能体。它们还需要能够可靠运行数天的基础设施,以及可以处理文件、运行代码和保存中间结果的环境。As we’ve scaled Codex and ChatGPT for Work to millions of people around the world, we’ve learned what it takes to make long-running agents work well in practice. Useful agents need a powerful harness that manages context, uses tools efficiently, and coordinates subagents. They also need infrastructure that keeps them running reliably for days, with environments where they can work with files, run code, and save intermediate results.
今天,我们正式推出处于公开测试阶段的 Agents API(在新窗口中打开),通过简单灵活的 API,将驱动 Codex 的同一套工具和基础设施带给开发者。Today, we’re introducing the Agents API(opens in a new window) in public beta, bringing that same harness and infrastructure that powers Codex to developers through a simple, flexible API.
通过一次 API 调用构建云端智能体Build cloud agents with a single API call
借助 Agents API,您只需一次 API 调用,指定任务、模型、工具和环境,即可创建一个可用于生产环境的智能体:With the Agents API, you can create a production-ready agent in a single API call by specifying the task, model, tools, and environment:
JavaScriptJavaScript
1import OpenAI from "openai";2
3const client = new OpenAI();4
5const session = await client.beta.agents.sessions.create({6 agent: {7 model: "gpt-6-astra",8 tools: [9 {10 type: "mcp",11 server_label: "observability",12 transport: {13 type: "http",14 server_url: "https://observability.example.com/mcp",15 },16 },17 ],18 multi_agent: { enabled: true, max_concurrent_subagents: 3 },19 },20 vault_ids: ["vault_YOUR_VAULT_ID"],21 environment: {22 type: "openai_hosted",23 capability_directories: ["/workspace/capabilities/skills"],24 },25 input:26 "Investigate service-api’s elevated 5xx rate over the last 30 minutes. " +27 "Delegate deployment, error, and dependency analysis to subagents. " +28 "Save findings, evidence, and recommended mitigation in /workspace/outputs.",29});
OpenAI 托管并维护该运行框架。您可以选择智能体的计算环境:使用 OpenAI 管理的沙箱、您自己的基础设施,或我们的沙箱合作伙伴之一。Agents API 为您提供了坚实的基础,让您能够基于我们经过优化的智能体运行框架和基础设施构建智能体,从而专注于打造使您的智能体独具特色的工具、知识和工作流。OpenAI hosts and maintains the harness. You choose the agent’s compute environment: in an OpenAI-managed sandbox, on your own infrastructure, or with one of our sandbox partners. The Agents API gives you a strong foundation for building agents on top of our optimized agent harness and infrastructure, so you can focus on the tools, knowledge, and workflows that make your agent unique.
Agents API powers your agents with the same harness and infrastructure behind Codex.
我们的客户如何评价 Agents APIWhat our customers are saying about Agents API
“With the Agents API, our evaluation score went from 0.71 to 0.85. The subagent support in the API is great and drastically sped up our workflow. Previously it was pretty cumbersome to observe and orchestrate subagents in our old setup but the new APIs gave us a 4x latency reduction. We spent a long time trying to optimize for this and the subagent flows were a huge out-of-the-box lift.”
- CiridaeCiridae
- 长湖Long Lake
- WithCoverageWithCoverage
- SafetyKitSafetyKit
- 德韦利Dwelly
- 菌丝Hypha
- deepsense.aideepsense.ai
- Nash.aiNash.ai
选择你的智能体环境Choose your agent environment
不同的工作负载需要不同的计算、存储和部署选项。Agents API 允许您选择适合您应用程序的沙箱环境。Different workloads need different compute, storage, and deployment options. The Agents API lets you choose a sandbox that fits your application.
我们正与生态系统提供商(在新窗口中打开)展开合作,包括 Blaxel、Cloudflare、Daytona、DigitalOcean、E2B、Modal、Oracle、Runloop 和 Vercel,为各种需求提供一流的集成:We’re partnering with ecosystem providers(opens in a new window), including Blaxel, Cloudflare, Daytona, DigitalOcean, E2B, Modal, Oracle, Runloop, and Vercel, to provide first-class integrations for a range of needs:
- 完全托管的环境或在您的 VPC 中进行的部署Fully managed environments or deployments within your VPC
- 特定的文件和机密存储机制Specific file and secret storage mechanisms
- 不同的 CPU、GPU 和内存配置,并提供与贵公司工作流程相匹配的性能、冷启动和成本特征。Different CPU, GPU, and memory configurations, with performance, cold-start, and cost profiles to match your company’s workflow.
The Agents API offers first-class integrations with popular ecosystem providers.
OpenAI 托管的沙盒OpenAI hosted sandboxes
对于希望快速入门并高效扩展的开发者,我们还推出了由 OpenAI 托管的沙盒(在新窗口中打开)。该沙盒采用了与 Codex 和 ChatGPT 相同的沙盒基础设施。For developers who want to get started quickly and scale efficiently, we’re also introducing the OpenAI hosted sandbox(opens in a new window). This leverages the same sandboxing infrastructure that powers Codex and ChatGPT.
OpenAI 提供并管理沙盒,为您的智能体提供安全且高性能的环境,以运行代码、处理文件和生成构件。您可以灵活配置这些沙盒,添加文件、软件包、技能和插件,为智能体完成任务提供所需的一切。OpenAI provisions and manages the sandbox, giving your agent a secure and performant environment to run code, work with files, and produce artifacts. These sandboxes can be flexibly configured with your files, packages, skills and plugins to give the agent what it needs to complete the task.
借助不断演进的 Codex 测试框架进行构建Build with an evolving Codex harness
利用新模型的能力通常意味着需要重新设计你的测试框架,从而占用本可用于改进应用程序的宝贵时间。Agents API 会在每个模型发布时,提供对这些能力的版本化访问。我们会随着模型的迭代持续维护和改进测试框架,帮助你的智能体从每次升级中获得更好的性能。例如,测试框架近期的改进包括:Taking advantage of new model capabilities often means reworking your harness, taking valuable time away from improving your application. The Agents API provides versioned access to these capabilities with each model launch. We maintain and continuously improve the harness alongside our models, helping your agents get better performance from every upgrade. For example, recent improvements to the harness include:
让智能体在长时间会话中持续工作Keep agents working across long sessions
为了支持模型连续工作数小时,我们构建了上下文管理功能,帮助代理在更长的会话中传递相关信息。当会话接近上下文限制时,Agents API 会自动压缩此前的上下文(在新窗口中打开),保留代理继续工作所需的信息。开发者无需自行实现压缩逻辑,即可构建跨越多个上下文窗口的工作流。To support models working for hours, we’ve built context management that helps agents carry relevant information across longer sessions. The Agents API automatically compacts(opens in a new window) earlier context as a session approaches its context limit, preserving information the agent needs to continue. Developers can build workflows that span multiple context windows without implementing their own compaction logic.
帮助代理高效地使用更多工具Help agents efficiently use more tools
Agents API 可帮助智能体找到合适的工具并高效使用它们。工具搜索(在新窗口中打开)会按需加载相关工具定义,在保留模型缓存的同时,帮助减少令牌用量和成本。工具可用后,程序化工具调用(在新窗口中打开)可让智能体并行执行调用、串联相关操作,并在代码中筛选或组合结果,从而处理大量数据,同时仅将相关结果带回上下文。Agents API 支持 MCP、自定义函数以及网页搜索等内置工具。The Agents API helps agents find the right tools and use them efficiently. Tool search(opens in a new window) loads relevant tool definitions as needed, helping reduce token usage and cost while preserving the model’s cache. Once tools are available, programmatic tool calling(opens in a new window) lets agents run calls in parallel, chain related operations, and filter or combine results in code so they can work through large volumes of data while bringing only the relevant results back into context. The Agents API supports MCP, custom functions, and built-in tools like web search.
JSONJSON
1"agent": {2 "tools": [3 {4 "type": "mcp",5 "server_label": "openai_docs",6 "transport": {7 "type": "http",8 "server_url": "https://developers.openai.com/mcp"9 }10 },11 ]12}
让代理通过子代理并行处理工作Let agents parallelize work with subagents
借助多智能体支持(在新窗口中打开),Agents API 可以将复杂任务拆分为相互独立的部分,并将其委派给并行工作的子智能体。每个子智能体都维护自己的上下文,有助于专注于所分配的任务;主智能体则负责协调它们的工作并汇总结果。对于受益于并行处理的研究、分析和编码任务,这可以提升执行速度,而无需你自行构建编排机制。With multi-agent support(opens in a new window), the Agents API can break complex tasks into independent pieces and delegate them to subagents that work in parallel. Each subagent maintains its own context, helping it stay focused on its assignment, while the main agent coordinates their work and brings the results together. This can speed up research, analysis, and coding tasks that benefit from parallel work, without requiring you to build your own orchestration.
JSONJSON
1"agent": {2 "model": "gpt-6-astra",3 "multi_agent": {4 "enabled": true,5 "max_concurrent_subagents": 3,6 }7}
一个开源基金会An open-source foundation
Agents API 由开源 Codex harness 提供支持,让开发者能够了解协调模型调用、工具和上下文的核心逻辑。借助 Agents API,OpenAI 负责运行和维护该 harness,同时开发者可以查看其公开代码库并从中学习(在新窗口中打开)。The Agents API is powered by the open-source Codex harness, giving developers visibility into the core logic that coordinates model calls, tools, and context. With the Agents API, OpenAI operates and maintains that harness while developers can inspect and learn from its public codebase(opens in a new window).
开始构建Start building
Agents API 今日面向所有开发者开放公测。使用 Agents API 不收取额外费用——您只需按照我们的定价页面(在新窗口中打开)所述,为您的代理使用的令牌和工具付费。Agents API is available in public beta today to all developers. There are no additional fees for using the Agents API – you simply pay for the tokens and tools your agents use, as outlined on our pricing page(opens in a new window).
探索 Agents API 概览(在新窗口中打开)以了解更多信息,或按照快速入门(在新窗口中打开)开始操作,将 Codex 背后的 harness 引入到您自己的代理中。Explore the Agents API overview(opens in a new window) to learn more, or follow the quickstart(opens in a new window) to get started and bring the harness behind Codex into your own agents.
在公开测试期间,我们会根据你的反馈快速迭代,同时致力于实现全面可用。请告诉我们哪些地方运行良好、你遇到了哪些阻碍,以及你需要哪些功能来构建代理并在生产环境中运行它们。During the public beta, we’ll iterate quickly based on your feedback as we work toward general availability. Let us know what’s working, where you’re running into friction, and what you need to build and run your agents in production.