Gemini 4 Argon Optimizes Python ADK
- •Google Cloud engineers ran Gemini 4 Argon unattended for 11 hours to optimize the Python ADK codebase
- •Two of six proposed changes shipped, cutting long-session preparation about 40% and package import time 21%
- •A 158-turn run fell from 65.6 seconds to 56.1 seconds; maintainers rejected four proposals after review
Google Cloud engineers George Weale and Bo Yang, with developer marketer Andrew Biernat, used Gemini 4 Argon in Google Antigravity to optimize the roughly 205,000-line, nearly 800-file Python Agent Development Kit (ADK) repository in an 11-hour unattended run. The repository had nearly 17,000 unit tests. The team says the merged changes cut in-memory session preparation time by about 40% in long sessions and package import time by 21%.
Before the overnight run, a roughly two-hour test with no repository-specific instructions found bottlenecks in session copying and package imports, but missed maintainer conventions. Argon altered an authentication model’s public JSON schema, missed mock-event edge cases, ran only 216 nearby tests and omitted benchmark results from its pull request description. For the second run, the engineers added maintainer guidance under .agents/skills, with a short SKILL.md index pointing to focused reference files, and enabled /goal mode, which preserves the task through context compactions. They asked Argon to keep the public API and model inputs unchanged, add regression tests and open a review-ready pull request without merging it.
During the 11-hour run, Argon read 12 guideline files and benchmarked four workloads 30 times: package startup, a 200-step conversation, 20 sub-agents handing off tasks, and a 12-node workflow. It proposed six optimizations across 32 files; maintainers shipped two after review. One filters session history before copying and replaces Pydantic’s generic deep-copy method with a cycle-safe copier that preserves shared state dictionaries and test mocks. The other defers loading heavy packages, including live audio and video, OpenTelemetry, FastAPI and Starlette, until they are needed, while keeping public attributes patchable.
The team rejected four proposals: a multi-agent event cache that improved a synthetic benchmark by 17% but risked stale data; a telemetry check that relied on a private OpenTelemetry attribute; a conversation-history rewrite that made code harder to read without improving end-to-end latency on a holdout benchmark; and a workflow replay index that added complexity for synthetic tests without helping everyday agent runs. The combined change covered 22 files and added 17 test functions. After ADK team review, it landed in the main branch with the commit note, “Argon generated these changes.”
An independent holdout benchmark, which Argon had not seen, measured framework overhead with instant models and tools; each result was the median of 6 to 12 runs. The model received byte-identical requests before and after the changes. Importing google.adk became 21% faster, while a new process’s time to its first model request stayed nearly flat, changing from 3.07 seconds to 3.09 seconds because deferred modules load on the first turn. For a 158-turn tool-calling run, the changes reduced total time from 65.6 seconds to 56.1 seconds. The roughly 40% reduction in pre-model session overhead applies to InMemorySessionService; the team says read times for external database, SQLite, Gemini platform, Firestore and Redis stores do not change.
Enterprise developers can access Gemini 4 Argon through the Gemini platform API using model ID gemini-4-argon, Google AI Studio and Google Antigravity. Google also pointed developers to its model card, developer guide, Python ADK quickstart, merged pull request, benchmark commit and .agents/skills layout.