Google Lets Gemini 4 Argon Optimize 200,000 Lines of Python Overnight

Google says Gemini 4 Argon ran unattended for 11 hours on the google/adk-python repository and produced performance changes that cut in-memory session prep time by about 40% in long sessions and sped up cold package imports by 21%. Of the six optimizations the model proposed, maintainers kept two and rejected four in code review.
- Google ran Gemini 4 Argon unattended for 11 hours on google/adk-python, a repo of roughly 205,000 lines across nearly 800 source files.
- Two shipped changes cut in-memory session prep time by about 40% in long sessions and sped up cold package imports by 21%, according to Google.
- Argon proposed six optimizations across 32 files; reviewers rejected four, citing fragile state, private library internals or synthetic-only gains.
- Adding .agents/skills guideline files and Antigravity's /goal mode fixed the convention problems seen in a two-hour first run.
- The final 22-file change with 17 new test functions landed in main with the note "Argon generated these changes."
A real codebase instead of a greenfield demo
Google's developer blog argues that most launch demos show new apps built from an empty folder, which says little about how a model copes with existing code. For the launch of Gemini 4 Argon, the team chose a harder test: finding and fixing cross-file performance bottlenecks in google/adk-python, the Python repository of the Agent Development Kit (ADK), Google's open-source framework for building and deploying enterprise agents.
According to Google, the repository spans roughly 205,000 lines of code across nearly 800 source files, backed by nearly 17,000 unit tests. Performance work is difficult, the authors write, because the slowdown is rarely in the file where the symptom shows up, and the model has to hold a map of the whole codebase over a long run.
Round one: no instructions, real findings, wrong conventions
In the first round, Argon got no custom repository instructions and a single-paragraph prompt: make ADK add no noticeable overhead to any agent, keep the model input and public API unchanged, and back each change with a regression test. The run lasted about two hours. Argon wrote a benchmark script 7 minutes in and spent 70 minutes measuring and reading code before editing any ADK source. It found real bottlenecks in session copying and package imports, and parts of its code reached the final commit.
It fell short on maintainer conventions, according to Google. Argon attached a custom hook to ADK's authentication model that subtly changed 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 two: skills files and /goal mode
For the second round the team made two changes. First, it placed its maintainer guidelines in 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 files in a references/ folder on demand, so the context window is not flooded on every turn. Argon began at 9:11 PM and read files such as visibility.md, covering the private _-prefixed module rule, and imports.md, covering lazy-loading checks, before touching code.
Second, the team enabled /goal mode in Google Antigravity, which keeps the goal across context compactions so the agent continues until the task is done. The prompt also asked for one pull request against main that maintainers would approve, with before and after numbers, and told the agent not to merge it.
Argon read 12 guideline files and ran a baseline benchmark across four workloads: package startup, a 200-step conversation, a test app where 20 sub-agents hand tasks to one another, and a 12-node workflow, each run 30 times. Three minutes before finishing, it was still auditing its own diff, caught a bug in its own multi-agent cache and reran all 16,892 unit tests before stopping on its own.
The two changes that shipped
Argon's pull request proposed six optimizations across 32 files. Two were kept.
- Filtering session history before copying. ADK's in-memory session service previously deep-copied the whole stored conversation on every read before filtering to the requested events. Even listing sessions without events copied every event first. Argon changed the service to filter first, 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.
- Loading heavy packages only when needed. Running import google.adk pulled in modules for live audio and video streaming, OpenTelemetry tracing, and the FastAPI and Starlette web servers, even for a basic text agent. Removing top-level imports alone broke tests: after Argon removed three internal flow imports from llm_agent.py, all 16,892 open-source tests passed, but 25 internal Google test targets failed because they patched those attributes. The shipped fix uses lazy module accessors so packages load on first use while public attributes stay patchable.
Four rejected in review, and what it means
The maintainers rejected the other four changes. A multi-agent event cache sped up a synthetic benchmark by 17% but used 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 of OpenTelemetry's tracer implementation, which could break silently on a minor library upgrade. A rewrite of how ADK formats conversation history made a core path harder to read without improving end-to-end latency on an independent holdout benchmark. A lookup index for workflow event replays added state-tracking complexity that helped only synthetic replay tests.
The team combined the best parts of both rounds 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." Google summarizes the division of labor as: "the agent explores, the maintainer subtracts."
For teams considering similar overnight runs, the post's lesson is practical: encode review conventions in repository skill files, pin the goal so it survives long sessions, ask for an unmerged pull request with measurements, and keep human review as the filter. The source text available here is cut off before the detailed benchmark results.
Google for Developers: Optimizing a 200,000-line Python codebase overnight with Gemini 4 Argon- Google Developers Blog


