# Cheap classifier routes coding-agent tasks across Gemini models

published: 2026-11-03T18:05:59.725Z
topic: infrastructure
source: https://developers.googleblog.com/cost-per-task-using-cheap-classifiers-to-route-across-gemini-models-and-thinking-levels/
url: https://aiagentnews.io/stories/cheap-classifier-routes-coding-agent-tasks-across-gemini-models

A Google Cloud write-up tests whether a cheap classifier can send coding-agent tasks to the cheapest Gemini model that still gets them right. In a 50-task benchmark, a Flash-Lite first pass with escalation to Flash on low thinking solved every task, the same score as Flash on low thinking alone, and the authors say it can reduce both cost and response time.

The article argues that cost per successful task matters more than price per million tokens for coding agents. It places TypeSafe's Jev classifier in front of Gemini calls, where it returns a choice, a score or a yes-or-no probability in a single pass. Google says it has no partnership with TypeSafe and that the same routing pattern works with other classifiers, including a DiffusionGemma codelab.

A single broad question sent almost every task to the simple path, so the authors split it into one atomic check about whether answering needs several sequential steps. A regex and prompt-length heuristic fell to 70.6% on 34 unseen tasks, while Jev classified all 34 correctly. Capping maxOutputTokens at 300 did not reduce thinking on easy tasks, so the authors recommend setting thinkingLevel to LOW instead.

Flash-Lite alone missed 6 of the 25 hard tasks, and the router that escalated those to Flash on low thinking solved all 50. The authors note the limits of one run per setup and hand-assigned difficulty. They also say context caching works per model, so switching models between turns can lose the cache discount.

## Why it matters if you build agents

Start with a fast model on a low thinking setting and measure cost per task before adding a classifier. Split routing decisions into one yes-or-no question per factor rather than one broad question. Test security-related prompts on the exact model you plan to use, since the Pro configuration declined two code-security review prompts that Flash answered.
