OCT. 13, 2026 (英语).
当一个新的型号发布时,大多数演示显示从空文件夹构建的绿地应用。 他们很有趣看。 他们也很少告诉一个工作软件工程师该模型如何处理一个现有的代码库。
对于Gemini 4 Argon的发布,我们想测试它是否可以在一夜之间就一个更棘手的问题进行无人关注的运行:在google/adk-python中找到并修复跨文件性能瓶颈。 Agent开发Kit(ADK)是Google的开源建设和部署企业agents的框架。
Python寄存器跨越近800个源文件的大约205,000行代码,辅以近17000个单元测试。
性能工作对于一个模型来说是一个艰难的考验,因为你不能仅仅打开一个文件并发现减速。 你必须直观地看症状的出现地点并持有一个地图说明整个密码库如何在很长一段时间内相互配合
这篇文章通过提示,. 你会看到运出的两个优化,我们在审查中拒绝了四个,以及如何在您自己的代码库上设置相同的一夜间的工作流程。
图1:ADK在第一个模型请求前的间接费用,在50和150转后测得。 Argon的变换削减在两个点上都增加了约40%,因此节省的时间随着会话的延长而增加。
大多数使用编码的agent的性能工作仍然运行在紧凑的人类循环中:工程师运行一个剖面仪,将模型指向单一的热函数,并指定固定。 我们想看看阿贡会怎么做只要得到团队关心的结果
在第一回合,我们用零自定义寄存器指令测试了Argon. 我们给了它这个单一的段落:
让 ADK 在任何 agent 中不添加显著的间接费用:
在启动时,在长会话中,在多agent和
工作流程设置。 保持模型得到的和
公共 API 不变,并背对每个变化
并进行一个能避免倒退的测试。
第1轮跑约2小时。 Argon写了7分钟的基准测试脚本,在编辑ADK源的单行之前花了70分钟测量和读取代码,在会话复制和包导入中发现了真正的瓶颈。 第一回合的部分密码进入了我们运送的最后任务
第一轮不足的是维护者公约。 因为Argon不知道ADK团队是如何审查代码的,所以在ADK的认证模型中附加了一个自定义钩子,潜移地改变了其公开的JSON schema,在自定义的复印机中错过了模拟事件边缘案例,只运行了附近的216个单元测试,并将基准测试数字从它的拉动请求描述中留下。
第一回合证明确实有需要加快的速度,所以我们设置了第二轮,并进行了两次调整。 首先,我们把团队的维护者指南放入寄存器的.agents/技能目录,就像新工程师的登机指南。 每个技能都以一个简短的SKILL.md索引开始,该索引在需求时指向焦点引用/文件,因此我们不会在每个转弯时淹没agent的上下文窗口。 Argon在9:11开始运行(图2)时
图2:阿尔贡的首发比赛时间为2小时,与其同球的11小时连夜比赛相比。 第1轮自行发现真正的加速,而第2轮则遵循Repo常规,运行了全部16,892个单元测试,并打开了审查准备的拉力请求。
第二,我们开启了Google反重力的/目标模式,它保留了整个上下文的收缩目标,因此agent一直运行到任务完成。 我们还加了两句,要求用前后的号码提出未出现的拉力请求:
/ 目标使 ADK 在任何 agent 中无明显的间接费用:
在启动时,在长会话中,在多agent和工作流程设置中。
保持模型得到的和公开的API不变,并用一个能够捕捉回归的测试回回每一个变化。
打开一个对主调请求,ADK 维护者将批准,并在描述中注明前后的数字。 别合并了
随着.agents/技能在repo和/oal模式中活跃,Argon在一夜之间跑出了11个小时无人看管(图3).
图3:阿尔贡一夜ADK在Google抗重力运行。 /目标速率在完成工作时仍被固定在窗口的上下方,然后倒塌成摘要块,因此原始规则会停留在几小时的编辑,基准测试和测试运行中查看。 (Screenshot在公共Antigravity接口重播,以删除内部的工作空间细节。
第二天早上看过夜的会话记录时,立即出现了一些行为。 在触摸源代码之前,Argon读取了12个准则文件,并运行了一个基线基准测试,跨越了四个测试工作量:包启动,200步对话,20个子agents手相交任务的测试应用,以及12节点工作流程,运行30次。 甚至在完成11小时运行前的3分钟,Argon仍在审计自己的diff,在自己的多agent缓存中捕捉到一个错误,并重新运行所有16,892个单元的测试,然后自己停下来。
更重要的是,Argon做了跨模块的腿部工作一个剖面仪不能为你做。 一个剖析器会告诉你,复制会话和导入包需要时间。 它不会做的是追踪每一个呼叫者,模拟目标,和共享参考在40个文件,这样这些路径的加速不打破现有的应用。
总体而言,阿尔贡的拉力请求提出了跨越32个文件的6个优化。 其中的两种优化方式清空地解决了ADK的核心瓶颈并运至生产:
ADK运行中的每一步都从装入对话历史开始。 之前,ADK的内幕会话服务在过滤到一个呼叫者要求的事件之前,深入复制了每个读数上存储的全部对话。 甚至列出没有它们的活动的会话,先复制每个活动。 Argon更新服务,在复制前过滤事件,并将Pydantic关于会话和事件的通用深复制路径替换为快速,循环安全的复印机,保存共享的状态词典和测试模拟。
运行导入 google.adk 之前在模块中拉动用于直播音频和视频流,OpenTeleometry tracking,以及网络服务器(FastAPI和Starlette)甚至用于一个基本的文本 agent. 简单地删除一个框架中的顶级导入会打破直接模拟模块属性的下游测试。 当Argon的圆二拉力请求从llm agent.py中移除了3个内部流量进口时,所有16,892个开源测试都通过了,然而25个内部的Google测试目标却因为补齐了这些准确的属性而失败。 所运出的固定装置使用懒惰的模块存取器,所以重包装载只进行首次使用,而每个公共属性都保留在测试预期的地方补丁。
阿贡提出的其他四个优化方案呢?
我们发现这个模式有创意的解决方案,其中一些创造性想法进入了框架规则,而打破变革是不可接受的。
图4:阿尔贡晨间拉力请求的6个优化,我们发运的2个和我们剪切的4个代码检讨。 我们保留了会话副本和懒惰进口的改动,这些改动能把真正的管理费用干净地削减掉,并放弃了那些依赖于脆弱状态,私人图书馆内部,或者只靠合成收益的四项。
在代码审查期间,我们拒绝了其他四个修改:
- 一个多agent事件缓存将合成的基准测试加速了17%,然而却依赖于一个薄弱的内存参考,如果Python在垃圾收集后重新使用内存地址,那么它可以返回整个会话中呆滞的数据。
- 遥测检查读取了OpenTeleometter的跟踪器执行上的私人属性,这可能会在微小的图书馆升级时无声破解。
- 重写 ADK 格式对话历史之前的每个模式调用使得核心代码路径更难读而不移动端到端 latency on our exident holdout 基准测试。
- 工作流程事件重播的检索索引增加了状态跟踪的复杂度,这只有助于合成重播测试,而不是日常的agent运行。
这种分工是工作流程起作用的原因:agent探索,维护者减去。 我们把第1和第2轮的最好部分合并成22个文件的更改,辅以17个新的测试功能。 经过整个ADK团队的审查,它主要以承诺注释"Argon产生了这些变化"登陆。
为了理解承诺信息中的数字,它有助于了解ADK所谓的转弯。
当工程师输入一个提示,得到一个最后的答案后,ADK称这为引用。 转动是每一次agent行为时在引擎盖下的一个内部步骤:调用工具,运行一批平行工具呼叫,或查询MCP服务器。
使用agent框架的原因是多回合制工具调用,其中运行下发生数十或数百个内部转弯。
在两轮运行前,我们写了一张Argon从未见过的独立悬疑基准测试(bench turn.py). 在shang turn.py中,一个单会话通过转弯与即时模型和即时工具变长,所以时钟上的每毫秒都是ADK自己的框架俯冲。 每个转弯在返回答案之前运行三轮四个平行工具呼叫,计时5在0,50之后转弯,150更早转弯。 下面的每个数字是6到12运行的中位数,在每次转弯时,模型都会在变化前后收到字节相同的请求。
我们测试了5个基准测试的合并承诺(图5):
图5:Argon改变之前和之后所有五个坚持者基准测试的中间ADK框架间接费用。 会话准备在长会话中会下降约40%,包导入时间会下降21%,而第一个请求的新进程时间会保持平整,因为第一个回合会推迟模块加载。
如何为您自己的 agents 读取这些数字:
21 % 的快速导入 google.adk 帮助每个 ADK 用户立即,加速 CLI 命令,本地开发,以及测试发现。 因为agent运行第一转弯时仍会延迟模块加载,所以从全新的过程到第一个模型请求的时间会保持平整(3.07s至3.09s). 在制作服务器上,在接受直播之前发送一个热身请求,这样第一个用户呼叫就不会支付一次性的导入费用。
- 40%的模型前间接费用削减适用于InMemorySession Service,它授权InMemoryRunner,本地评价环路,CI测试套件,以及默认的Cloud Run或GKE在未配置外部数据库 URI时的部署。 在一次需要几秒钟的LLM呼叫中,人类不会感觉到28ms或78ms. 然而,在158个内部工具回合中,这些副本的复合体:将全部158个回合从65.6秒移到56.1秒(近10秒纯框架高空)。 外部数据库,SQLite,Gemini平台,Firestore,和Redis会话存储从存储中解冻,而不是在内存中深层复制,因此他们的阅读时间不会在这里改变。
企业开发商和建设商可以在ID gemini-4-argon模式下的Gemini平台通过API访问Argon,在Google AI Studio中,在Google Antigravity中。
审查模版卡和开发商指南,以了解完整的技术规格、标志限制和迁移指示。
- ADK的 Python 快速启动
- 审查合并拉力请求和基准测试直接以google/adk-python方式承诺。
- 复制 agents/技能布局的 google/adk-python,如果您想要在无人看管的运行前给 agents 您的repo 建筑规则和CI检查。
本文由 AI图鉴自动抓取并翻译,版权归原作者所有;如需查看原文请点下方链接。
OCT. 13, 2026
When a new model launches, most demos show greenfield apps built from an empty folder. They're fun to watch. They also tell a working software engineer very little about how the model handles an existing codebase.
For the launch of Gemini 4 Argon, we wanted to test whether it could run unattended overnight on a much harder problem: finding and fixing cross-file performance bottlenecks in google/adk-python. Agent Development Kit (ADK) is Google's open-source framework for building and deploying enterprise agents.
The Python repository spans roughly 205,000 lines of code across nearly 800 source files, backed by nearly 17,000 unit tests.
Performance work is a hard test for a model because you can't just open one file and spot the slowdown. You have to look orthogonally to where the symptom appears and hold a map of how the entire codebase fits together over a long run.
This post walks through the prompts, .agents/skills rulefiles, and human code-review decisions from the 11-hour overnight run that cut ADK's in-memory session prep time by about 40% in long sessions and sped up cold package imports by 21%. You'll see the two optimizations that shipped, the four we rejected in review, and how to set up the same overnight workflow on your own codebase.
Figure 1: ADK's overhead before the first model request, measured after 50 and 150 turns. Argon's change cuts it by about 40% at both points, so the time saved grows as the session gets longer.
Most performance work with a coding agent still runs in a tight human loop: an engineer runs a profiler, points the model at a single hot function, and specifies the fix. We wanted to see what Argon would do when given only the outcome the team cared about.
In round one, we tested Argon with zero custom repository instructions. We gave it this single-paragraph prompt:
Make ADK add no noticeable overhead to any agent:
at startup, in long sessions, in multi-agent and
workflow setups. Keep what the model receives and
the public API unchanged, and back each change
with a test that would catch a regression.
Round one ran for about two hours. Argon wrote a benchmark script 7 minutes in, spent 70 minutes measuring and reading code before editing a single line of ADK source, and found real bottlenecks in session copying and package imports. Parts of round one's code made it into the final commit we shipped.
Where round one fell short was maintainer conventions. Because Argon didn't know how the ADK team reviews code, it attached a custom hook to ADK's authentication model that subtly altered its public JSON schema, missed mock event edge cases in its custom copier, ran only 216 nearby unit tests, and left benchmark numbers out of its pull request description.
Round one proved there were real speedups to be had, so we set up a second round with two adjustments. First, we put the team's maintainer guidelines into the repository's .agents/skills directory, like an onboarding guide for a new engineer. Each skill starts with a short SKILL.md index that points to focused references/ files on demand, so we don't flood the agent's context window on every turn. When Argon started its run at 9:11 PM (Figure 2), it read visibility.md for our private _-prefixed module rule and imports.md for our lazy-loading checks before touching a line of code.
Figure 2: Argon's two-hour first run compared with its 11-hour overnight run on the same goal. Round 1 found real speedups on its own, while Round 2 followed repo conventions, ran all 16,892 unit tests, and opened a review-ready pull request.
Second, we turned on /goal mode in Google Antigravity, which preserves the goal across context compactions so the agent keeps running until the task is finished. We also added two sentences asking for an unmerged pull request with before-and-after numbers:
/goal Make ADK add no noticeable overhead to any agent:
at startup, in long sessions, in multi-agent and workflow setups.
Keep what the model receives and the public API unchanged, and back each change with a test that would catch a regression.
Open one pull request against main that the ADK maintainers would approve, with before and after numbers in its description. Don't merge it.
With .agents/skills in the repo and /goal mode active, Argon ran unattended for 11 hours overnight (Figure 3).
Figure 3: Argon's overnight ADK run in Google Antigravity. The /goal prompt stays pinned at the top and bottom of the window while finished work collapses into summary blocks, so the original rules stay in view across hours of edits, benchmarks, and test runs. (Screenshot replayed in the public Antigravity interface to remove internal workspace details.)
Looking at the overnight session log the next morning, a few behaviors stood out right away. Before touching source code, Argon read 12 guideline files and ran a baseline benchmark across four test workloads: package startup, a 200-step conversation, a test app where 20 sub-agents hand tasks to one another, and a 12-node workflow, run 30 times. Even three minutes before finishing its 11-hour run, Argon was still auditing its own diff, catching a bug in its own multi-agent cache and rerunning all 16,892 unit tests before stopping on its own.
More importantly, Argon did the cross-module legwork a profiler can't do for you. A profiler will tell you that copying sessions and importing packages take time. What it won't do is trace every caller, mock target, and shared reference across 40 files so that speeding up those paths doesn't break existing apps.
In total, Argon's pull request proposed six optimizations across 32 files. Two of those optimizations solved ADK's core bottlenecks cleanly and shipped to production:
Every step in an ADK run starts by loading the conversation history. Previously, ADK's in-memory session service deep-copied the entire stored conversation on every read before filtering down to the events a caller asked for. Even listing sessions without their events copied every event first. Argon updated the service to filter events before copying, and replaced Pydantic's generic deep-copy path on sessions and events with a fast, cycle-safe copier that preserves shared state dictionaries and test mocks.
Running import google.adk previously pulled in modules for live audio and video streaming, OpenTelemetry tracing, and web servers (FastAPI and Starlette) even for a basic text agent. Simply deleting top-level imports in a framework breaks downstream tests that mock attributes directly on modules. When Argon's round-two pull request removed three internal flow imports from llm_agent.py, all 16,892 open-source tests passed, yet 25 internal Google test targets failed because they patched those exact attributes. The shipped fix uses lazy module accessors so heavy packages load only on first use while every public attribute stays patchable where tests expect it.
What about the other four optimizations Argon proposed?
We found that the model comes up with creative solutions we wouldn’t have considered otherwise. Some of those creative ideas run into framework rules where breaking changes are not acceptable.
Figure 4: The six optimizations in Argon's morning pull request, split between the two we shipped and the four we cut in code review. We kept the session-copy and lazy-import changes that cut real overhead cleanly, and dropped the four that relied on fragile state, private library internals, or synthetic-only gains.
During code review, we rejected the other four changes:
- A multi-agent event cache sped up a synthetic benchmark by 17%, yet relied on a weak memory reference that could return stale data across sessions if Python reused a memory address after garbage collection.
- A telemetry check read a private attribute on OpenTelemetry's tracer implementation, which could break silently on a minor library upgrade.
- A rewrite of how ADK formats conversation history before each model call made a core code path harder to read without moving end-to-end latency on our independent holdout benchmark.
- A lookup index for workflow event replays added state-tracking complexity that only helped synthetic replay tests rather than everyday agent runs.
That division of labor is why the workflow worked: the agent explores, the maintainer subtracts. We combined the best parts of rounds one and two into a 22-file change backed by 17 new test functions. After review across the ADK team, it landed in main with the commit note "Argon generated these changes."
To make sense of the numbers in the commit message, it helps to know what ADK calls a turn.
When an engineer types a prompt and gets a final answer back, ADK calls that an invocation. A turn is an internal step under the hood every time the agent acts: calling a tool, running a batch of parallel tool calls, or querying an MCP server.
The reason you use an agent framework is multi-turn tool calling, where dozens or hundreds of internal turns happen underneath a run.
Before either round ran we wrote an independent holdout benchmark (bench_turn.py) that Argon never saw. In bench_turn.py, a single session grows turn by turn against an instant model and instant tools, so every millisecond on the clock is ADK's own framework overhead. Each turn runs three rounds of four parallel tool calls before returning its answer, timing 5 turns after 0, 50, and 150 earlier turns. Each number below is the median of 6 to 12 runs, and on every turn the model receives byte-identical requests before and after the change.
We tested the merged commit against the previous release across five benchmarks (Figure 5):
Figure 5: Median ADK framework overhead before and after Argon's changes across all five holdout benchmarks. Session preparation drops by about 40% in long sessions and package import time drops by 21%, while new-process time to first request stays flat because deferred modules load on the first turn.
How to read these numbers for your own agents:
- The 21% faster import google.adk helps every ADK user right away, speeding up CLI commands, local development, and test discovery. Because deferred modules still load when an agent runs its first turn, time from a brand-new process to its first model request stays flat (3.07 s to 3.09 s). On a production server, send a warm-up request before taking live traffic so the first user call doesn't pay that one-time import cost.
- The 40% reduction in pre-model overhead applies to InMemorySessionService, which powers InMemoryRunner, local evaluation loops, CI test suites, and default Cloud Run or GKE deployments when no external database URI is configured. On a single LLM call that takes seconds, a human won't feel 28 ms or 78 ms. Across 158 internal turns of tool calling interactions, however, those copies compound: removing them cuts the full 158-turn run from 65.6 seconds to 56.1 seconds (nearly 10 seconds of pure framework overhead). External database, SQLite, Gemini platform, Firestore, and Redis session stores deserialize from storage rather than deep-copying in memory, so their read times don't change here.
Enterprise developers and builders can access Argon via API in Gemini platform under model ID gemini-4-argon, in Google AI Studio, and in Google Antigravity.
Review the model card and developer guide for complete technical specifications, token limits, and migration instructions.
- Python Quickstart for ADK
- Review the merged pull request and benchmark commit directly in google/adk-python.
- Copy the .agents/skills layout in google/adk-python if you want to give agents your repo's architectural rules and CI checks before an unattended run.
Auto-fetched and translated by AI Atlas. All rights belong to the original author.