claude-news
newsInfoQ·24 Oct 2026·Sergio De Simone

Google Optimizes Agent Development Kit's 200K-line Python Codebase Overnight with Gemini 4 Argon

An 11-hour unattended Gemini 4 Argon run produced two accepted optimizations for Google ADK 200K-line Python codebase, cutting memory and latency.

Extract

Google explained how an 11-hour unattended run of Gemini 4 Argon produced two accepted optimizations for Google Agent Development Kit's codebase, reducing in-memory session-preparation overhead by about 40% in long sessions and cold package import time by 21%.

By Sergio De Simone

Explained

What happened

Google let Gemini 4 Argon work 11 hours unattended on the Agent Development Kit (ADK) Python codebase (~205K lines, ~800 files, ~17K unit tests). The goal: no noticeable overhead at startup, in long sessions, or with many agents. Argon proposed six optimizations across 32 files; maintainers accepted two:

  1. Session copying in InMemorySessionService. Reads deep-copied the whole conversation, then filtered. Argon filters first, and swapped Pydantic's generic deep copy for a faster, cycle-safe copier. First model request in a 50-turn session: 64 ms to 36 ms (-43%); at 150 turns, 200 to 122 ms. A full 158-turn run: -14%.
  2. Lazy imports. import google.adk loaded audio/video, OpenTelemetry and FastAPI even for text-only agents. Now those load on first use through lazy module accessors: cold import 1.22 s to 0.97 s (-21%). Removing the top-level imports first broke 25 internal test targets that patched those attributes, so the accessors keep every public attribute where tests expect it.

Why it works

The first attempt (2 hours, one paragraph of instructions) found real bottlenecks but broke a public JSON schema, ran only 216 tests, and had no numbers. The second attempt worked because the environment changed, not the model:

  • Repository rules in .agents/skills/ (architecture, style, review) with an index and deeper files loaded on demand.
  • A baseline measured first: four workloads, 30 runs each.
  • Hard constraints: no API changes, no change to what the model receives, a test per change.
  • A /goal mode that kept the objective alive through context compaction.
  • Argon even found a bug in its own cache and reran all 16,892 tests.

The bigger pattern

The four rejected changes show where agents still fall short: fragility, not speed. One cache used a weak reference that could return stale data if Python reused a memory address. One read a private OpenTelemetry attribute. Two added complexity for synthetic-only gains. The maintainer's job became subtraction: deciding what is safe to keep long-term.

Caveats: the lazy-import gain does not cut time to first request (modules load on the first turn; total went 3.07 s to 3.09 s), the session gain applies only to the in-memory store, and token cost wasn't disclosed.

What it means in practice

  • For long autonomous agent runs, invest in written repo rules, a full test suite and a benchmark harness first. That is what turned a broken draft into a mergeable PR.
  • Review agent PRs for hidden coupling (weak refs, private attributes, mocked import paths), not just benchmark numbers.
  • The two accepted fixes are classic web app wins too: filter before copy/serialize in hot paths, and lazy-load heavy dependencies (with a warm-up request, since the cost moves to the first call).