Urgent.News

What's breaking now, across thousands of outlets.

AI

Google Launched the Gemini Agent. Let's Build a Tiny Model Router in TypeScript.

Most agent stacks pick one model and use it for everything. Tagging an email gets the same model as reviewing a contract. That works. It is also like hiring a senior lawyer to sort your mail. On October 8, 2026 , at Gemini at Work 2026, Google Cloud announced the Gemini agent , which it calls "a universal agent for work." It plans the work, uses skills and tools, and connects to business systems.…

The Problem

A router must answer three questions for each task: which models can handle it, which of those is the cheapest, and whether there is still budget to run it. Most code only answers the first question by hardcoding a model name. That works great for capability but leaves price and budget concerns unanswered.

Step 1: Describe the Models

A model consists of four facts: its tier (small, medium, or large), price per 1,000 tokens, maximum context size, and whether it supports tools. A task describes its required tier, token count, and optional tool support. An override field allows a human to override the system's choice. Google plans to let users select a model themselves initially.

Step 2: Decide What Fits

A model is considered a fit if its tier rank is higher than or equal to the task's required tier, the task's token count does not exceed the model's max context size, and the task requires tools only if the model also supports tools. This ensures models are neither too small nor too large for the task.

Step 3: Pick the Cheapest Fit

After filtering out unfit models, the remaining models are sorted by price. The cheapest model that still meets the task's requirements is selected as the route. For example, a small model may be chosen over a medium or large model if it meets the task's needs at a lower cost.

The Bigger Idea

The core concept is that a router should make data-driven routing decisions based on model capabilities, cost, and budget constraints, rather than relying on hardcoded model choices or blindly prioritizing larger models. A tiny TypeScript implementation demonstrates the idea, routing seven example tasks through various states like running, pausing, rejection, and resuming. Note that the example models, prices, and tasks are fictional and not reflective of Google's actual Gemini agent implementation.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at dev.to →

More in AI

More from Tuesday 13 October →