谷歌用 Gemini 4 Argon 一夜优化 ADK 代码库的 20 万行代码
谷歌介绍了 Gemini 4 Argon 的一次 11 小时无人值守运行为谷歌 Agent Development Kit(ADK) 代码库产出了两项最终被采纳的优化方案,使长会话中的内存会话准备开销降低约 40%,冷启动包导入时间缩短 21%。 谷歌工程师的目标之一是了解“模型如何处理已有的代码库”,他们说这比创建“从空文件夹开始构建的全新应用”要困难得多。为此,他们专注优化自家的 ADK,这是一个横跨约 800 个文件、超过 20 万行代码的代码库,包含近 17000 个单元测试。 > 性能调优对模型来说是一项严苛的考验,你无法只打开一个文件就定位到性能瓶颈。你必须沿着症状出现的方向进行正交分析,并在长时间运行过程中建立整个代码库的关联全貌。 先进行一轮简短的试运行,工程师确定提示词需要包含哪些内容,确保智能体遵循团队的单元测试、基准测试规范。随后,工程师通过 文件配置特定于代码库的规则,相当于新工程师入职指南。他们指示智能体只加载任务所需的技能,避免填满上下文窗口。最终他们编写专用提示词,并借助 Antigravity 的 /goal 模式保证在上下文压缩过程中任务目标不会丢失:...
Full Report
Google described how an 11-hour unattended run of Gemini 4 Argon produced two optimizations that were ultimately accepted into the Google Agent Development Kit (ADK) codebase, reducing in-memory session preparation overhead in long sessions by about 40% and cutting cold-start package import time by 21%.
One of the Google engineers' goals was to understand "how the model handles an existing codebase," which they said is much harder than creating "a brand-new app built from an empty folder." To that end, they focused on optimizing their own ADK, a codebase spanning roughly 800 files and more than 200,000 lines of code, with nearly 17,000 unit tests.
Performance tuning is a demanding test for a model: you cannot locate a performance bottleneck just by opening a single file. You have to conduct orthogonal analysis in the direction the symptoms appear and build a connected picture of the entire codebase over a long-running process.
After a brief trial run, the engineers determined what the prompts needed to include to ensure the agent followed the team's unit testing and benchmarking conventions. They then configured codebase-specific rules through files, essentially an onboarding guide for new engineers. They instructed the agent to load only the skills required for the task to avoid filling the context window. Finally, they wrote dedicated prompts and used Antigravity's /goal mode to ensure the task objective would not be lost during context compression:
/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.After the task was completed, Argon's run logs showed that the agent read the repository conventions, established performance baselines, proposed optimizations, reviewed its own changes, and ran all 16,892 unit tests.
More importantly, Argon did the cross-module groundwork that profiling tools cannot do for you. A profiler will tell you that copying sessions and importing packages are expensive, but it will not track every caller, mock target, and shared reference across 40 files to ensure that speeding up those paths does not break existing applications.
The two optimizations ultimately accepted into the codebase improved how ADK handles session history by filtering events before copying them, and introduced lazy loading so that large packages are imported only when needed.
These two changes improved in-memory session preparation and package import speed by 40% and 21%, respectively. Google noted that compared with the overall duration of an agent run, the overhead of these tasks is not huge, but ADK supports multi-tool interactions spanning dozens or even hundreds of iterations, allowing these small performance gains to compound:
For a single LLM call that takes several seconds, humans cannot perceive a difference of 28 milliseconds or 78 milliseconds. But across 158 consecutive rounds of internal tool-call interactions, these operations add up: after eliminating this overhead, the entire 158-round process dropped from 65.6 seconds to 56.1 seconds—a reduction of nearly 10 seconds in pure framework overhead.
Although Google's practice of using Gemini 4 Argon to optimize the ADK codebase demonstrates that AI agents can successfully modify existing codebases, their effectiveness is still limited by the post-coding workload, including PR review, debugging and testing. Google's findings confirm this trend: four changes produced by Argon were rejected during developer review because they fell short on reliability, maintainability, compatibility, or actual performance improvement.
Read the original English article: https://www.infoq.com/news/2026/10/google-argon-optimizes-adk/