---
title: "Optimizing a 200,000-line Python codebase overnight with Gemini 4 Argon"
description: "Google tested Gemini 4 Argon on google/adk-python, a 205,000-line Python framework with 800 source files and 17,000 unit tests. The model ran unattended for 11 hours, guided by a /goal prompt and .agents/skills rulefiles that encoded maintainer conventions. Argon first wrote a benchmark script, spent 70 minutes measuring before editing code, and proposed six optimizations across 32 files; two shipped after human code review. The shipped changes cut in-memory session prep time by about 40% in long sessions and sped up cold package imports by 21% by filtering events before copying and using lazy module accessors. The other four proposals were rejected for relying on fragile state, private library internals, or synthetic-only gains, illustrating a division of labor where the agent explores and the maintainer subtracts."
---

# Optimizing a 200,000-line Python codebase overnight with Gemini 4 Argon

[Google](https://yomu.fyi/company/google) · George Weale, Bo Yang, Andrew Biernat · Oct 13, 2026

**Type:** Problem & solution

## Summary

Google tested Gemini 4 Argon on google/adk-python, a 205,000-line Python framework with 800 source files and 17,000 unit tests. The model ran unattended for 11 hours, guided by a /goal prompt and .agents/skills rulefiles that encoded maintainer conventions. Argon first wrote a benchmark script, spent 70 minutes measuring before editing code, and proposed six optimizations across 32 files; two shipped after human code review. The shipped changes cut in-memory session prep time by about 40% in long sessions and sped up cold package imports by 21% by filtering events before copying and using lazy module accessors. The other four proposals were rejected for relying on fragile state, private library internals, or synthetic-only gains, illustrating a division of labor where the agent explores and the maintainer subtracts.

## Context

Google tested Gemini 4 Argon on google/adk-python, a 205,000-line Python framework for building enterprise agents. The goal was to see if the model could find and fix cross-file performance bottlenecks unattended overnight.

## Approach / What changed

The approach used a /goal prompt in Google Antigravity to keep the model running until the task was finished, combined with .agents/skills rulefiles that encoded maintainer conventions. The model first wrote a benchmark script, spent 70 minutes measuring, then proposed six optimizations. Two shipped after human code review: filtering session history before copying and lazy-loading heavy packages.

## Takeaways

- Gemini 4 Argon proposed six optimizations across 32 files; only two shipped after human code review, illustrating that AI-generated code still requires human judgment for maintainability and safety.
- The shipped changes cut in-memory session prep time by about 40% in long sessions and sped up cold package imports by 21% by filtering events before copying and using lazy module accessors.
- The model’s first round without repository conventions produced code that missed maintainer rules, while the second round with .agents/skills and /goal mode produced a review-ready pull request that ran all 16,892 unit tests.

## FAQ

### What optimizations did Gemini 4 Argon propose for ADK?

Argon proposed six optimizations across 32 files. Two shipped: filtering in-memory session history before copying and lazy-loading heavy packages. The other four were rejected for relying on fragile state, private library internals, or synthetic-only gains.

### How much performance improvement did the changes achieve?

The changes cut in-memory session prep time by about 40% in long sessions and sped up cold package imports by 21%. Time from a new process to first model request stayed flat at 3.07 to 3.09 seconds because deferred modules load on the first turn.

### What was the workflow for running Gemini 4 Argon on the codebase?

The workflow used a /goal prompt in Google Antigravity to keep the model running until the task was finished, combined with .agents/skills rulefiles that encoded maintainer conventions. The model ran unattended for 11 hours, first writing a benchmark script and measuring before editing code.

**Tags:** [Agent Development Kit](https://yomu.fyi/topic/agent-development-kit), [Code Review](https://yomu.fyi/topic/code-review), [Gemini 4 Argon](https://yomu.fyi/topic/gemini-4-argon), [Performance](https://yomu.fyi/topic/performance), [Python](https://yomu.fyi/topic/python)

- Source: [Google](https://developers.googleblog.com/optimizing-a-200000-line-python-codebase-overnight-with-gemini-4-argon)
- Source URL: https://developers.googleblog.com/optimizing-a-200000-line-python-codebase-overnight-with-gemini-4-argon
- Ingested by Yomu: 2026-10-13T18:00:29.724Z

[Read original post](https://developers.googleblog.com/optimizing-a-200000-line-python-codebase-overnight-with-gemini-4-argon)
