Google Interactions API:连接会话状态与持久执行
原题An Interaction Is All You Need — Ivan Leo, Google DeepMind
看前速览
Google DeepMind 开发者体验团队的 Ivan Leo 介绍 Interactions API 与托管 Antigravity 智能体,展示持久交互状态、类型化步骤、可复用沙箱和凭证注入如何支撑多模态及编程工作流。
interaction ID 在 API 调用之间保留模型上下文与思维签名。
Leo 表示,将前一次的 interaction ID 传回服务端,就能保留会话状态,减少手动管理思维签名的负担,并避免破坏缓存或影响模型表现。
类型化步骤为多模态输出和智能体工具调用提供统一结构。
新数据模型明确标识输出和内容类型,便于应用区分图像、音频、内置搜索、自定义函数及异步步骤。
托管智能体把共用运行框架与持久远端执行环境结合起来。
Antigravity 演示在远端沙箱中检查 GitHub 仓库;environment ID 使后续调用返回相同文件和已安装依赖,资料也可来自 GCS、GitHub 或内联文件。
凭证注入代理让智能体执行请求时不必直接取得密钥。
Leo 描述了由网络代理替换出站请求头中的凭证,使智能体能够访问私有服务而不直接看到令牌;演讲没有提供独立安全评测。
本地技能与具名智能体配置旨在简化部署。
同一运行框架可在本地与云端使用打包好的技能目录;冻结环境、CLI 和迁移技能则帮助开发者建立可重复运行的智能体。
完整摘要
Ivan Leo 从单轮模型补全和函数调用讲起,说明智能体如何利用工具、执行环境和多轮推理完成任务。他将 Interactions API 介绍为连接模型、长时间运行的智能体和多模态生成的统一接口。interaction ID 能在多轮调用中保存服务端上下文与思维签名;类型化输出和 steps 数据模型则让音频、图像、工具调用及异步操作更容易辨认。演示包括把图像生成的上下文传递给视频生成,以及结合 Google Search、URL context 和自定义事件提交工具。托管智能体部分展示 Antigravity 在远端沙箱中分析 GitHub 仓库:environment ID 可将后续请求送回同一文件和依赖环境,资料也能从 GCS、GitHub 或内联文件导入。他还介绍了把本地技能迁移到云端、冻结具名智能体配置,以及通过代理注入凭证,使模型无需直接接触令牌。结尾涉及 Gemini API CLI 和迁移技能。功能演示较具体,但性能、安全、价格与扩展性主要仍是厂商陈述,缺少独立测量。
文字稿
简要说明Brief Description
你所需要的只是一次交互 — Ivan Leo,Google DeepMindAn Interaction Is All You Need — Ivan Leo, Google DeepMind
目录Table of Contents
- 简介Intro
- 交互 API 和托管代理Interactions API and Managed Agents
- 从单次补全到智能体From single completions to agents
- 函数调用Function calling
- 能够推理并采取行动的模型Models that reason and act
- 什么是智能体?What is an agent?
- 在 AI Studio 中试用这些模型Try the models in AI Studio
- 为什么要推出新 APIWhy a new API
- 服务器端状态和思维签名Server-side state and thought signatures
- 演示:串联图像和视频生成Demo: chaining image and video generation
- 代码的工作原理How the code works
- 强类型输出Strongly typed outputs
- 混合使用内置工具和自定义工具Mixing built-in and custom tools
- 步骤数据模型The steps data model
- 托管式智能体:云端 AntigravityManaged Agents: Antigravity in the cloud
- 演示:分析一个 GitHub 仓库Demo: analyzing a GitHub repo
- 具有环境 ID 的持久化沙盒Persistent sandboxes with environment IDs
- 正在加载源:GCS、GitHub、内联文件Loading sources: GCS, GitHub, inline files
- 一项针对 200 万 token 代码仓库的分析A 2M-token repo analysis
- 在本地和云端运行同一个智能体The same agent locally and in the cloud
- 一个注入凭据的代理A credential-injecting proxy
- 具名智能体Named agents
- Gemini API 命令行工具The Gemini API CLI
- 使用 Interactions API 技能进行迁移Migrating with the Interactions API skill
- 总结Wrap-up
引言Intro
大家好,我叫 Ivan,在 Google DeepMind 的开发者体验团队工作。今天我们要介绍全新的 Interactions API,以及我们的新服务 Manage Agents。借用一篇非常著名的论文中的一句话:你只需要一次交互。接下来,在介绍 Interactions API 和全新的 Manage Agents 服务之前,我们先回顾一下过去,梳理一下模型是如何变化的,以及我们与模型交互的方式是如何演变的。最初使用模型时,很多时候你只需要进行一次交互:发送一条消息,比如“给我讲个笑话”,然后就可能收到这样的回复:“为什么科学家不相信原子?因为原子什么都能编出来。”后来,随着模型变得越来越强大,对世界的理解也越来越深入,事情就变得复杂了一些。Hey guys, my name is Ivan. I'm on the developer experience team at Google Demine. And today we're covering the brand new interactions API and our new offering manage agents. And so to take a quote from a very famous paper, an interaction is all you need. Before we move on to what the interactions API is and what the new manage agents offering is let's take a trip down memory lane and let's kind of trace how models have changed and how we've worked with models. So when we first started working with models a lot of times you would have a single interaction you would send a message tell me a joke and then you might get a response for example why don't scientists trust atoms because they make up everything. After a while as models got more and more capable and they understood more about the world this became a bit more complicated.
我们希望将这些模型应用到不同的应用程序中,但要做到这一点,它们必须可靠。为此,我们发明了函数调用,让模型能够生成结构可预测的独立 JSON 对象。比如,当你想注册一个网站时,网页会向后端发送一个包含用户名和密码的 JSON 负载。这样,后端服务器就能知道有一位新用户加入,并创建一个新账户。这使我们能够在这个应用程序的不同环节中使用模型,比如提取用户信息、解析数据等等。但现在,我们正看到模型能力令人难以置信地跃升。模型能够进行推理,并在返回结果之前持续很长一段时间。We wanted to take these models, put them in different applications, but to do so, we needed them to be reliable. And so to do so, we invented function calling, where models could create individual JSON objects with predictable structures. Think like how when you want to register for a website, your web page sends a JSON payload to the back end with a username and a password. And that enables the backend server to say, okay, we have a new user and now we can actually create a new account. that made it possible for us to actually use models in different parts of this application whether it's extracting user information, parsing data and more. But right now we're seeing this incredible cups where models are getting more capable. We're seeing models being able to reason go for very extended periods of time before they come back to people.
因此,你们正从这样一种情况转向另一种情况:最初我们使用补全文本指令和函数,比如可以问:“纽约市的天气怎么样?”模型随后调用天气工具获取数据、消化数据并生成回复;而现在,模型可以使用多种工具。它们能够调用工具,思考并反思回复的含义,与环境交互,最终生成回复。这也让我们回到一个问题:什么是智能体?从根本上说,如果你看看智能体是什么,就会发现其中很大一部分实际上由模型驱动。很多人把它简化为一个循环运行的语言模型。在大多数情况下,这确实如此。如果你有一个能力很强的模型,就会发现随着模型变得越来越强大,很多脚手架式的辅助机制都逐渐不再需要了。And so you're moving from a place where we went from completions instruction and functions where we might ask, hey, what's the weather in New York City? and the model has a call weather tool that it can get that data, ingest it, and generate a response to now a case where models have multiple tools under their belt. They're able to call tools, think and reflect on what the response meant, interact with the environment, and ultimately generate a response. And so this just brings us back to what is an agent. Fundamentally, if you look at what an agent is, it's really a model that powers a huge chunk of it. A lot of people have reduced this to just a language model running in a loop. And for most cases, this is true. If you have a really capable model, you'll find that as we've got models that become more and more capable, a lot of the scaffolding has fallen away.
很多模型,例如最新的 Opus 模型或 Fable 模型,现在都会直接使用 bash 工具,而不是像我们以前那样使用编辑文件或读取文件等专门工具。所以,我们真正拥有的是一个语言模型,它用来理解上下文和用户意图,并配备了一系列不同的函数和资源,可以通过这些函数和资源与环境交互。它还具备短期记忆和长期记忆,用来跟踪自己遇到过的内容,以及一个可供其执行函数的环境。比如,如果你在构建一个编码智能体,却没有为它提供一个能够实际执行代码的环境,那它就什么也做不了。如果你想试用我们的任何模型,最简单的方式其实是使用 AI Studio。A lot of models, for example, the latest Opus models or fable models are now just immediately just using a bash tool instead of individually specialized tools like a edit file or a read file tool like we used to do. And so really what we have is a language model that's used to understand the context, the user's intent that's given a bunch of different functions, all different resources that it then interacts with its environment in. It has some short-term memory and some long-term memory to keep track of what it's encountered and then an environment to execute functions in. If you're building a coding agent, but you don't give it an environment where it can actually execute code, for example, it's not going to be able to do anything. And so if you'd like to try any of our models, the easiest way to do so is actually with AI Studio.
所以我想特别指出,我今天的演讲者备注其实是在 AI Studio 上编写的。我在演讲前两分钟才用 vibe coding 把它做出来。呃,你们可以看到这边的对话历史。我当时就说:“我需要一个适配移动设备的网站,可以让我输入演讲者备注,因为我发现自己没法使用演讲者视图。”于是我只是给了它一些简短的指示,没过多久,一个简单易用、毫不费力就能上手的应用就做好了,而且还部署在一个所有人都能访问的网站上。 我们的免费套餐确实非常慷慨。我大多数演讲都只用免费套餐,幸好还没用到 Google 的无限 token。我觉得这是体验我们模型的最佳方式。无论是新的语音到语音翻译模型——你用英语说话,它就能翻译成任何语言——还是你想试试我们的最新模型,比如 Gemini 3.5 Flash 等等。And so I actually like to point out that my speaker notes today were actually coded on AI Studio. I vived it out 2 minutes before this talk. Uh you'll see the um you can see the conversation history over here. Um I literally said I need a mobile responsive website that I can pass in speaker notes because I found out I wasn't going to be able to use presenter view. And so what I did, I just gave it some brief instructions and before you know it, you have a simple application that you can use without any hassle deployed on a website that's accessible to all. So we have a really generous uh free tier for most of my presentations. I've just been using the free tier. I haven't been using my Google unlimited tokens thankfully. And I think it's the best way for you to try our models. Whether it's our new speechtospech translation models where you take in some you speak in let's say English and it can translate to any language or you know you want to try our latest models like the Gemini 3.5 flash etc.
通过简化的界面开关,你可以非常轻松地调整所有不同的参数。接下来我们来谈谈 Interactions API。我们看到的一种情况是,尤其是从模型转向模型与智能体并存的模式之后,我们希望支持的工作负载类型发生了显著变化。通过 Gemini API,你可以使用 Nano Banana,也可以使用 Gemini 3.5 Flash;但你也可以使用能力很强的智能体,例如深度研究智能体。它运行时间可能长达三分钟甚至更久。你与它交互,给它某种研究计划,然后它会自行开展工作,最终生成非常深入、详尽的研究报告。现在,要通过一大堆不同的端点来使用模型和智能体,确实很难。It makes it very easy for you to do so with simplified UI toggles to just be able to tune all of the different parameters. So let's talk about the interactions API. Now one of the things that we've seen especially as we've moved from models to a dynamic where now we have models and agents is that the kind of workloads that we want to support have changed significantly right through the Gemini API you have nano banana you have you know Gemini 3.5 flash but you also have very capable agents like the deep research agent that's going to run for anywhere from three minutes and more you interact with it you have some sort of research plan it's going to go out and do its own thing and it comes like a very deep and detailed research reports. Now, it's pretty difficult then to think about consuming models and agents through a whole bunch of these different endpoints.
此外,对于许多较旧类型的 API 端点来说,很多数据都位于层级非常深的嵌套对象中。你可以想象,我们在构建第一方集成时遇到了怎样的困难。我们希望支持这样的用例:你可以生成一张 nanobanana 图像、做一些研究,再据此生成一张 VO 图像,或者启动各种不同的智能体,让它们各自去完成自己的任务。因此,Interactions API 就是我们针对这一问题提出的解决方案:我们希望构建一个能够支持所有这些不同用例、也便于我们自行扩展的 API。当你着眼于将 Gemini 引入整个 Google 生态系统时,最好的起点就是服务器端状态。尤其是在使用新一代 Gemini 模型时,你会发现,我们有一种叫作思维签名(thought signatures)的机制:当你与模型交互、模型调用函数或给出响应时,它会传回一串非常不透明的数字。Additionally, for a lot of the older kind of API endpoints, a lot of the data was in in very deeply nested objects. And so you can imagine the kind of difficulties that we had ourselves when we were building in first-party integrations. And we wanted these use cases where you might be able to generate a nanobanana image, do some research, generate a vo image from there or spawn out all these different agentic kind of like agents that go out and do their own thing. And so the interactions API is our sort of solution to this as we look to build an API that can support all of these different use cases and ones that we can build on ourselves. you look to bring Gemini across the entire surface of the Google ecosystem. So the best place to get started is just with serverside state. One of the things that you'll realize especially as you use the new Gemini series of models is that we essentially have this thing called thought signatures where if you interact with the model, if it calls a function, if it gives a response, it's going to pass back a very opaque series of these numbers.
对很多人来说,手动管理这一切非常困难。有时我们和不同的初创公司交流时发现,他们只因为误加了一个空格,就丢失了缓存。现在有了 Responses API,你可以看到,在首轮中,你说:“嗨,我叫 Phil。”在回复中,我们会提供一个 interaction ID。只要你在第二轮的 previous interaction ID 参数中把同一个 interaction ID 传回给我们,所有上下文就都会保留下来。这对新一代 Gemini 模型尤为重要,因为如果你没有把那些 thought signatures 传回给我们,就会发现性能有所下降。 但这还能解锁什么功能呢?你可以看到我们团队的 Vampsy 制作的演示,效果非常惊艳:只用一张照片,就能通过 Nanovana 生成你身处不同国家和地点的各种不同版本。For a lot of people, manually managing this was very difficult and sometimes when we talked to different startups, we found that they would lose their cache just with a single whites space that they mistakenly added in. So now with the responses API, you can see on the first turn, hi, my name is Phil. And in the response, we give you a interaction ID. And as long as you give us back that same interaction ID under the parameter previous interaction ID that you'll see in the second turn, all that context is preserved. And this is really important with the new Gemini series of models because if you don't give us back those thought signatures, you're going to see a decrease in performance. But what else does this unlock? Here you see a demo built by Vampsy from our team that did an incredible demo where using a single photo, you could generate with Nanovana all these different variations of yourself in different countries and different locations.
这些单独的照片各自都是一次交互,不过你可以从最初的一次 API 调用来理解。它会触发所有这些不同的交互调用。利用这些交互,我们再使用同一个交互 ID 和刚刚发布的新 Omni 模型生成视频。要不是那边的 Philip 构建了 interactions API,这样的事情是不可能实现的。所以我得说,这确实是一项非常了不起的工作。举个例子,让你了解构建类似功能需要做些什么,其实只需要这些步骤。首先,传入 Gemini 3.1 Flashlight Image,生成一张我在威尼斯的照片。然后拿到交互 ID,把它传回 client.create,这次指定使用我们周三发布的 Omni Flash 模型。Each of these individual photos are a single interaction, but you can think of it from an initial API call. It spawns all these different interaction calls. Using those interactions, the same interaction ID, we then generate a video using the interaction ID and the new Omni model that we just launched. Something like this would not have been possible without the interactions API built by Philip over there. So, actually, it's a really incredible piece of work, I will say. So, to give you an example, an idea of what it would take to build something similar, this is all it would take. First, you pass in Gemini 3.1 flashlight image, generate an image of me in Venice. You take the interaction ID, you chunk it back into the client.create, and this time you specify that you want the Omni flash model instead that we launched on Wednesday.
这样,你现在就可以在所有这些调用中使用同一个 Omni 模型,并共享相同的信息、同类图像以及相同的上下文。这让我们能够构建更复杂、更丰富的应用,尤其是这些非常复杂的智能体应用。音频生成也是如此。看底部,你会发现现在有了 output.type。过去,你必须处理像 completions audio 这样层级很深的对象,还得自己把它嵌套好,这会非常棘手。我现在甚至都没法凭记忆说出具体结构。但现在,所有输出都由明确的类型清晰标记。如果是音频,就像你在这里看到的那样,你只需要解析并相应地处理它,对吧?不过,如果我现在想生成图像呢?And that allows you to now use the same Omni model with the same information, the same kind of images, and the same context throughout all these calls. It's making it possible to build more complex, rich, and just these really complex agentic applications. The same thing occurs with audio generation. If you look at the bottom, you see that now we have output.type. In the past, you would have to take this very nested object like completions audio. And it would be very tricky for you to nest it out. I can't even remember it off the top of my head. But now, every single bit of the outputs that come out are clearly demarcated by a strong type. If it's an audio, as you see over here, all you got to do is just parse it and handle it accordingly. Right? But what happens if now I want to generate an image?
那里用的是同一种方法:client.interaction.create。我只需要修改响应模态和生成配置。现在我有了一个 output.type 为 image 的输出。这让我可以非常轻松地开始构建 Gemini 应用并进行实验。工具调用也是如此。你可以混合搭配各种内置工具,这是以前做不到的。例如,我们正在尝试让一个代理上网查找有关 React 应用的最新安全报告。我们授予它访问 Google 同样的索引的权限,工具类型为 Google 搜索。我们还赋予它使用随附的 URL context 工具从网页中检索信息的能力。此外,我们还提供了一个名为 file incident 的自定义工具。模型可以自主推理,判断自己需要哪些信息,然后在一次 API 调用中为你生成回复。It's the same method over there, client.interaction.create. All I got to do is just modify the response modality and the generation config. And now I have an output.type of image. And this makes it very easy for me to start building and experimenting with Gemini. The same thing comes with tool use. You can mix and match different inbuilt tools that wasn't possible before. For example, over here we're trying to get an agent to look up the internet to find the latest security reports for the React application. We've given it access to the same index that Google has with type Google search. We've given it the ability to be essentially retrieve information from web pages using the URL context tool that we ship with. And we've given it a custom tool here called file incident. The model can reason autonomously on its own, figure out what information it needs, and then actually generate a response for you all in a single API call.
这让它变得非常强大,因为现在模型不仅能够处理训练数据截止日期之前的信息,也能处理之后的信息,因为它们现在可以访问整个互联网。这一切都归结为我们新的 steps 数据模型:过去,我们只有一条发送给模型的消息和一个回复;而现在,我们将处理非常复杂的情况,例如异步工具调用、多个模型协同工作等。我们希望确保有一种强大的数据结构来支持这些场景。因此,我们引入了 steps 数据模型,用一个严格的判别字段取代了原有的 legacy outputs 数组,清楚地标明每个步骤中模型输出了什么、dot signatures 是什么、调用了哪些函数,尤其是生成的内容是什么。This makes it very powerful because now you have models that not only can work with information at their training cut of date but beyond because now they have access to the entirety of the internet. And all this boils down to the new steps data model that we have where instead of a world where we have a single message sent to a model and a response, we're going to have very complex things like async tool calls models working together, right? And we want to make sure we have a strong kind of data structure to support this. And so we've introduced the steps data model which replaces the original legacy outputs array with a tight discriminator that makes it very clear at each step what the model output what the dot signatures were what the functions called were and especially when it comes to the content is being generated.
之前你看到过 content.type,其中有 audio 和 video,这让我们能够轻松地构建这类多模态流水线,而这是 Gemini 模型系列独有的能力。我们推出的第二项功能是将 Anti-gravity 作为远程代理,也就是我们所说的托管代理。因此,我们统一采用 Anti-gravity harness,覆盖 Google 全系列产品。你刚才看到的 AI Studio 中,网站是由 Anti-gravity 代理构建的。在 Anti-gravity 应用中,你使用的也是 Anti-gravity 代理。这个 harness 的能力非常强,我们还用它对 Gemini 进行了联合训练。展望未来,我认为开箱即用地使用这个 harness 会让你获得诸多提升。如果你过去想构建一个编程代理,首先就得对 harness 进行调优。Earlier you saw content.type where it was audio and video and these makes it easy to build these multimodal pipelines in a way that only the Gemini model families can. The second thing that we've launched is anti-gravity as a remote agent as what we like to call manage agent. So we've standardized around using the anti-gravity harness across all of our Google suite of products. In AI studio, which you saw just now, websites are built with the anti-gravity agent. In the anti-gravity application, you're also using the anti-gravity agent. Now, this is a very capable harness that we've co-rained Gemini on. And moving forward, I think you're going to see many gains if you use this harness out of the box. If you wanted to build a coding agent in the past, you would first have to tune the harness.
然后你就得找到一个沙箱提供商、管理基础设施,接着想办法保留上下文,尤其是在不同运行之间保留上下文。但有了 anti-gravity 管理代理,你开箱即用就能获得一个持久化沙箱。只需调用一次 API,你就能获得一个可以反复调用的沙箱,并将其当作个人 claw 使用,无需进行任何修改。这里有一个示例:我们想分析 GitHub 仓库中的内容。于是,我们通过 API 调用将任务交给 anti-gravity 代理,它随后会启动一个远程沙箱,并开始调查这个仓库的内容。你可以看到,它会调用 list file 来获取工作区中的文件,然后逐个读取文件,最后生成一份报告。所有这些都在远程沙箱中完成,无需我们这边进行任何干预。Then you had to find a sandbox provider, manage the infrastructure, and then kind of figure out way how to preserve the context, especially in between runs. But with the anti-gravity manage agent, you get a persistent sandbox out of the box. With a single API call, you get a sandbox that you can keep hitting and treat as a personal claw without any sort of modifications. You can see an example over here where we want to analyze what's in a GitHub repository. We then pass it over in an API call over to the anti-gravity agent and it then boots up a remote sandbox and then starts investigating what the repository is about. You can see it calls a list file to get what's in the workspace. It then reads each individual file and then it generates a final report. All of this is happening in a remote sandbox without any sort of intervention from our site.
该代理能够自主进行研究、推理并处理所有这些内容。我们还支持多状态持久化沙箱,就像之前提到的那样:只要保留我们返回给你的环境 ID,就能将请求路由回你之前使用的原始沙箱。因此,我们为你提供了两个基本机制:交互 ID,让你能够保留并利用上下文,确保缓存不会失效;以及环境 ID,让你能够将请求路由到完全相同的上下文。这样,你就可以使用同一个沙箱,无需管理任何状态持久化,只需添加几行代码即可。我们还尝试通过另一种方式让你更轻松地加载数据源。很多时候,你可能会有自定义依赖项。The agent's able to research, reason and handle all of this autonomously. We also handle multi-state persistent sandboxes like what we mentioned earlier where as long as you preserve the environment ID that we returned to you, you're able to route it right back to the original sandbox that you had. So these are two primitives that we given you. The interaction ID where you're able to preserve and work with context and ensure you're not busting your cache and the environment ID that enables you to route it to the exact same context. And so this way you can use the same sandbox. You don't need to manage any sort of persistence of state and all you need to do is just add a few lines of code. The other way we've tried to make it easy is for you to be able to load in sources. A lot of times you might have custom dependencies.
你可能有 EMD 文件或辅助文件,想把它们放到这个特定的沙箱中。因此我们支持 Google GCS 存储桶、GitHub 仓库和内联文件。你在这里看到的是一个演示,它接续了我们之前进行的调用。我们传入环境 ID,模型拿到的文件与上次离开时完全相同。只要你在每一轮都传回交互 ID 和环境 ID,无论你安装了什么软件包,或放入并创建了什么文件,模型都能访问它们。这种用法并不局限于使用托管代理处理非常简单的任务。你在这里看到的是一次运行:模型消耗了超过两百万个 token,试图分析一个我们在黑客马拉松上拿到的仓库;有人从零开始构建了一门完整的编程语言,用于编写强化学习环境。You might have EMD files, helper files that you want to throw on the on this specific sandbox. So we support Google GCS buckets. We support GitHub repositories and inline files. And so what you see over here is a demo whereby it continues off the previous call that we did. We're passing in the environment ID and the model has the exact same files right where we left it. any sort of packages you install, any sort of files you throw and create, the model has access to it through each and every turn as long as you passes back the interaction ID and the environment ID. This isn't just the sort of constraint to very simple task with the manage agent. What you're seeing over here is a run where the model burnt over two million tokens trying to analyze a repository that we got for a hackathon where someone built from scratch an entire programming language to code reinforcement learning environments.
如果你用过 Scratch 编程语言,就会知道它是一种拖放式语言,可以让一些简单的角色动起来。但在这里,只需调用一次 API,我们就能分析整个代码仓库,其中包含自定义 DSL、网页、各种模式,以及在 HUD 中运行的 RL 训练循环。这为你打造高度定制且性能出色的智能体创造了更多可能,而你不必处理底层基础设施,也不必调整运行框架。使用反重力智能体最棒的一点是,从根本上说,它和运行在你的反重力 IDE 中的是同一个智能体。这意味着,如果你有一些已经在本地调优过的工作流,也有一些精心打磨过的技能,那么只要对这些技能感到满意,就可以把它们打包到一个文件夹里。If you've ever used the Scratch programming language, it's a drag and drop language where you can kind of get simple characters to move. But over here with a single API call, we're able to analyze an entire repository that has a custom DSL, a web page, a whole bunch of like schemas, and an RL training loop running inside HUD. And so it really opens up this kind of opportunities for you to build these very custom and performant agents without you having to handle the underlying infrastructure or tune the harness. The best part about using the anti-gravity agent is that fundamentally it's the same agent running in your anti-gravity IDE, which means that if you have certain workflows that are you've tuned locally, you have skills that you've made sure are great, you can once you're happy with those skills, you just package it into a single folder.
我们允许你以同样的方式,将源文件上传到 agents 文件夹,这样你的智能体在本地和云端运行时,就能使用完全相同的技能、智能体运行框架和提示词。等你准备好,或者对智能体在本地的运行情况感到满意后,就可以将它推送上去,一切都会按预期运行。 公司经常会问我们的下一个问题是:“嘿,我需要确保我的智能体安全。如果它泄露了网络凭据,我该怎么办?”为此,我们实现了一个中间人代理。这意味着什么呢?很多时候,你需要调用不同服务提供商的 API,比如 Gemini API;你可能还需要下载私有的 GitHub 仓库,等等。我们有一个代理位于中间,因此无论你的模型发起什么调用,我们都会检查请求头,并可以随时替换其中的内容。We allow you to upload the same way using the sources into into agents folder and that gives your agent the exact same skills with the same agent harness and the same prompt running locally and in the cloud. When you're ready or when you're comfortable with what your agent is doing locally, you can then push it up and everything works as intended. The next question we often get from companies are, "Hey, I need my agent to be secure. What am I going to do if my agent leaks a network credential?" And to do so, we've implemented a man-in-the-middle proxy. So, what does this mean? A lot of times, you need to make API calls to different providers, say the Gemini API. You might need to download private GitHub repositories, etc. We have a proxy that stands in the middle and so any call your model makes we will look at the header and we can replace items at will.
你在这里看到的是一种情况:我们会动态地将令牌注入到每一个发往 GitHub API 的出站调用中。因此,即使模型以某种方式遭到提示注入并泄露了你的 GitHub API 令牌,它也永远不会真正看到这个令牌。它只会执行调用 GitHub API 的代码,而你的令牌不会暴露。一旦你对智能体的表现感到满意,并且已经把它配置妥当,我们会提供两种不同的方式,让你基本上可以将它配置并设置为一个命名智能体,就像你一直在使用的 anti-gravity preview 智能体一样。第一种方式是将它固定下来,使用一组特定的配置文件和网络来源。你在左边看到的就是这种方式。我正在基于 anti-gravity preview 基础智能体创建一个数据分析师智能体,并在这里为它设置了一些基础环境配置,其中只有一个 GCS 技能。What you see over here is a case where we'll transform every single outbound call to the GitHub API with an inject in the token dynamically. And so even if the model is somehow prompt injected and leaks your GitHub API token, it's never actually going to see the token. It's only going to execute code that will run against the GitHub API and your token is never exposed. Once you're comfortable with how the agent is performing, you've set it up well, we give you two different ways for you to basically configure and set it up as a named agent, much like you've been using the anti-gravity preview agent. The first one is to freeze it with a certain set of configured files and network sources. That's what you're seeing on the left here. I have a data analyst agent that I'm creating from the anti-gravity preview base agent with some base environment configurations here, just a GCS skill.
我们允许你进行这种操作的另一种方式,是通过与智能体反复聊天,按你的喜好搭建环境。比如,你可能需要某些依赖项或软件包,也可以将某个环境固定为特定智能体,之后所有调用都可以基于它进行。设置满意后,你就能非常轻松地扩展工作负载。目前,我们最多支持一千个命名智能体,这意味着你可以拥有各种不同的配置,而且无需支付任何存储费用。沙箱也不收费,你只需为模型付费。我们已经优化了基础设施,使其能够高效处理这类工作负载。我们非常期待看到大家会用它构建出什么。The other way that we allow you to do so is by chatting iteratively with an agent to set up an environment as you like. For example, you might want certain dependencies, you might want certain packages, and you can freeze an environment as a specific agent and all your subsequent calls kind of go through that. Once you're happy with that, it makes it very easy for you to scale up your workloads. At this point, we support up to a thousand named agents, which means that you can have all these different configurations and you don't pay for any of the storage. You don't pay for you don't pay for the sandbox. you only pay for the model. We've optimized our infrastructure to be very performant to be able to handle a workload like this. And we're pretty excited to see what people are going to build.
最近,我们还开源了一个新的 Gemini API CLI。这是一个简单的 CLI,你可以用它快速上手 Gemini 模型,通过简单的 CLI 命令在本地测试这些模型。它的另一个好处是,你可以在本地使用你的编程代理或 Anti-gravity 代理迭代代码。准备就绪后,它会将代码打包成一个文件夹并直接上传,然后为你创建一个代理。最后,如果你正在考虑迁移到 Interactions API——我们所有的新模型都将接入这个 API——我们还创建了一项新的 Interactions API 技能,你可以将它提供给自己喜欢的编程代理,这样基本上就能顺利完成迁移,不会遇到任何问题。我相信大家都遇到过这种情况:你让 Gemini 实现某种特定的功能,它却一直使用 Gemini 2.5 Flash 或 Gemini 2.0。Recently, we've also out open sourced a new Gemini API CLI. This is a simple CLI that you can use to get started working with the Gemini models to test out the models locally using simple CLI commands. The other benefit of this is that you're going to be able to iterate on your code on your coding agent or your anti-gravity agent locally. And once you're ready, it packages it as a single folder and uploads it straight and creates an agent for you. Lastly, if you're thinking of switching over to the interactions API, which is where all of our new models will be on, we've also created a new interactions API skill that you can feed to your favorite coding agent and that will then basically allow you to do the migration without any issues. I'm sure you guys have faced issues where you've asked Gemini to implement a specific kind of uh implementation and it keeps using Gemini 2.5 flash or Gemini 2.0.
因此,我们的做法是确保模型列表始终保持最新。各种方法也都会及时更新。我们还提供了大量技能,就像 Philip 昨天提到的那样,我们会定期对它们进行评估,确保它们确实能实现我们的目标,也就是让你能够顺畅地使用 Gemini 并基于 Gemini 进行开发。我的演讲就到这里。呃,非常感谢大家前来参加,也感谢大家留下来听完本次会议。希望大家都能开始尝试。我会在旁边,如果大家对新的 API 有任何问题,欢迎来问我。And so we what we do is we make sure we keep up to date the list of all the different models. We keep up to date all the different methods. We provide a good bunch of skills and like Philip mentioned yesterday, we regularly evaluate these and make sure make sure that they're actually doing what we want them to do, which is allowing you to use Gemini and build on Gemini well. So that's the end of my talk. Uh, thank you so much for coming by and staying around for the round of the conference. And yeah, I hope you guys get started. I'll be on the side if you guys have any questions about the new API.
交互 API 与托管智能体Interactions API and Managed Agents
大家好,我叫 Ivan。我在 Google Demine 的开发者体验团队工作。今天我们要介绍全新的 Interactions API,以及我们的新产品 Manage Agents。借用一篇非常著名的论文中的一句话:你只需要交互。接下来,我们先来看看 Interactions API 是什么。Hey guys, my name is Ivan. I'm on the developer experience team at Google Demine. And today we're covering the brand new interactions API and our new offering manage agents. And so to take a quote from a very famous paper, an interaction is all you need. Before we move on to what the interactions API is
从单次补全到智能体From single completions to agents
那么,新的代理管理服务是什么呢?让我们回顾一下过去,梳理模型是如何变化的,以及我们是如何与模型协作的。最初开始使用模型时,很多时候只有一次交互:你发一条消息,比如“给我讲个笑话”,然后可能会收到这样的回复:“科学家为什么不相信原子?因为原子什么都能编造。”后来,随着模型能力越来越强,对世界的理解也越来越深入,事情就变得复杂了一些。我们想把这些模型应用到不同的应用程序中,但要做到这一点,就需要确保它们可靠。于是,我们发明了函数调用,其中……and what the new manage agents offering is let's take a trip down memory lane and let's kind of trace how models have changed and how we've worked with models. So when we first started working with models a lot of times you would have a single interaction you would send a message tell me a joke and then you might get a response for example why don't scientists trust atoms because they make up everything. After a while as models got more and more capable and they understood more about the world this became a bit more complicated. We wanted to take these models, put them in different applications, but to do so, we needed them to be reliable. And so to do so, we invented function calling, where
函数调用Function calling
模型可以创建结构可预测的独立 JSON 对象。想想你注册网站时的情形:网页会向后端发送一个包含用户名和密码的 JSON 负载。这样,后端服务器就能说:“好,我们有了一位新用户,现在可以创建一个新账户了。”这使我们能够在这个应用程序的不同部分中使用模型,无论是提取用户信息、解析数据,还是处理其他任务。但现在,我们正看到模型能力突飞猛进。我们看到模型已经能够……models could create individual JSON objects with predictable structures. Think like how when you want to register for a website, your web page sends a JSON payload to the back end with a username and a password. And that enables the backend server to say, okay, we have a new user and now we can actually create a new account. that made it possible for us to actually use models in different parts of this application whether it's extracting user information, parsing data and more. But right now we're seeing this incredible cups where models are getting more capable. We're seeing models being able
能够推理并采取行动的模型Models that reason and act
模型可能会进行很长时间的推理,然后才会回应用户。因此,我们正从这样一种情况转变:从补全、指令和函数出发,我们可能会问:“纽约市的天气怎么样?”模型可以调用天气工具获取数据、将其纳入处理,然后生成回答;而现在则进入了这样一种情况:模型掌握了多种工具。它们能够调用工具,思考并反思响应的含义,与环境交互,并最终生成回答。to reason go for very extended periods of time before they come back to people. And so you're moving from a place where we went from completions instruction and functions where we might ask, hey, what's the weather in New York City? and the model has a call weather tool that it can get that data, ingest it, and generate a response to now a case where models have multiple tools under their belt. They're able to call tools, think and reflect on what the response meant, interact with the environment, and ultimately generate a response.
什么是智能体?What is an agent?
所以这又让我们回到了一个问题:什么是智能体?从根本上说,如果你看看智能体是什么,就会发现它很大一部分其实由一个模型驱动。很多人把它简化成一个在循环中运行的语言模型。在大多数情况下,这确实如此。如果你有一个能力很强的模型,就会发现,随着模型变得越来越强大,很多脚手架都逐渐消失了。例如,很多模型,像最新的 Opus 模型或 Fable 模型,现在会直接使用 bash 工具,而不再像过去那样分别使用专门的工具,比如编辑文件或读取文件的工具。所以,我们真正拥有的是一个语言模型,它用来理解上下文和用户意图;它获得一系列不同的函数和资源,然后通过这些与环境交互。And so this just brings us back to what is an agent. Fundamentally, if you look at what an agent is, it's really a model that powers a huge chunk of it. A lot of people have reduced this to just a language model running in a loop. And for most cases, this is true. If you have a really capable model, you'll find that as we've got models that become more and more capable, a lot of the scaffolding has fallen away. A lot of models, for example, the latest Opus models or fable models are now just immediately just using a bash tool instead of individually specialized tools like a edit file or a read file tool like we used to do. And so really what we have is a language model that's used to understand the context, the user's intent that's given a bunch of different functions, all different resources that it then interacts with its environment in.
它有一些短期记忆和长期记忆,用来追踪自己遇到过的内容,还有一个可供执行函数的环境。例如,如果你在构建一个编程智能体,却没有给它提供一个能实际执行代码的环境,那它就什么也做不了。It has some short-term memory and some long-term memory to keep track of what it's encountered and then an environment to execute functions in. If you're building a coding agent, but you don't give it an environment where it can actually execute code, for example, it's not going to be able to do anything.
在 AI Studio 中试用这些模型Try the models in AI Studio
所以,如果你想试用我们的任何模型,最简单的方式其实是使用 AI Studio。我还想特别提一下,我今天的演讲备注其实就是在 AI Studio 上写出来的。我在这场演讲开始前两分钟才用 vibe coding 把它做出来。嗯,你们可以看到这里的对话历史。我当时直接说:“我需要一个适配移动设备的网站,可以让我输入演讲备注”,因为我发现自己没法使用演示者视图。于是我只是给了它一些简短的指示,没过多久,一个简单的应用就做好了,可以毫不费力地使用,并部署在一个所有人都能访问的网站上。我们为大多数使用场景提供了非常慷慨的免费套餐。我之前的演讲基本都在用免费套餐。谢天谢地,我还没用上 Google 的无限 token。And so if you'd like to try any of our models, the easiest way to do so is actually with AI Studio. And so I actually like to point out that my speaker notes today were actually coded on AI Studio. I vived it out 2 minutes before this talk. Uh you'll see the um you can see the conversation history over here. Um I literally said I need a mobile responsive website that I can pass in speaker notes because I found out I wasn't going to be able to use presenter view. And so what I did, I just gave it some brief instructions and before you know it, you have a simple application that you can use without any hassle deployed on a website that's accessible to all. So we have a really generous uh free tier for most of my presentations. I've just been using the free tier. I haven't been using my Google unlimited tokens thankfully.
我认为这是你尝试我们模型的最佳方式。无论是我们全新的语音到语音翻译模型——你用比如英语说一段话,它就能把内容翻译成任何语言;还是你想试试我们最新的模型,比如 Gemini 3.5 Flash 等,都可以通过简洁的 UI 开关轻松调整各种参数。那么,我们来谈谈……And I think it's the best way for you to try our models. Whether it's our new speechtospech translation models where you take in some you speak in let's say English and it can translate to any language or you know you want to try our latest models like the Gemini 3.5 flash etc. It makes it very easy for you to do so with simplified UI toggles to just be able to tune all of the different parameters. So let's talk about the
为什么需要一个新的 APIWhy a new API
交互 API。现在,我们注意到的一点是,尤其是当我们从模型转向模型与智能体并存的动态时,我们希望支持的工作负载类型发生了显著变化。通过 Gemini API,你可以使用 Nano Banana,也可以使用 Gemini 3.5 Flash;但你也可以使用功能强大的智能体,例如深度研究智能体。它可能会运行三分钟甚至更久:你与它交互,它会制定某种研究计划,然后自行开展工作,最后生成非常深入、详尽的研究报告。这样一来,要通过一大堆不同的端点来使用模型和智能体,就相当困难了。此外,对于许多较早的 API 端点,很多数据都藏在层层嵌套的对象中。interactions API. Now one of the things that we've seen especially as we've moved from models to a dynamic where now we have models and agents is that the kind of workloads that we want to support have changed significantly right through the Gemini API you have nano banana you have you know Gemini 3.5 flash but you also have very capable agents like the deep research agent that's going to run for anywhere from three minutes and more you interact with it you have some sort of research plan it's going to go out and do its own thing and it comes like a very deep and detailed research reports. Now, it's pretty difficult then to think about consuming models and agents through a whole bunch of these different endpoints. Additionally, for a lot of the older kind of API endpoints, a lot of the data was in in very deeply nested objects.
因此,你可以想象我们在构建第一方集成时遇到过什么样的困难。我们希望实现这样的用例:你可以生成一张 nanobanana 图像、做一些研究,再据此生成一张 VO 图像,或者启动各种不同类型的智能体,让它们各自去完成任务。因此,Interactions API 是我们应对这一问题的解决方案。我们希望构建一个能够支持所有这些不同用例、也能供我们自身继续拓展的 API,以便将 Gemini 带入整个 Google 生态系统的各个领域。最好的入门方式就是从服务器端状态开始。其中一件事……And so you can imagine the kind of difficulties that we had ourselves when we were building in first-party integrations. And we wanted these use cases where you might be able to generate a nanobanana image, do some research, generate a vo image from there or spawn out all these different agentic kind of like agents that go out and do their own thing. And so the interactions API is our sort of solution to this as we look to build an API that can support all of these different use cases and ones that we can build on ourselves. you look to bring Gemini across the entire surface of the Google ecosystem. So the best place to get started is just with serverside state. One of the things
服务器端状态和思考签名Server-side state and thought signatures
尤其是当你使用新的 Gemini 系列模型时,你会发现我们实际上有一种叫作 thought signatures(思维签名)的机制:当你与模型交互、模型调用函数或给出响应时,它会返回一串非常不透明的数字。对很多人来说,手动管理这些内容非常困难;有时我们与不同的初创公司交流时,发现他们只因不小心多加了一个空格,就丢失了缓存。现在使用 responses API 时,你可以看到,在第一轮中你说:“嗨,我叫 Phil。”我们会在响应中提供一个交互 ID。只要你在第二轮的 previous interaction ID 参数中传回同一个交互 ID(你会在第二轮中看到这个参数),所有上下文就都会保留下来。that you'll realize especially as you use the new Gemini series of models is that we essentially have this thing called thought signatures where if you interact with the model, if it calls a function, if it gives a response, it's going to pass back a very opaque series of these numbers. For a lot of people, manually managing this was very difficult and sometimes when we talked to different startups, we found that they would lose their cache just with a single whites space that they mistakenly added in. So now with the responses API, you can see on the first turn, hi, my name is Phil. And in the response, we give you a interaction ID. And as long as you give us back that same interaction ID under the parameter previous interaction ID that you'll see in the second turn, all that context is preserved.
对于全新的 Gemini 系列模型来说,这一点非常重要,因为如果你不把这些思考签名返回给我们,就会发现性能下降。And this is really important with the new Gemini series of models because if you don't give us back those thought signatures, you're going to see a decrease in performance.
演示:串联图像和视频生成Demo: chaining image and video generation
但这还能解锁哪些能力?这里展示的是我们团队的 Vampsy 制作的演示,效果非常惊艳:只用一张照片,就能通过 Nanovana 生成你身处不同国家、不同地点的各种版本。每张照片对应一次单独的交互,但你也可以从最初的一次 API 调用来理解:它会触发一系列不同的交互调用。利用这些交互,我们再使用同一个交互 ID 和刚刚推出的新 Omni 模型,生成一段视频。要不是有 Philip 在那边开发的 Interactions API,这样的效果根本不可能实现。所以我得说,这确实是一项非常出色的成果。But what else does this unlock? Here you see a demo built by Vampsy from our team that did an incredible demo where using a single photo, you could generate with Nanovana all these different variations of yourself in different countries and different locations. Each of these individual photos are a single interaction, but you can think of it from an initial API call. It spawns all these different interaction calls. Using those interactions, the same interaction ID, we then generate a video using the interaction ID and the new Omni model that we just launched. Something like this would not have been possible without the interactions API built by Philip over there. So, actually, it's a really incredible piece of work, I will say.
代码的工作原理How the code works
举个例子,说明要构建类似的东西需要做些什么——其实只要这些步骤。首先,传入 Gemini 3.1 Flash Image,让它生成一张我在威尼斯的图片。然后拿到 interaction ID,把它传回 client.create,这次指定使用我们周三发布的 Omni Flash 模型。这样,你就可以在所有这些调用中使用同一个 Omni 模型,并沿用相同的信息、同类图像和相同上下文。这让构建更复杂、更丰富的应用成为可能,尤其是这类复杂的智能体应用。So, to give you an example, an idea of what it would take to build something similar, this is all it would take. First, you pass in Gemini 3.1 flashlight image, generate an image of me in Venice. You take the interaction ID, you chunk it back into the client.create, and this time you specify that you want the Omni flash model instead that we launched on Wednesday. And that allows you to now use the same Omni model with the same information, the same kind of images, and the same context throughout all these calls. It's making it possible to build more complex, rich, and just these really complex agentic applications.
强类型输出Strongly typed outputs
音频生成也是一样的情况。如果你看底部,会发现现在我们有了 output.type。过去,你得处理像 completions audio 这样层级很深的对象,要把它嵌套起来会非常棘手。我甚至都记不清具体该怎么写了。但现在,所有输出内容都通过明确的类型清晰地标示出来。如果是音频,就像你在这里看到的这样,你只需要解析它并做相应处理即可,对吧?但如果我现在想生成图像呢?方法也是一样的:client.interaction.create。我只需要修改响应模态和生成配置。现在,我就有了一个 output.type 为 image 的输出。这让我可以非常轻松地开始构建和试用 Gemini。The same thing occurs with audio generation. If you look at the bottom, you see that now we have output.type. In the past, you would have to take this very nested object like completions audio. And it would be very tricky for you to nest it out. I can't even remember it off the top of my head. But now, every single bit of the outputs that come out are clearly demarcated by a strong type. If it's an audio, as you see over here, all you got to do is just parse it and handle it accordingly. Right? But what happens if now I want to generate an image? It's the same method over there, client.interaction.create. All I got to do is just modify the response modality and the generation config. And now I have an output.type of image. And this makes it very easy for me to start building and experimenting with Gemini.
混合使用内置工具和自定义工具Mixing built-in and custom tools
工具使用也是如此。你可以将不同的内置工具灵活组合使用,这在以前是不可能的。例如,我们在这里尝试让一个智能体上网查找有关 React 应用的最新安全报告。我们让它能够访问与 Google 相同的索引,并使用 Google 搜索功能。我们还赋予它使用我们提供的 URL context 工具从网页中检索信息的能力。另外,我们还给它提供了一个名为 file incident 的自定义工具。模型可以自主推理,弄清楚自己需要哪些信息,然后在一次 API 调用中为你生成答复。这让它变得非常强大,因为现在你拥有的模型不仅能处理其训练数据截止日期之前的信息,还能处理之后的信息,因为它们现在可以访问……The same thing comes with tool use. You can mix and match different inbuilt tools that wasn't possible before. For example, over here we're trying to get an agent to look up the internet to find the latest security reports for the React application. We've given it access to the same index that Google has with type Google search. We've given it the ability to be essentially retrieve information from web pages using the URL context tool that we ship with. And we've given it a custom tool here called file incident. The model can reason autonomously on its own, figure out what information it needs, and then actually generate a response for you all in a single API call. This makes it very powerful because now you have models that not only can work with information at their training cut of date but beyond because now they have access to the
步骤数据模型The steps data model
整个互联网。而这一切都归结为我们新的 steps 数据模型:我们不再局限于向模型发送一条消息并接收一个回复,而是能够处理异步工具调用、多个模型协同工作等复杂场景,对吧?我们希望确保拥有强大的数据结构来支持这一点。因此,我们引入了 steps 数据模型,用清晰明确的判别字段取代了原有的 legacy outputs 数组,让每个步骤中的模型输出、dot signatures 以及调用的函数都一目了然,尤其是在生成内容时。前面你看到过 content.type,其中包含音频和视频类型;这些设计让构建多模态流水线变得轻而易举,而这只有 Gemini 模型系列才能做到。entirety of the internet. And all this boils down to the new steps data model that we have where instead of a world where we have a single message sent to a model and a response, we're going to have very complex things like async tool calls models working together, right? And we want to make sure we have a strong kind of data structure to support this. And so we've introduced the steps data model which replaces the original legacy outputs array with a tight discriminator that makes it very clear at each step what the model output what the dot signatures were what the functions called were and especially when it comes to the content is being generated. Earlier you saw content.type where it was audio and video and these makes it easy to build these multimodal pipelines in a way that only the Gemini model families can.
我们推出的第二项内容是The second thing that we've launched is
托管式智能体:云端的 AntigravityManaged Agents: Antigravity in the cloud
将 Antigravity 作为远程代理,也就是我们所说的托管代理。我们已统一在所有 Google 全系产品中使用 Antigravity 执行框架。在你刚才看到的 AI Studio 中,网站是由 Antigravity 代理构建的。在 Antigravity 应用中,你使用的也是 Antigravity 代理。这个执行框架能力很强,我们还用它对 Gemini 进行了联合训练。展望未来,我认为直接使用这个执行框架,你会看到许多改进。过去,如果你想构建一个编程代理,首先得调整执行框架,然后寻找沙盒服务提供商、管理基础设施,还得想办法保留上下文,尤其是要确保不同运行轮次之间的上下文能延续下来。但使用 Antigravity 托管代理,你开箱即用就能获得一个持久化沙盒。anti-gravity as a remote agent as what we like to call manage agent. So we've standardized around using the anti-gravity harness across all of our Google suite of products. In AI studio, which you saw just now, websites are built with the anti-gravity agent. In the anti-gravity application, you're also using the anti-gravity agent. Now, this is a very capable harness that we've co-rained Gemini on. And moving forward, I think you're going to see many gains if you use this harness out of the box. If you wanted to build a coding agent in the past, you would first have to tune the harness. Then you had to find a sandbox provider, manage the infrastructure, and then kind of figure out way how to preserve the context, especially in between runs. But with the anti-gravity manage agent, you get a persistent sandbox out of the box.
只需一次 API 调用,你就能获得一个可反复调用的沙盒,并将其当作个人 Claw 使用,无需进行任何修改。With a single API call, you get a sandbox that you can keep hitting and treat as a personal claw without any sort of modifications.
演示:分析一个 GitHub 仓库Demo: analyzing a GitHub repo
你可以在这里看到一个示例:我们想分析 GitHub 仓库中的内容。接着,我们通过 API 调用将其传递给 anti-gravity agent,它会启动一个远程沙盒,然后开始调查该仓库的内容。你可以看到,它会调用列出文件的功能,以获取工作区中的内容。然后,它会逐个读取文件,并生成最终报告。所有这些都在远程沙盒中完成,无需我们这边进行任何干预。这个 agent 能够进行研究、推理并处理所有内容。You can see an example over here where we want to analyze what's in a GitHub repository. We then pass it over in an API call over to the anti-gravity agent and it then boots up a remote sandbox and then starts investigating what the repository is about. You can see it calls a list file to get what's in the workspace. It then reads each individual file and then it generates a final report. All of this is happening in a remote sandbox without any sort of intervention from our site. The agent's able to research, reason and handle all
带环境 ID 的持久化沙箱Persistent sandboxes with environment IDs
自主完成这一点。我们还支持多状态持久化沙箱,就像之前提到的那样,只要保留我们返回给你的环境 ID,就能将请求路由回你之前使用的原始沙箱。因此,我们提供了两个基本机制:交互 ID,让你能够保留并利用上下文,确保缓存不会失效;以及环境 ID,让你能够将请求路由到完全相同的上下文。这样,你就可以使用同一个沙箱,无需管理任何状态持久化,只需添加几行代码即可。我们尝试简化操作的另一种方式,是让你能够加载数据源。很多时候,你可能会有…of this autonomously. We also handle multi-state persistent sandboxes like what we mentioned earlier where as long as you preserve the environment ID that we returned to you, you're able to route it right back to the original sandbox that you had. So these are two primitives that we given you. The interaction ID where you're able to preserve and work with context and ensure you're not busting your cache and the environment ID that enables you to route it to the exact same context. And so this way you can use the same sandbox. You don't need to manage any sort of persistence of state and all you need to do is just add a few lines of code. The other way we've tried to make it easy is for you to be able to load in sources. A lot of times you might have
正在加载源:GCS、GitHub、内联文件Loading sources: GCS, GitHub, inline files
自定义依赖。你可能有 EMD 文件、辅助文件,想要放到这个特定的沙箱中。因此我们支持 Google GCS 存储桶、GitHub 仓库以及内联文件。你在这里看到的是一个演示,它延续了我们之前进行的调用。我们传入环境 ID,模型就能访问完全相同的文件,就像上次结束时那样。只要你在每一轮中都传回交互 ID 和环境 ID,无论你安装什么软件包、添加并创建什么文件,模型都能访问它们。这不仅仅是这种……custom dependencies. You might have EMD files, helper files that you want to throw on the on this specific sandbox. So we support Google GCS buckets. We support GitHub repositories and inline files. And so what you see over here is a demo whereby it continues off the previous call that we did. We're passing in the environment ID and the model has the exact same files right where we left it. any sort of packages you install, any sort of files you throw and create, the model has access to it through each and every turn as long as you passes back the interaction ID and the environment ID. This isn't just the sort of
一次包含 200 万个 token 的代码仓库分析A 2M-token repo analysis
把任务限制为由管理代理处理的非常简单的任务。你在这里看到的是一次运行:模型耗费了超过两百万个 token,试图分析一个我们为黑客马拉松拿到的代码库。有人从头构建了一整门编程语言,用来编写强化学习环境。如果你用过 Scratch 编程语言,就会知道它是一种拖放式语言,可以让简单的角色移动起来。而在这里,只需一次 API 调用,我们就能分析整个代码库,其中包含自定义 DSL、一个网页、各种 schema,以及在 HUD 中运行的 RL 训练循环。这确实为你创造了这样的机会:无需处理底层基础设施或调整……,就能构建高度定制且性能出色的智能体。constraint to very simple task with the manage agent. What you're seeing over here is a run where the model burnt over two million tokens trying to analyze a repository that we got for a hackathon where someone built from scratch an entire programming language to code reinforcement learning environments. If you've ever used the Scratch programming language, it's a drag and drop language where you can kind of get simple characters to move. But over here with a single API call, we're able to analyze an entire repository that has a custom DSL, a web page, a whole bunch of like schemas, and an RL training loop running inside HUD. And so it really opens up this kind of opportunities for you to build these very custom and performant agents without you having to handle the underlying infrastructure or tune the
同一个智能体在本地和云端运行The same agent locally and in the cloud
运行框架。使用 Anti-gravity 智能体的最大优势在于,从根本上说,它就是运行在你的 Anti-gravity IDE 中的同一个智能体。这意味着,如果你有一些经过本地调优的工作流,也有一些你精心打磨过的技能,那么等你对这些技能满意后,只需将它们打包到一个文件夹中即可。我们允许你通过 sources,以同样的方式将它们上传到 agents 文件夹,这样你的智能体就能获得完全相同的技能,使用相同的智能体运行框架和提示词,无论是在本地还是云端运行都是如此。准备好之后,或者当你对智能体在本地的表现感到满意时,就可以将它推送上去,一切都会按预期运行。公司经常问我们的下一个问题是:“嘿,我需要我的智能体……”harness. The best part about using the anti-gravity agent is that fundamentally it's the same agent running in your anti-gravity IDE, which means that if you have certain workflows that are you've tuned locally, you have skills that you've made sure are great, you can once you're happy with those skills, you just package it into a single folder. We allow you to upload the same way using the sources into into agents folder and that gives your agent the exact same skills with the same agent harness and the same prompt running locally and in the cloud. When you're ready or when you're comfortable with what your agent is doing locally, you can then push it up and everything works as intended. The next question we often get from companies are, "Hey, I need my agent to
凭据注入代理A credential-injecting proxy
确保安全。如果我的代理泄露了网络凭据,我该怎么办?为此,我们实现了一个中间人代理。这是什么意思呢?很多时候,你需要调用不同服务提供商的 API,比如 Gemini API。你可能还需要下载私有 GitHub 仓库,等等。我们在中间设置了一个代理,因此,对于模型发出的任何调用,我们都会检查请求头,并可以随时替换其中的内容。你在这里看到的情况是:我们会动态注入令牌,将所有发往 GitHub API 的出站调用都转换为这种方式。这样一来,即使模型遭到提示词注入,泄露了你的 GitHub API 令牌,它也永远不会真正看到令牌。它只会执行调用 GitHub API 的代码,而你的令牌绝不会暴露。be secure. What am I going to do if my agent leaks a network credential?" And to do so, we've implemented a man-in-the-middle proxy. So, what does this mean? A lot of times, you need to make API calls to different providers, say the Gemini API. You might need to download private GitHub repositories, etc. We have a proxy that stands in the middle and so any call your model makes we will look at the header and we can replace items at will. What you see over here is a case where we'll transform every single outbound call to the GitHub API with an inject in the token dynamically. And so even if the model is somehow prompt injected and leaks your GitHub API token, it's never actually going to see the token. It's only going to execute code that will run against the GitHub API and your token is never exposed.
一旦你对智能体的表现感到满意,就说明已经设置好了。Once you're comfortable with how the agent is performing, you've set it up
命名智能体Named agents
我们基本上提供了两种不同的方式,让你将其配置并设置为一个命名代理,就像你一直在使用的 anti-gravity preview agent 一样。第一种方式是用一组特定的配置文件和网络源将其固化。你在左侧看到的就是这种方式。我正在基于 anti-gravity preview 基础代理创建一个数据分析代理,并在这里配置了一些基础环境,其中只有一个 GCS 技能。另一种方式是通过与代理反复对话,按照你的需求设置环境。例如,你可能需要特定的依赖项或软件包;你可以将配置好的环境固化为一个专用代理,之后的所有调用都可以通过它来进行。环境配置满意后,你就能非常轻松地扩展工作负载。well, we give you two different ways for you to basically configure and set it up as a named agent, much like you've been using the anti-gravity preview agent. The first one is to freeze it with a certain set of configured files and network sources. That's what you're seeing on the left here. I have a data analyst agent that I'm creating from the anti-gravity preview base agent with some base environment configurations here, just a GCS skill. The other way that we allow you to do so is by chatting iteratively with an agent to set up an environment as you like. For example, you might want certain dependencies, you might want certain packages, and you can freeze an environment as a specific agent and all your subsequent calls kind of go through that. Once you're happy with that, it makes it very easy for you to scale up your workloads.
目前,我们最多支持一千个命名代理,这意味着你可以拥有各种不同的配置,而且无需为存储付费。你不用付费——不用为沙箱付费。你只需要为模型付费。我们已经优化了基础设施,使其性能足够出色,能够处理这样的工作负载。我们非常期待看到大家接下来会做什么。At this point, we support up to a thousand named agents, which means that you can have all these different configurations and you don't pay for any of the storage. You don't pay for you don't pay for the sandbox. you only pay for the model. We've optimized our infrastructure to be very performant to be able to handle a workload like this. And we're pretty excited to see what people are going to
Gemini API 命令行工具The Gemini API CLI
构建。最近,我们还开源了一个新的 Gemini API CLI。这是一个简单的 CLI,你可以用它快速开始使用 Gemini 模型,通过简单的 CLI 命令在本地测试这些模型。它的另一个好处是,你可以在本地使用你的编程代理或 Antigravity 代理迭代代码。准备好后,它会将代码打包成一个文件夹,直接上传,并为你创建一个代理。最后,如果你正在考虑切换……build. Recently, we've also out open sourced a new Gemini API CLI. This is a simple CLI that you can use to get started working with the Gemini models to test out the models locally using simple CLI commands. The other benefit of this is that you're going to be able to iterate on your code on your coding agent or your anti-gravity agent locally. And once you're ready, it packages it as a single folder and uploads it straight and creates an agent for you. Lastly, if you're thinking of switching
使用 Interactions API 技能进行迁移Migrating with the Interactions API skill
转到 interactions API,也就是我们所有新模型都会接入的地方。我们还创建了一项新的 interactions API 技能,你可以把它提供给自己喜欢的编程智能体,这样基本上就能顺利完成迁移。我相信你们都遇到过这种情况:你让 Gemini 实现某种特定的功能,它却一直使用 Gemini 2.5 Flash 或 Gemini 2.0。为此,我们会确保模型列表始终保持最新,也会及时更新各种方法。我们还提供了一系列实用技能。正如 Philip 昨天提到的,我们会定期评估这些技能,确保它们确实能达到预期效果,也就是帮助你更好地使用 Gemini,并基于 Gemini 进行开发。所以……over to the interactions API, which is where all of our new models will be on, we've also created a new interactions API skill that you can feed to your favorite coding agent and that will then basically allow you to do the migration without any issues. I'm sure you guys have faced issues where you've asked Gemini to implement a specific kind of uh implementation and it keeps using Gemini 2.5 flash or Gemini 2.0. And so we what we do is we make sure we keep up to date the list of all the different models. We keep up to date all the different methods. We provide a good bunch of skills and like Philip mentioned yesterday, we regularly evaluate these and make sure make sure that they're actually doing what we want them to do, which is allowing you to use Gemini and build on Gemini well. So
总结Wrap-up
我的演讲到此结束。呃,非常感谢大家过来,也感谢大家留下来参加这一轮会议。希望大家能开始上手。我会待在旁边,大家要是对新 API 有什么问题,随时可以来问我。that's the end of my talk. Uh, thank you so much for coming by and staying around for the round of the conference. And yeah, I hope you guys get started. I'll be on the side if you guys have any questions about the new API.