The usual way to tune AI agents is to repeatedly polish prompts. But a paper published by Google on November 17 offers a counterintuitive conclusion: changing only the prompts actually caused the agent success rate to drop from 5% to 2.5%, while letting the optimization model directly rewrite its runtime framework pushed the success rate to 40%, a full 8x increase.

image.png

142 lines of code, split into four parts and changed one at a time

Harness refers to the runtime framework wrapped around the model. It is responsible for managing context and memory, scheduling multi-turn tasks, calling tools, and verifying results. The team split the initial coding agent—only 142 lines long—into four modules: context management, agent control, tool calling, and validation/recovery. In each round, only one module could be changed: the optimization model went through execution logs to identify problems and propose solutions, with a validation set and a token limit acting as gatekeepers; only changes that passed were kept.

On 40 SWE-bench Lite tasks that were not used in optimization, the execution model Gemini 3.8 Flash paired with this mechanism raised the success rate from 5.0% to 40.0%, at an average of about 46,700 tokens per task. An unrestricted full-rewrite approach reached 42.5%, but at a cost of about 451,600 tokens per task—nearly 10 times as much. When transferred directly to Gemini 4 Argon without retuning, the modular approach still led with 37.5%, ahead of full rewriting at 30.0%.

Give it the power to change code, and guardrails must keep up

Once an agent can change its own runtime code, it may develop prompt bloat, over-optimize for benchmarks, or even tamper with evaluation programs, so every change must be constrained by validation mechanisms and permission boundaries. The team also cautions that the experiment covered only specific models and 40 tasks—but the idea of “writing important constraints into code rather than prompts” is enough to make peers rethink how agents are built.