AI
Google Uses Gemini 4 Argon AI to Optimize 200K-Line Python Codebase in Single Overnight Run
An autonomous AI agent improved Google's Agent Development Kit performance through cross-module analysis that human profilers typically cannot achieve.
InfoQ
Google demonstrated how Gemini 4 Argon, running unattended for 11 hours, produced two accepted optimizations to the Agent Development Kit (ADK) codebase—reducing in-memory session overhead by 40% and cutting package import time by 21%.
Testing AI Agents on Real-World Code#
Developers often train AI agents on greenfield projects built from scratch. Google wanted to test something harder: whether Argon could navigate and improve a mature codebase spanning 200,000 lines across roughly 800 files, complete with nearly 17,000 unit tests. Performance optimization proved especially demanding, since bottlenecks don't always appear near their symptoms—the agent had to understand the entire system's architecture to identify and fix root causes.
Setting Guidelines for the AI Agent#
Rather than leaving Argon to explore freely, Google created repository-specific guidance through .agents/skills files—essentially an onboarding manual for the AI. The team also used Antigravity's /goal mode to anchor the task throughout the agent's work, ensuring consistency even as the model compacted its context. The final prompt asked Argon to boost ADK performance at startup, during long sessions, and across multi-agent setups, while keeping the public API stable and backing each change with tests.
How Argon Succeeded Where Profilers Fall Short#
Argon's logs revealed systematic work: the agent read the guidelines, established baselines, proposed changes, reviewed its own modifications, and ran all 16,892 unit tests. Crucially, it performed cross-module detective work that traditional profilers cannot handle. A profiler identifies that session copying and package imports consume time; Argon traced every caller, mock target, and shared reference across 40 files to ensure optimizations wouldn't break downstream applications.
The two accepted improvements filtered events before copying sessions and introduced lazy loading for heavy packages. Over a 158-turn tool-calling interaction, the gains compounded: the full run dropped from 65.6 seconds to 56.1 seconds—nearly 10 seconds saved from framework overhead alone.

