章鱼总结
00:00 / 19:44

OpenAI · 19:44

说话人 0

Hey everyone, I'm Charlie from the developer experience team.

大家好,我是Charlie,来自开发者体验团队。

说话人 1

and I'm Steve. I'm an engineer on the API team.

我是Steve。 我是API团队的工程师。

说话人 0

And for well over a year, we've heard about how agents are going to change everything and be the next evolution in AI. And here in 2026, it feels like that's actually become true at the frontier. We can ask agents to investigate an outage, to solve a support ticket, or to help reconcile finances. We're seeing that shift here at OpenAI with Codex and ChatGPT work. We're using agents across the company, from engineering to finance to marketing. A big part of that, perhaps the biggest part, is the model. As models become more capable, we can ask them to take on more involved work. Astra and GPT 6.1 Sol can handle larger tasks from start to finish. but every time the model can do more, the software around it has to change too. we've gone from putting an api endpoint on top of an inference stack to building an entire harness as a service. So today we want to tell you what we learned building that harness, why we're making it available through the agent's API, and show you what you can now build with it. but first steve how did we get here.

一年多以来,我们一直听说智能体将改变一切,成为AI的下一次进化。 而到了2026年,这在前沿领域里确实已经成为现实。 我们可以让智能体去排查故障、解决支持工单,或者帮忙核对财务账目。 在OpenAI,我们借助Codex和ChatGPT的工作功能,正在见证这种转变。 我们在全公司范围内使用智能体,从工程到财务再到市场部门都有。 其中一个重要原因,也许是最重要的原因,是模型本身。 随着模型能力不断增强,我们可以让它们承担更复杂的工作。 Astra和GPT 6.1 Sol能够从头到尾独立完成更大的任务。 但每当模型能做的事情更多,围绕它的软件也必须随之改变。 我们已经从在推理栈之上挂一个API端点,发展到构建一整套作为服务提供的运行框架(harness)。 所以今天我们想分享构建这套框架的经验,说明我们为何通过智能体API开放它,并展示你现在可以用它构建哪些东西。 但首先,Steve,我们是怎么走到这一步的?

说话人 1

So this isn't the first time that we've tried to tackle this problem with the Assistants API. We explored what it would look like to give developers hosted workflows with tools like file search and code interpreter. But models have come a long way. Back in 2023, GPT 4 Turbo could use these tools to accomplish workflows that lasted maybe a few seconds. GPT-6 Astra on the other hand can use dozens of tools effectively for hours or days on end. With reasoning models, we needed a more flexible foundation. We launched the responses API in 2025 to solve a more basic problem. In order to build more advanced agentic workflows, developers needed to be able to send many types of content to the model, like text, images, and reasoning, and get back many types of content in return. In hindsight, this proved to be a pretty powerful foundation. It supported a new wave of agentic products, including Codex and ChatGPT Work. We think of our APIs as layers in a cake or elements in a kind of Maslow's hierarchy of inference. The responses API is the base, providing a solid interface for agentic harnesses. Codex is built on top of the responses API, giving the agent hands with which it can do work, like coding, editing presentation, or using a browser. And the agent's API is self-actualization, allowing you and your product to live up to their full potential by building agents that automate key parts of your business or product without the trouble of operating the harness at scale. So why did we take yet another stab at putting an agentic harness behind an API? Well, at first we assumed that you all would want to build a lot of this infrastructure yourselves before we had great harnesses like Codex. Most folks were writing their own. In 2025, we shipped a local agent harness, the Agents SDK, to help folks along the path of building and shipping agents that they had total control over. But I kept having conversations where a team had a very clear idea of the product they wanted to build. They knew the workflow, they knew where an agent would help, but then they'd ask us, OpenAI, how they should build it. What tools should they use? Should the agent run inside the sandbox or outside the sandbox? how should they manage secrets? we were asking them what kind of agent infrastructure they wanted. but ultimately, they wanted to come to us for opinions about what was working well. and one thing came up very directly. how could they get us to run it for them? this was a useful distinction to learn. as a business or developer, you may have an idea of what tools you want to use, the data, or the execution environment that the agent should use. But that doesn t automatically mean that you want to run the whole harness yourself. This is the core idea behind the Agents API, a managed service built on the Codex harness. You define the tools, the data, and the instructions. You choose the environment that the agent works in, and we run the harness and the services around it. This also means that we can keep improving that harness as we learn from building agents and as the models get better. You don't have to independently reproduce every single one of these improvements on your own.

所以这并不是我们第一次尝试用Assistants API解决这个问题。 我们曾探索过为开发者提供托管工作流的可能性,并配备文件搜索、代码解释器等工具。 但模型已经走过了很长的路。 早在2023年,GPT-4 Turbo能用这些工具完成的工作流,大约只能持续几秒钟。 而GPT-6 Astra则能有效使用数十种工具,连续工作数小时甚至数天。 对于推理模型,我们需要��个更灵活的基础。 我们在2025年推出了 Responses API,以解决一个更基础的问题。 为了构建更高级的智能体工作流,开发者需要能够向模型发送多种类型的内容,例如文本、图像和推理过程,并获得多种类型的内容作为返回。 事后看来,这被证明是一个非常强大的基础。 它支持了新一批智能体产品,包括 Codex 和 ChatGPT Work。 我们把自己的 API 看作蛋糕的层次,或者说一种推理领域的马斯洛需求层次结构中的各个要素。 Responses API 是基础,为智能体运行框架提供了稳固的接口。 Codex 构建在 Responses API 之上,为智能体提供了可以执行工作的“双手”,例如编程、编辑演示文稿或使用浏览器。 而智能体 API 则是自我实现,让你和你的产品能够充分发挥潜力,通过构建能够自动化业务或产品关键环节的智能体,而无需承担大规模运行运行框架的麻烦。 那么,为什么我们要再次尝试把智能体运行框架放在 API 之后呢? 嗯,起初我们以为,在有了 Codex 这样出色的运行框架之前,你们都会想自己构建大量这类基础设施。 大多数人都在自己编写。 2025年,我们发布了一个本地智能体运行框架 Agents SDK,帮助大家构建和发布完全由自己掌控的智能体。 但我不断遇到这样的对话:某个团队对想要构建的产品已经有非常清晰的想法。 他们了解工作流程,也知道智能体会在哪里提供帮助,但他们接着会问我们 OpenAI,应该如何构建它。 应该使用哪些工具? 智能体应该在沙箱内运行,还是在沙箱外运行? 应该如何管理机密信息? 我们其实是在问他们,想要什么样的智能体基础设施。 但最终,他们希望来找我们,听取关于什么运行得好的意见。 其中有一点非常直接地浮现出来。 他们怎样才能让我们替他们运行它? 这是一个值得了解的有用区别。 作为企业或开发者,你可能已经有了想使用的工具、数据,或者智能体应当使用的执行环境。 但这并不自动意味着你想自己运行整个 harness。 这正是 Agents API 背后的核心理念,它是一项建立在 Codex harness 之上的托管服务。 你来定义工具、数据和指令。 你选择智能体工作所在的环境,而我们运行 harness 以及围绕它的各项服务。 这也意味着,随着我们在构建智能体的过程中不断学习,以及模型不断进步,我们可以持续改进这个 harness。 你不必独自重新实现每一项改进。

Now this might sound pretty straightforward. You take the harness that we already have in Codex, you chuck it behind an API and you run it for people. How hard could this be? Well, actually, it turns out that doing this is surprisingly difficult, and there are some fundamental engineering questions that we needed to answer. First, how do you take a harness built to run on someone's laptop and let it operate securely in the cloud using a totally different computer as its environment? Two, how do you give developers a useful view of what an agent's doing as the agent is deciding the steps as it goes along? and three, how do you preserve state over a task that might run for hours, even when we deploy new code or a server dies. These are the three key problems that we want to walk you through: what made them difficult, how we approach them, and what the answers ultimately let you build. The Codex Harness started off with a reasonable assumption. It's running locally on your computer. It can read the file system, change a file, and see the result. But I remember a conversation we had earlier this year where we needed to upend that assumption. We needed to separate the harness from the environment where the commands actually run. As developers, you might want the harness to run in sandboxes you already operate, or you might want us to operate the sandbox for you. Either way, we needed a way for the harness working in the cloud to communicate with any arbitrary environment. and that immediately creates another problem. say the model asks to list files in a directory, how do we get that command to the right computer and then get its result back quickly? we need to go and find the environment that's connected to that session, send the command there, and then get the result back so that the model can continue. and with many environments connected, we also need to keep each session's commands and results separate. a command that used to be local now has to cross this connection every time. If you've been using the Agents API for the last few weeks, you've been able to bring your own sandbox or use one that OpenAI spins up for you. And in both cases, your agents are quite capable and they can use the terminal to do a ton of work. But as you heard in the keynote, we're adding one new feature that you all have been asking for a bunch. Today, we introduced computer use over the API, bringing the incredible abilities of Astra to use a GUI in OpenAI hosted environments. And I'll turn it back over to Charlie to tell us more.

现在这听起来可能相当简单。 你把我们在 Codex 中已有的 harness 放到一个 API 后面,然后为别人运行它。 这能有多难呢? 实际上,事情出乎意料地困难,其中有一些根本性的工程问题是我们必须回答的。 第一,如何把一个为在某人笔记本电脑上运行而构建的 harness,改造成能在云端安全运行,并以一台完全不同的计算机作为其环境? 第二,当智能体在逐步决定下一步操作时,如何让开发者清楚地看到它正在做什么? 第三,如何在一个可能运行数小时的任务中保持状态,即使我们部署新代码或服务器崩溃也不丢失。 这三个是我们想带你了解的关键问题:它们为何困难,我们如何应对,以及这些答案最终让你能够构建什么。 Codex harness 最初基于一个合理的假设。 它在你的电脑上本地运行。 它可以读取文件系统、修改文件,并查看结果。 但我记得今年早些时候我们有一次对话,当时我们需要推翻这个假设。 我们需要将驱动程序(harness)与命令实际运行的环境分离开来。 作为开发者,你可能希望驱动程序运行在你已经运营的沙箱中,或者你可能希望我们替你运营沙箱。 无论哪种方式,我们都需要一种方法,让运行在云端的驱动程序能够与任意环境进行通信。 而这立即带来了另一个问题。 假设模型请求列出某个目录中的文件,我们如何将该命令准确送达正确的计算机,并迅速取回结果? 我们需要找到与该会话相连的环境,将命令发送到那里,然后取回结果,以便模型能够继续工作。 而且当连接的环境很多时,我们还需要确保每个会话的命令和结果彼此分开。 以前本地运行的命令,现在每次都必须穿越这一连接。 如果你在过去几周一直使用Agents API,你就可以带上自己的沙箱,或者使用OpenAI为你启动的沙箱。 在这两种情况下,你的智能体能力都相当强,并且可以使用终端完成大量工作。 但正如你在主题演讲中听到的,我们正在新增一项大家一直强烈要求的功能。 今天,我们推出了通过API使用计算机的功能,将Astra强大的能力带到OpenAI托管环境中,使其能够使用图形用户界面(GUI)。 接下来我将把话筒交还给Charlie,让他为大家介绍更多内容。

说话人 0

Thanks, Steve.

谢谢,Steve。

Once an agent can go off and use a computer or a sandbox, there's an immediate question for anyone that's building a product around it. What do you show people while it's working? You can't predict the path that an agent will take in advance. It depends on a ton of different inputs, like the user's prompt or the results of a tool call. Across different runs, an agent might open a new set of files, try an alternative approach, or hand part of the job to another agent. But your users still need to follow what's happening, especially with long running tasks. They'll want to know what the agent is working on or whether it's gotten stuck and needs some help. At first, we thought giving developers the raw tool calls and model responses would be enough for them to build a great user experience, but it turned out they wanted more than that. One of our internal teams ran into this while building with the API. Their sessions often involved several rounds of back and forth between the user and the agent. A user could ask for something, get an answer, and then come back with a new request. which then triggered another round of work. the team wanted to visualize the agent's tool calls and responses by turns, but our original api design didn't easily give them that information. they could have tracked those relationships themselves, but that meant rebuilding part of the harness that they'd come to us to manage. So we went back and made that turn information available through the API. The team could then decide how to show the work without having to reconstruct the entire conversation from scratch. And this might seem obvious in hindsight, but when you're building a harness as a service, there are dozens of design decisions like this. They determine how much of the work you can actually hand off to OpenAI, how much you still have to figure out yourself, and what sharp corners you might run into as a developer. Steve, take us through one example.

一旦智能体能够去使用计算机或沙箱,任何基于它构建产品的人都会立刻面临一个问题。 在它工作时,你向用户展示什么? 你无法提前预测智能体会采取的路径。 它取决于大量不同的输入,例如用户的提示词或工具调用的结果。 在不同的运行过程中,智能体可能会打开一组新文件、尝试另一种方法,或者把部分工作交给另一个智能体。 但用户仍然需要跟进正在发生的事情,尤其是在长时间运行的任务中。 他们会想知道智能体正在处理什么,或者它是否卡住了、需要一些帮助。 起初,我们以为把原始的工具调用和模型响应提供给开发者,就足以让他们构建出出色的用户体验,但事实证明他们需要的不止这些。 我们的一个内部团队在使用 API 进行开发时遇到了这个问题。 他们的会话通常涉及用户与智能体之间的多轮来回交互。 用户可能先提出一个请求,得到回答,然后再提出新的请求。 这又会触发新一轮的工作。 团队希望按轮次可视化智能体的工具调用和响应,但我们最初的 API 设计并不能轻松提供这些信息。 他们本可以自己追踪这些关联关系,但那就意味着要重新构建一部分他们originally找我们托管的运行框架。 于是我们回头把这些轮次信息纳入了 API。 这样团队就可以决定如何展示工作过程,而无需从头重建整个对话。 事后看来这可能显得很明显,但当你把运行框架作为服务来构建时,类似这样的设计决策还有几十个。 这些决策决定了你究竟能把多少工作交给 OpenAI 处理,还有多少需要你自己解决,以及作为开发者你可能会遇到哪些棘手的问题。 Steve,请给我们讲一个例子。

How do you keep an agent reliably working for hours on end?

你如何让智能体可靠地连续工作数小时?

说话人 1

the longer an agent works, the more history it accumulates. eventually that history can exceed the model's context window, even if the task is still going. compaction is designed to solve this problem. The harness can carry useful information forward so the agent can continue across context windows. Otherwise, every developer building a long running agent has to decide how to manage that history themselves. But context is only one of the constraints that we run into. GPT-6 can work for days on end, but at some point we need to deploy our own code or our servers will die or otherwise get recycled. So how do we do both? A lot of cloud software is designed around short requests. Request comes in, it touches a database, it returns a response, and this all happens in less than a second. But agents can work for hours. And while it's working, you might want to steer it one way or another. And this means that we have to go and find your session among all of our servers and route your requests there. Or Codex might be waiting for a tool result from another computer. And all of this depends on other systems, including model inference, storage, and the services that the tools call. In order to have three nines of reliability, all of these systems need to have the same reliability or better. And if Codex crashes or we replace a server during deployment, we need to be able to pick up exactly where we left off. For example, your agent may have already spent an hour investigating a problem, or it may have taken actions that we don't want to repeat. so we need to keep track of state very precisely, rotate servers out at the right time and resume threads instantly, so your agents can keep working indefinitely. Here's a concrete example. Suppose your agent wants to edit a file. We send the command to the environment, but then the connection drops. What do we do? Did the file get edited or not? Receiving no result doesn't tell us whether the action happened, but replaying the command might result in a bad outcome too. To continue safely, we need to account for what happened in the execution environment as well as what the harness reported. but the agent's api manages all of this complexity so that you don't have to. you can keep the environment you already run, show users what the agent's doing, and let the service handle the long running session.

智能体工作的时间越长,积累的历史记录就越多。 最终,即使任务仍在进行,这些历史记录也可能超出模型的上下文窗口。 压缩(compaction)正是为解决这一问题而设计的。 运行框架可以将有用的信息向前传递,使智能体能够跨越多个上下文窗口继续工作。 否则,每个构建长时间运行智能体的开发者都必须自己决定如何管理这些历史记录。 但上下文只是我们遇到的约束之一。 GPT-6 可以连续工作数日,但我们迟早需要部署自己的代码,否则我们的服务器会崩溃,或者被回收替换。 那么,我们如何两者兼顾? 许多云软件都是围绕短请求设计的。 请求进来,访问数据库,返回响应,整个过程不到一秒钟。 但智能体可以工作数小时。 而且在它工作期间,你可能想要以某种方式引导它。 这意味着我们必须在所有服务器中找到你的会话,并把你的请求路由到那里。 或者 Codex 可能正在等待另一台计算机返回的工具结果。 而这一切又依赖于其他系统,包括模型推理、存储以及工具调用的各项服务。 要实现三个九的可靠性,所有这些系统都必须达到相同或更高的可靠性。 如果 Codex 崩溃,或者我们在部署期间替换了服务器,我们必须能够从中断的确切位置恢复。 例如,你的智能体可能已经花了一个小时排查问题,或者它已经执行了我们不希望重复的操作。 因此,我们需要非常精确地跟踪状态,在合适的时机轮换服务器,并即时恢复线程,使你的智能体能够无限期地持续工作。 这里有一个具体的例子。 假设你的智能体想编辑一个文件。 我们把命令发送到环境中,但随后连接断开了。 我们该怎么办? 文件到底有没有被编辑? 没有收到结果并不能说明操作是否已经执行,但重新执行命令也可能带来糟糕的后果。 要安全地继续,我们既需要核对执行环境中实际发生了什么,也需要核对驱动程序(harness)报告的内容。 但智能体的 API 会替你处理所有这些复杂性,你无需自己操心。 你可以保留现有的运行环境,向用户展示智能体正在做什么,并让服务来管理长时间运行的会话。

and charlie will show us an application that does exactly that.

Charlie 将向我们展示一个正是这样做的应用。

说话人 0

Imagine you're halfway through a vacation and your connecting flight gets cancelled. As an individual, you could use Kayak's or your dot to research what's still available and rebook your specific ticket. But what if you're the airline? Here we've got a flight dashboard for flight AL 204 from San Francisco to Chicago. The flight's been canceled, which means rebooking dozens or even hundreds of passengers. In this view, we can see a few of the more difficult cases, the ones that might otherwise land on an operation team's desk. we might have one traveler that needs to make it at an exact specific airport, while another booking might be four passengers that all need to travel together, maybe their family with kids. why dont we start with those two. I've gone ahead and kicked off the rebooking process, which is going to start two agents API sessions in the background. we can see here in the activity tab the agent has started work. this is going to take a few minutes, so why don't we go ahead while that's working? and i want to take you some of the actual code that's powering this demo. we'll start with the session, which is the fundamental building block of the agent's api. here we have an example of how you can create one in javascript, which is less than a dozen lines of code. In this case, I'm specifying its environment, which is going to be an OpenAI hosted sandbox. But of course, you're always free to bring your own sandbox or work with one of our third-party sandbox providers. we're broadly disabling network access in the sandbox, and we've asked the session to stream its events back to us so that we can update the ui live. When we created our booking agent, We also gave it a flight rebooking skill, which specifies the precise steps the agent needs to take in order to rebook a passenger. We've loaded it from a local file and added it to the agent's workspace, and we're sharing it in the session through the capability directories field, which lets us not only share skills, but we can also specify paths to plugins, including MCP servers, if we want to let our agents have a little bit more engagement with the wider world. Speaking of engagement, one of the most important parts of this demo is also the search flight inventory tool. That's what lets the agent check for available seats across a variety of flights. But we do note in the description that the results are advisory, and so doing so can create a hold on a ticket, but a human needs to stay in the loop in order to lock that in and confirm the rebooking. As another layer of checks in the agent's instructions, we've told it to delegate seating and arrival checks to two sub agents. We wanted to wait for both of those to come back before it publishes the proposal. To make this work, I've enabled multi agent mode. and i've set the max concurrent number of sub agents that it can use to two. now this is a field that you can tweak up or down, but depending on how much parallel work you have. but it is worth noting that higher values are likely to incur more token usage. And last but not least, we wanted the agent to come back to us with a few files. We or artifacts we wanted to create a JSON file for its final proposal, a JSON file for the different options it compared, and an actual Python script to kind of deterministically check its logic against the constraints that we gave it. it looks like our agents might be done so let s go see how they did. Here we've got Aaron. She needs to get to O'Hare. No other options are workable. You know, preferring to leave tomorrow morning. We can see in the activity tab here what the agent did after it started working. It looks like it opened a sandbox, ran those commands, you know, use the tool to check flight availability and delegated to the two sub agents like we asked it to do. Ultimately, it held some seats for approval, and then it came back to us with this recommendation, along with some notes on why it recommended this specific flight. these seats are on hold, like i mentioned, to keep a human in the loop, and so nothing's going to be locked in until i approve the rebooking. i'll do that now. Now let's take a look at Ava's booking. This is actually for four people, including children, and one of the constraints is they all needed to be rebooked together. we can look in the activity tab again and we'll see a very similar thing. the agent went ahead and used the sandbox, check flights, check with sub agents and came back with a proposal. In this case, though, we can see in the workspace tab here some of those checks that we actually asked it to perform. And we can see that although it did select a recommended flight, it ruled out AL314 because it only had one seat available. And it also ruled out AL744 because while it did have four seats available, it couldn't guarantee that the seating would be all together, which was one of our requirements. Over in the files tab, we've got the final proposal JSON like we wanted, the comparison of all the different options it considered. and that Python file lets us check its logic against what we wanted. So I can go ahead and approve the rebooking for these as well. And you know, we've only looked at two passengers here, but a single canceled flight can leave dozens of these cases all at once. With the agent's API, we can work through these bookings in parallel and see why each flight was recommended while still making the final call with a human in the loop.

想象一下,你的假期过了一半,转机航班被取消了。 作为个人,你可以用 Kayak 或 Dot 查询还有哪些航班可订,然后改签你的具体机票。 但如果你是航空公司呢? 这里我们有一个旧金山飞往芝加哥、航班号为 AL 204 的航班仪表盘。 该航班已取消,这意味着需要为几十甚至数百名乘客重新安排航班。 在这个视图中,我们可以看到一些较为棘手的情况,这些情况很可能会转交给运营团队处理。 我们可能有一位旅客必须抵达某个特定机场,另一个订单则是四名需要同行的乘客,可能是带着孩子的一家人。 那我们先从这两个情况开始吧。 我已经启动了改签流程,这将在后台开启两个智能体 API 会话。 我们可以在这里的活动标签页中看到,智能体已经开始工作。 这大约需要几分钟,所以我们不如趁它工作的时候继续吧? 我还想带大家看看驱动这个演示的一些实际代码。 我们先从会话开始,它是智能体 API 的基本构建模块。 这里是一个用 JavaScript 创建会话的示例,代码不到十二行。 在这个例子中,我指定了它的环境,即一个由 OpenAI 托管的沙盒。 当然,您也可以随时使用自己的沙箱,或者与我们的第三方沙箱提供商合作。 我们在沙箱中大范围禁用了网络访问,并让会话将其事件流式传输回我们这边,以便我们实时更新界面。 在创建预订代理时,我们还为它添加了一项航班改签技能,该技能明确规定了代理为乘客改签航班所需遵循的精确步骤。 我们从本地文件加载了它,并将其添加到代理的工作区中,然后通过“能力目录”字段在会话中共享。这个字段不仅可以共享技能,如果我们希望代理更多地与外部世界互动,还可以指定插件的路径,包括MCP服务器。 说到互动,这个演示最重要的部分之一,就是航班库存搜索工具。 它让代理能够查询多个航班的可用座位。 不过我们在描述中特别注明,搜索结果仅供参考。这样做可能会为机票创建一个预留,但必须由人工介入,才能最终锁定并确认改签。 作为代理指令中的另一层检查,我们让它将座位和到达时间的核查工作委派给两个子代理。 在发布方案之前,我们希望等待这两个子代理都返回结果。 为了实现这一点,我启用了多代理模式。 并且我将其可同时使用的子代理最大并发数设置为两个。 这个字段可以根据并行工作量的多少进行上下调整。 不过需要注意的是,数值越高,可能产生的令牌用量就越多。 最后但同样重要的是,我们希望代理最终向我们返回几个文件。 我们希望得到的成果包括:一个用于最终方案的JSON文件、一个用于比较各个选项的JSON文件,以及一个Python脚本,用于按确定性方式根据我们给出的约束条件检查其逻辑。 看起来我们的代理可能已经完成了,那我们就去看看它们的表现如何。 这里是Aaron。 她需要前往O'Hare机场。 其他选项都不可行。 你知道的,她更希望明天早上出发。 我们可以在这里的活动标签页看到代理开始工作后做了什么。 看起来它打开了一个沙箱,运行了那些命令,你知道的,使用工具查询航班可用性,并按我们的要求把任务委派给了两个子代理。 最终,它为审批保留了一些座位,然后向我们返回了这个推荐方案,并附上了为什么推荐这个特定航班的说明。 正如我提到的,这些座位处于保留状态,以确保有人参与其中,所以在我批准改签之前,不会锁定任何东西。 我现在就批准。 现在我们来看看Ava的预订。 这次是四个人的预订,其中包括儿童,其中一个限制条件是他们必须一起改签。 我们可以再次查看活动标签页,会看到非常相似的情况。 代理同样使用沙箱,查询航班,与子代理核对,然后返回了一份方案。 不过这次,我们可以在这里的工作区标签页中看到一些我们确实要求它执行的检查。 可以看到,虽然它选择了一个推荐航班,但排除了AL314,因为它只剩一个可用座位。 它还排除了AL744,因为虽然有四个可用座位,但无法保证座位连在一起,而这是我们的要求之一。 在文件标签页中,我们得到了我们想要的最终方案JSON,以及它所考虑的所有不同选项的对比。 那个Python文件让我们可以根据我们的要求检查它的逻辑。 所以我现在也可以批准这些人的改签。 而且,我们这里只看了两名乘客,但一次航班取消可能会同时产生几十个这样的情况。 借助代理的API,我们可以并行处理这些预订,看到每个航班被推荐的原因,同时仍然由人类参与做最终决定。

Now if you're used to building agentic applications, you might notice that you could build something like this with the responses API. Many of the building blocks already exist, but as Steve showed, there's a lot to get right to make sure this all runs smoothly. With the Agents API, I don't have to build or maintain any of that infrastructure. I can focus on my application, the rebooking rules when someone needs to approve a change. Not to mention, I can iterate on my work much faster with Codex since there's less code to write, test, and maintain. And we're already seeing customers find some great use cases for the agents API. With Notion's external agents teams who are working from notion can assign work and have it done asynchronously. And now notion users can bring OpenAI agents into that workflow with the agents api. Rocketton is bringing the agent's API into its products for getting long running tasks done. With agents, users can give an agent work and then come back to continue to provide direction and feedback. And Bain is using the agency to build synthetic audiences for its clients. You can think of these as virtual focus groups, AI simulated customers based on real customer research, who give feedback on new products, ads or surveys. human experts are still checking the results. If you're building your own agentic products and features, but prefer to stay within the AWS ecosystem, as mentioned in the keynote, you can also build with Bedrock managed agents powered by OpenAI. We work closely together with the team to use the core of the agent's API and customize and deeply integrated into AWS.

如果你习惯构建代理式应用,可能会注意到,你也可以用Responses API构建类似的东西。 许多构建模块已经存在,但正如Steve所展示的,要让这一切顺畅运行,有很多细节需要处理好。 使用Agents API,我不需要构建或维护任何这些基础设施。 我可以专注于我的应用程序,以及需要有人批准的更改重新预订规则。 更不用说,借助Codex,我可以更快地迭代我的工作,因为需要编写、测试和维护的代码更少了。 我们已经看到客户发现了智能体API的一些很好的使用场景。 在Notion中,外部智能体团队可以直接在Notion里分配工作,并让其异步完成。 现在,Notion用户还可以通过智能体API,将OpenAI智能体引入这一工作流程。 Rocketton正在将智能体API引入其产品,用于完成需要长时间运行的任务。 借助智能体,用户可以交给智能体一项工作,然后回来继续提供指导和反馈。 Bain正在利用智能体为其客户构建合成受众。 你可以把它们理解为虚拟焦点小组:基于真实客户调研生成的AI模拟客户,对新产品、广告或调查问卷提供反馈。 人类专家仍在核查结果。 如果你正在构建自己的智能体产品和功能,但更希望留在AWS生态系统内,正如主题演讲中提到的,你还可以使用由OpenAI驱动的Bedrock托管智能体来开发。 我们与团队密切合作,利用智能体API的核心能力进行定制,并深度集成到AWS中。

Now we opened by talking about how much more we can ask agents to do now, but I want to close by talking about what that means for your ambitions as a developer. What work would you take on if you had dramatically more people or time at your disposal? What would you build if you could dispatch 100 or 1,000 or 10,000 agents to work on it? you could investigate every microservice for security holes. you could take on software mega projects that would have previously been unfathomable, or you could explore hundreds of different approaches to a research question simultaneously. that's what excites me about making the codex harness available through an api. you can now take work that is inherently parallelizable and dramatically expand the scope of what's possible. a la decisión. happy building.

我们开场时谈到了如今我们可以让智能体承担多少工作,但我想以另一个角度结束:这对你作为开发者的雄心意味着什么。 如果你拥有大量额外的人手或时间,你会承担哪些工作? 如果你能调度100、1000甚至10000个智能体来协作完成一项工作,你会构建什么? 你可以逐一排查每个微服务的安全漏洞。 你可以承担以前不可想象的大型软件项目,或者同时探索数百种不同方法来解决一个研究问题。 这正是我对通过API提供Codex驾驭框架感到兴奋的地方。 你现在可以承接本质上可并行化的工作,并大幅拓展可能性的范围。 a la decisión。 祝你建造愉快。

摘要

本视频由 OpenAI 开发者体验团队与 API 团队介绍 Agents API。演讲者认为,随着模型能力提升,智能体已能完成从头到尾的较大任务,相应的软件外层也需随之演进,从单纯的推理接口发展为托管的 harness 服务。视频回顾了从 Assistants API、Responses API 到 Agents SDK 的演进,说明开发者真正需要的是定义工具、数据、指令与执行环境,而无需自行运营 harness。随后,演讲者分析了将本地 harness 搬到云端时的三个难点:跨环境安全通信、向用户展示不可预测的执行过程、在部署与故障中保持长任务状态。最后,视频通过一个航班取消后批量改签的演示,展示了会话、技能、子代理与人工确认的组合用法,并列举了客户案例,强调该能力适合大规模并行的智能体工作。

章节

00:21 开场与智能体演进背景

演讲者指出,过去一年多智能体被广泛讨论,到 2026 年已在前沿场景中落地,例如调查故障、处理支持工单和核对财务。OpenAI 内部从工程到财务、市场都在使用智能体,其中 Codex 与 ChatGPT Work 是重要实践。随着模型能力增强,GPT-6 Astra 等模型能够从头到尾完成更大任务,但每当模型能力提升,外围软件也必须随之改变。团队的做法已从在推理栈上加一个 API 端点,演进为构建完整的 harness 即服务。本段同时提出两个问题:如何构建该 harness,以及为何将其通过 Agents API 开放。

开场提出的核心概念:从API端点演进到整体harness即服务,作为本段的代表性画面锚点

01:45 从 Assistants API 到 Agents API 的演进

Assistants API 曾尝试提供托管工作流,包括文件搜索和代码解释器,但当时模型大约只能用这些工具完成几秒钟的工作流。GPT-6 Astra 则能有效使用数十种工具,持续数小时甚至数天。随着推理模型出现,团队于 2025 年推出 Responses API,使开发者能够发送和接收文本、图像、推理等多种内容,成为 Codex 与 ChatGPT Work 的基础。Codex 位于 Responses API 之上,为智能体提供执行编码、编辑演示文稿、使用浏览器等工作的能力。Agents API 则位于更上层,使开发者无需自行运营大规模 harness 即可实现业务自动化。2025 年推出的本地 Agents SDK 原本面向希望完全掌控智能体的团队,但许多团队更希望由 OpenAI 运营 harness,并就工具、沙箱和密钥管理等问题寻求建议。

API 分层示意图,展示 responses API 与 Agents API 的层级关系
Codex 构建在 responses API 之上的架构示意
Agents API 托管服务的产品架构示意

05:02 将本地 harness 搬到云端的三大工程难题

原本的 Codex harness 默认运行在本地电脑上,可直接读取文件系统并查看执行结果。要将其放入云端,必须把 harness 与执行命令的环境分离,使开发者既可以使用自有沙箱,也可以由 OpenAI 托管沙箱。这带来了通信问题:模型发出列出目录等命令时,系统需要找到该会话对应的环境,将命令送达并快速返回结果,同时保证多个环境中各会话的命令与结果相互隔离。命令不再是本地调用,而要跨越网络连接。团队将这些问题归纳为三类:如何让本地设计的 harness 在云端安全运行;如何在智能体自行决定步骤时向开发者呈现过程;如何在长时间任务中,即使部署新代码或服务器故障,也能保持状态。目前,Agents API 已支持自带沙箱或使用 OpenAI 提供的沙箱,并新增了 API 中的计算机使用能力,可在 OpenAI 托管环境中操作 GUI。

API 新增计算机使用(GUI 操作)功能的产品演示画面

07:31 向用户展示智能体的执行过程

智能体的执行路径无法预先确定,它会依据用户提示和工具结果决定打开哪些文件、尝试何种方法,甚至将部分工作交给其他智能体。对于长时间任务,用户仍需要了解进展,判断智能体是在推进还是已经卡住。最初团队认为提供原始工具调用和模型响应即可满足开发者需求,但实践证明不够。某内部团队在多轮对话场景中,需要按轮次可视化工具调用与响应,而原有 API 设计无法直接提供这种轮次关系。开发者若自行追踪,就要重建 harness 中本应由平台管理的部分。因此团队在 API 中补充了轮次信息,使开发者无需从头重建完整对话即可呈现工作过程。这说明在将 harness 作为服务提供时,许多设计决定会影响哪些工作可以交给 OpenAI、哪些仍需开发者处理,以及可能遇到的问题。

核心问题:智能体工作时向用户展示什么

09:18 长时间任务中的上下文压缩与状态管理

智能体工作时间越长,积累的历史越多,即使任务仍在进行,历史也可能超出模型上下文窗口。压缩机制用于解决这一问题,harness 会将有用信息带入后续上下文,使智能体能跨越多个上下文窗口继续工作。否则,每个构建长时运行智能体的开发者都要自行决定如何管理历史。除上下文外,部署也是关键约束:GPT-6 可以连续工作数天,但平台仍需发布新代码,服务器也可能被替换或失效。传统云服务多围绕不到一秒的短请求设计,而智能体会话可能持续数小时,且用户可能在其间调整方向。系统因此必须找到具体会话所在的服务器,并依赖模型推理、存储和工具服务共同保持高可靠性,目标是达到三个九的可用性。若 Codex 崩溃或部署时替换服务器,系统需从中断处恢复,避免重复已执行的动作。例如编辑文件时若连接中断,系统必须同时核对执行环境与 harness 的记录,才能安全继续。Agents API 将这些复杂性封装起来,使开发者可以保留自有环境,并让服务管理长会话。

上下文压缩概念引入,作为长时间任务状态管理的核心话题

11:37 航班改签演示:会话、子代理与人工确认

演示场景是旧金山飞往芝加哥的航班 AL 204 被取消,需要为大量乘客改签。系统会在后台启动多个 Agents API 会话,并分别处理两类较难的案例:一位乘客必须抵达指定机场,另一组四人家庭需要同行。创建会话的代码很短,可指定 OpenAI 托管沙箱、默认关闭网络访问,并让会话流式返回事件以实时更新界面。智能体加载了本地的改签技能文件,并通过能力目录字段共享技能,也可指定插件或 MCP 服务器。搜索航班库存的工具结果只具建议性,可以为机票设置保留,但最终锁定和确认必须由人工完成。智能体还被要求将座位与到达检查委托给两个子代理,并等待二者返回后才发布方案;子代理并发数设为二,更高数值可能增加 token 消耗。第一位乘客 Aaron 的方案被推荐航班并保留座位,等待人工批准。第二位乘客 Ava 的四人订票则经过检查,排除了只剩一个座位的 AL314,以及虽有四个座位却不能保证同座的 AL744。最终生成的 JSON 方案、比较文件和 Python 校验脚本均可在工作区查看。该流程可并行处理大量订单,同时保留每个推荐的依据和人工最终确认。

航班改签仪表盘,展示取消航班及需改签的旅客情况
活动标签页,显示代理已开始执行改签任务
工作区标签页,展示代理对座位与到达时间等检查结果
文件标签页,包含最终方案JSON、备选方案对比和校验脚本

17:08 开发者视角:为何不必自建基础设施

演讲者指出,使用 Responses API 理论上也能实现类似应用,许多构建模块已经存在,但要保证长时间运行的智能体流畅稳定,仍有大量细节需要处理。借助 Agents API,开发者无需构建和维护底层基础设施,可以专注于应用本身,例如改签规则以及何时需要人工批准变更。由于需要编写、测试和维护的代码更少,开发者也能借助 Codex 更快迭代。目前已有客户在使用该 API:Notion 的外部智能体团队允许用户在 Notion 中分派工作并异步完成,Notion 用户也可将 OpenAI 智能体纳入工作流;Rocketship 将其用于长时间任务,用户可以先分派任务,之后��回来提供反馈;Bain 则用它构建合成受众,即基于真实客户研究的 AI 模拟客户,用于对新产品、广告或问卷提供反馈,同时仍由人类专家检查结果。此外,AWS 用户可通过 Bedrock 托管智能体使用由 OpenAI 驱动的能力,双方共同将 Agents API 的核心能力深度集成到 AWS 中。

开发者构建智能体应用的相关接口概念

18:42 结语:并行智能体拓展开发者的可能性

演讲者认为,随着智能体能够承担的工作越来越多,开发者可以思考如果拥有远超现有规模的人力或时间,会去完成哪些事情。若可以同时调度成百上千个智能体,就可能对每个微服务进行安全漏洞排查,承担以往难以想象的大型软件项目,或同时探索数百种研究路径。通过 API 开放 Codex harness 的意义,正在于让本质上可并行的工作可以大规模展开,从而显著扩大可能性的范围。

章节代表画面

结论

04:35 Agents API 是基于 Codex harness 的托管服务,开发者负责定义工具、数据和指令并选择执行环境,OpenAI 负责运行 harness 及相关服务。

06:26 由于 harness 的执行环境可与其分离,开发者可以使用自有沙箱,也可以让 OpenAI 托管沙箱,因此跨环境通信与命令结果隔离成为关键工程问题。

08:33 智能体的执行路径不可预先确定,开发者需要轮次级别的工具调用与响应信息,才能向用户清晰展示长时间任务的进展。

09:35 压缩机制可在上下文窗口接近上限时保留关键信息,使智能体跨越多个上下文窗口持续工作。

11:19 长时间运行的智能体必须精确追踪状态,在部署或故障后从中断处恢复,并同时核对执行环境与 harness 的记录,以避免重复或遗漏动作。

15:28 航班改签演示中,搜索库存的结果只具建议性,座位仅作保留,最终锁定必须经过人工确认。

17:21 Agents API 让开发者可专注于业务规则和应用逻辑,而无需自行构建和维护智能体基础设施。

Harness-as-a-Service:使用 Agents API 构建 | DevDay 2026 · 视频总结 · OctSum