<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Omri Ben-Tolila on Medium]]></title>
        <description><![CDATA[Stories by Omri Ben-Tolila on Medium]]></description>
        <link>https://medium.com/@omribt?source=rss-0f77ccfdfc85------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*y_ZNvJUS_jVPGlEw</url>
            <title>Stories by Omri Ben-Tolila on Medium</title>
            <link>https://medium.com/@omribt?source=rss-0f77ccfdfc85------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 23:51:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@omribt/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[You Want to Self-Host Your LLM. Here’s What the Napkin Math Leaves Out.]]></title>
            <link>https://medium.com/google-cloud/you-want-to-self-host-your-llm-heres-what-the-napkin-math-leaves-out-21006f7492fa?source=rss-0f77ccfdfc85------2</link>
            <guid isPermaLink="false">https://medium.com/p/21006f7492fa</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[tpu]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Omri Ben-Tolila]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 04:59:54 GMT</pubDate>
            <atom:updated>2026-11-17T14:14:49.273Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>The spreadsheet says GPUs are half the price of per-token APIs. Then your traffic’s shape, your rate limits, your outage plan and a handful of long prompts get a vote.</em></h4><p>Ten GPUs. <strong>$29K a month</strong>, against <strong>$22K</strong> for never owning a GPU at all.</p><p>That was the answer for a startup that did everything the hype says: picked a strong open model, priced a GPU at half the API’s per-token rate, and planned to move off the managed API. The model was fine. The GPUs were fine. The traffic wasn’t. It peaked hard in US business hours and went quiet every night and weekend.</p><p>Doubling the night traffic, without adding a token at the peak, put the same ten GPUs ahead. So did sending the startup’s few very long prompts to the API: five GPUs, <strong>79%</strong> of the per-token bill.</p><p><strong>On a per-token API you pay for your average. On your own GPUs you pay for your peak.</strong></p><p>Think of it as buying a bus for rush hour. Per seat, a full bus is cheap. At 3 a.m. it costs just as much and drives empty. A taxi meter only runs when you ride. Whether the bus pays off has little to do with the bus. It depends on how lopsided your day is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6c395YDg2-ZIk3xUqlY5OA.png" /><figcaption><em>The same bus at rush hour and at 3 a.m.: you pay for both. The meter only runs when someone rides.</em></figcaption></figure><p><strong>Terms used in this post</strong></p><ul><li><strong>Per-token API, or MaaS</strong> (“model as a service”): the managed version of the same open model, billed per token.</li><li><strong>Fleet:</strong> GPUs you rent by the hour and keep running, busy or not.</li><li><strong>Rate limit:</strong> how many requests per second the API accepts before it refuses more.</li><li><strong>Overflow:</strong> traffic sent elsewhere when the fleet or the API is full.</li><li><strong>% of the alternative:</strong> what self-hosting costs, divided by the cheapest per-token setup that serves the same traffic. 100% means the same cost; 132% means self-hosting costs 32% more.</li></ul><p>The repo is at <a href="https://github.com/omribt1/mlops-dilemma">github.com/omribt1/mlops-dilemma</a>. Run it on your own traffic before you trust anyone’s numbers, including mine.</p><h3>The aspiration: GPUs look half the price</h3><p>Here’s the napkin math every team does first. The example in this post is an illustrative startup:</p><ul><li>Gemma 4 26B-A4B (a mixture-of-experts open model), FP8 on NVIDIA RTX PRO 6000 GPUs.</li><li>Requests of 5K input tokens on average, including a 1.8K-token system prompt, and answers of 500 tokens, with reasoning off.</li><li>A long tail: 1.25% of requests are documents or chat histories over 32K tokens (0.3% over 128K).</li><li>An average of 30K input tokens per second, about 79B tokens a month.</li><li>Open-model MaaS (the managed, per-token version of the same model) at $0.15 / $0.60 per million input / output tokens, with a limit of 15 requests per second.</li></ul><p>All-in, MaaS costs about <strong>$0.17 per million input tokens</strong>, output included, with 90% of the system prompt served from cache at $0.015 per million. I measured the GPU side: one RTX PRO 6000 processes about <strong>11,000 input tokens per second</strong> on this mix (18,000 on the short prompts alone). On Agent Platform with a 1-year reservation it costs $3.71 an hour. That’s <strong>$0.093 per million tokens</strong> if the GPU is busy every second of the month: about half the API price.</p><p>That last condition is the whole problem. A GPU at $0.093 beats the API at $0.17 only if it is busy more than <strong>56%</strong> of the time. That number is the break-even utilization, and it’s the first one to compute. It drops to 38% with a 3-year reservation, and to 30% on self-managed GKE with a 3-year commitment. On demand, it’s 89%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rT9RWP3dCxgU7jDtw5i8QQ.png" /><figcaption><em>A GPU pays for itself only when it’s busy enough of the month. The startup’s fleet needs 56% and gets 22%.</em></figcaption></figure><h3>Reality 1: busy hours, not total volume, set the bill</h3><p>GPU capacity is scarce, so I wouldn’t plan on autoscaling in the middle of a spike. While writing this post I couldn’t get two L4s, the smallest GPUs that fit this model, in any of five US regions: every attempt came back “machine type temporarily unavailable”. A fixed fleet has to be sized for the busiest hour, plus headroom for bursts inside that hour. It then runs at roughly <em>average ÷ peak</em> utilization for the rest of the week.</p><p>The startup’s busiest hour is <strong>4.7× its weekly average</strong>. Its quietest hour is a fourteenth of the average. The fleet, sized for the peak with the managed API taking the top of it, sits at <strong>22% utilization</strong>. That’s far below the 56% it needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*df4niYCLNU6VKYw-vh4eZA.png" /><figcaption><em>A week of the startup’s traffic against a fixed fleet of 10 GPUs. Green is served on GPUs; the hatched band is capacity you pay for and don’t use. The peaks above the fleet go to open-model MaaS up to its rate limit.</em></figcaption></figure><p>Now keep the monthly volume, the model, the GPUs and every price the same, and change only <em>when</em> the traffic arrives:</p><p>Same 79B tokens a month, self-hosting as a % of the alternative (1-year / 3-year reservation):</p><ul><li>US business hours (the startup), busiest hour 4.7× the average: <strong>132%</strong> / 93%</li><li>US + Europe, busiest hour 2.3× the average: 86% / 72%</li><li>Follow the sun (Americas, Europe, Asia), busiest hour 1.6× the average: 80% / 60%</li><li>Steady, machine-driven (pipelines, batch scoring), busiest hour 1.1× the average: <strong>68%</strong> / 49%</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4_1DkjfouFMPhRb43r1pew.png" /><figcaption><em>Four weeks with the same monthly volume. The flatter the week, the busier a fixed fleet stays and the more it saves.</em></figcaption></figure><p><strong>Before you price GPUs, compute your peak-to-average ratio.</strong> If it’s above about 3 and your users are in one region, a fleet will mostly sit idle.</p><p>Valleys can fill up, though. Customers in other time zones, nightly batch jobs, backfills and evaluations all land in hours you’ve already paid for:</p><p>Off-peak traffic grows, busiest hour unchanged (still 10 GPUs):</p><ul><li>Off-peak ×1: 132% of the alternative</li><li>Off-peak ×1.5: 106% of the alternative</li><li>Off-peak ×2: <strong>97%</strong> of the alternative</li><li>Off-peak ×4: 81% of the alternative</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Pqw4DiOP8zA2C7XHfEQ3w.png" /><figcaption><em>Grow the nights and weekends and leave the peak alone. The API bill grows with every token; the fleet doesn’t move.</em></figcaption></figure><p><strong>Move deferrable work into the valleys.</strong> On GPUs you already pay for, it’s free; on the API it’s full price.</p><h3>Reality 2: the API has a speed limit</h3><p>Most teams don’t start pricing GPUs because the API is expensive. They start because the API said no. Open-model MaaS endpoints have rate limits, and a limit below your peak means “stay on MaaS” isn’t actually an option.</p><p>So what is the honest alternative to self-hosting? It isn’t “MaaS, ignoring the limit”. It’s <strong>MaaS up to its limit, with the overflow sent to another per-token model</strong>: here, Gemini 3.5 Flash-Lite on Agent Platform. Flash-Lite costs more per token than the open model, so the overflow isn’t free.</p><p>Plan the limit the way you’d plan a fleet: leave room for bursts. An hourly average hides minutes that run hotter, so only about three-quarters of a 15 req/s limit (11.5 req/s) is usable on average, the same burst room the GPUs get. For the startup, the busiest eight hours of every weekday exceed that. MaaS plus Flash-Lite overflow comes to <strong>$22K a month</strong>. Without the limit, MaaS alone would cost $13K.</p><p>That’s the bar the fleet has to beat. Ten GPUs on a 1-year reservation cost $27.1K, plus $2.3K of MaaS overflow at the peaks, for $29K in total, or 132%.</p><p>A higher quota shrinks the fleet but makes the per-token option cheaper just as fast, so the verdict barely moves (126–132% from 0 to 20 req/s) until the quota covers the peak.</p><p><strong>Ask for a higher quota before you buy GPUs.</strong> If the provider raises it above your peak, the comparison becomes plain MaaS, and a peaky workload won’t beat it.</p><h3>Reality 3: outages, without paying for idle GPUs</h3><p>The textbook answer to “what if a zone goes down?” is to run enough capacity to survive losing it. Zone redundancy takes the startup from 10 to 15 GPUs and <strong>192%</strong> of the alternative. Two regions take it to 20 GPUs and 253%.</p><p>There’s a cheaper design, because the same traffic can be served per token:</p><ol><li><strong>Your own GPUs</strong> carry the base load.</li><li><strong>Open-model MaaS</strong> takes the peaks up to its rate limit, and the whole load up to that limit if the GPUs go down.</li><li><strong>Gemini on Agent Platform</strong> takes whatever is left: overflow beyond the limit, and outages.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OAcVc7l5l4XL_xor_-Aldg.png" /><figcaption><em>Own the base, rent the peaks. Your GPUs carry most of the traffic; the per-token layers above them cost nothing while idle.</em></figcaption></figure><p>You pay for layers 2 and 3 only when you use them. Layer 3 can even carry peaks by design. Together with sending the long prompts to MaaS (Reality 4), a fleet of just <strong>three GPUs</strong> with Flash-Lite taking the peaks beyond the MaaS limit costs <strong>72% of the alternative</strong>: cheaper than either pure option, with less than a third of the hardware. The app shows these options whenever they’re cheaper, one click to apply.</p><p>Losing every GPU in the busiest hour costs <strong>$137 on Flash-Lite</strong>. Zone redundancy would cost $14K a month, every month.</p><p><strong>Fail over to tokens, not to idle GPUs.</strong> Before you rely on it, check the second provider’s burst limits at your peak and its data-retention terms, and test your prompts on it: a different model family can answer differently, format JSON differently or ignore parts of a system prompt. Also make sure your gateway can switch models without a deploy.</p><h3>Reality 4: a few long prompts can double the fleet</h3><p>Back to the startup’s long tail: 1.25% of requests over 32K tokens, and 0.3% over 128K (document uploads, long chat histories, averaging 60K and 170K tokens). In request count that’s nothing. In tokens, those requests carry about a fifth of the volume.</p><p>On GPUs they’re worse than their token count suggests. Attention work grows with prompt length, the system prompt is a smaller share so less of it is cached, and a long prompt holds batch slots that short requests are waiting for. In the benchmark behind this post, with normal traffic mixed in, prompts of 32K–128K tokens ran <strong>3.4× slower per token</strong> than short ones, and prompts over 128K <strong>4.5× slower</strong>. At those rates the 1.25% tail takes half of the GPU time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EelVwt-ZSFmLSXeWWoBvXA.png" /><figcaption><em>1.25% of the requests, half the seats: everyone else waits at the stop.</em></figcaption></figure><p>Kept on the fleet, the tail is half of why the startup needs ten GPUs:</p><p>Where the long prompts go (1-year reservation):</p><ul><li>Kept on the fleet: 10 GPUs, $29K a month, 132% of the alternative</li><li>Routed to open-model MaaS: 5 GPUs, $18K a month, <strong>79%</strong> of the alternative</li><li>Routed to Gemini 3.5 Flash-Lite: 5 GPUs, $20K a month, 92% of the alternative</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f2M_YnThzaJ8CrEN9R0VTA.png" /><figcaption><em>The startup’s traffic with its 1.25% tail of long prompts. Routed away, the fleet halves to five GPUs for the short prompts it serves well, and self-hosting wins.</em></figcaption></figure><p><strong>Route on prompt length at the gateway, not on load alone.</strong> If your users can wait, there’s a third option: queue them for the nightly valley. In request-level simulations I’ve run, deferring long prompts to off-peak hours sometimes beat routing them.</p><h3>Three levers you control</h3><p><strong>Commitment length matters more than the platform.</strong> The same 10 GPUs cost 201% of the alternative on demand, 132% on a 1-year reservation and 93% on a 3-year one (75% on self-managed GKE). But a 3-year commitment is a bet on your traffic that few startups can make.</p><p><strong>Your throughput error is bigger than most price differences.</strong> Assume 25% less throughput than reality and the startup lands at 169%; 25% more, 107%. My first clean benchmark of a production-shaped workload came in about 30% optimistic: caching helped half as much as expected, and long reasoning outputs held batch slots. Measure with prompts shaped like yours, and check the serving stack first: my first runs failed because the current serving image for this model cut every request at 30 seconds.</p><p><strong>Reasoning without a budget is an open-ended output bill.</strong> In an earlier run with reasoning on, Gemma 4, which has no thinking budget, used its whole output allowance on 89% of reasoning requests and returned JSON cut off mid-answer. A frontier model did the same while reviewing this post: it spent its entire 32K-token output on reasoning and returned nothing. If your model can’t cap its reasoning, validate structured outputs, count truncated answers as failures, and benchmark without thinking, as this post’s numbers do.</p><h3>From a hunch to a measured answer, all in your browser</h3><p>Every number in this post came out of an open-source app I built for this decision: <a href="https://github.com/omribt1/mlops-dilemma">mlops-dilemma</a>. Start it once with dilemma ui; everything else happens in your browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fv2cBd70pongzXFYVT43vg.png" /><figcaption><em>The app on the startup example. The verdict sits above a week of traffic drawn against the fleet, with the cheaper Gemini-at-peaks option one click away; drag the fleet line to try other sizes.</em></figcaption></figure><p><strong>Describe your workload however you have it</strong>, as six numbers, a traffic shape you can paint, a Cloud Monitoring import or a requirements document Gemini turns into a workload, and <strong>get the answer first</strong>: one sentence on whether to self-host, with your week drawn against the fleet. Drag the fleet line and every number follows; toggle where peaks overflow, where long prompts go and what you fail over to. Models, GPUs and prices are read live from Model Garden, Hugging Face, Compute Engine and the Cloud Billing Catalog.</p><p><strong>Then measure it.</strong> Every throughput figure says whether it’s measured or estimated. Press <em>Run a benchmark</em> and the app deploys the model on a dedicated Agent Platform endpoint, checks the serving stack in two minutes, load-tests it with your prompts (or synthetic ones shaped like your traffic), calibrates long prompts, and tears the endpoint down, even if a step fails. A full run on one RTX PRO 6000 took 17 minutes: under $2 of GPU time. Before you deploy, it checks that the GPU exists in your region and that your quota covers the test and the fleet.</p><p>How every number is calculated is in the repo’s <a href="https://github.com/omribt1/mlops-dilemma/blob/main/docs/methodology.md">methodology</a>.</p><h3>What Google Cloud gives you, and the gap</h3><p>Most of the pieces exist: Model Garden’s verified vLLM containers on dedicated Agent Platform endpoints, reservations with committed-use discounts behind them, the same open models served per token, Gemini one model ID away, and every SKU in the Cloud Billing Catalog. What’s missing is the glue that turns <em>your</em> traffic into a fleet size, a throughput you trust and a monthly bill for every design. That’s the gap the app fills.</p><h3>What the bill leaves out</h3><p>The comparison prices hardware and tokens. Some costs it covers only in part, and some not at all:</p><ul><li><strong>People</strong> (in the numbers: no): Running a fleet means on-call, vLLM and driver upgrades, capacity planning and model re-validation. Even half an engineer’s time can outweigh the savings in this post.</li><li><strong>Management</strong> (in the numbers: on agent platform, yes): Agent Platform prices include its management fee. Self-managed GKE is cheaper because you run the cluster yourself.</li><li><strong>Latency</strong> (in the numbers: partly): A benchmark only counts throughput that meets your latency budget. This example allows minutes; a budget of seconds fits fewer requests on each GPU, so you need more of them. Self-hosted latency is steadier than a shared API’s, and overflow to Gemini changes both latency and the answers.</li><li><strong>Fleet coordination</strong> (in the numbers: partly): Splitting a large model across several GPUs is in the throughput estimate. Balancing replicas, rolling upgrades, deploys that take 10–30 minutes, scaling on capacity you may not get, and spare capacity for testing aren’t.</li></ul><p>These are list prices in one region, for one model, on an illustrative workload, with throughput measured on synthetic prompts shaped like the startup’s. Check quality for FP8 and every model you route to, and re-run the numbers before you sign anything.</p><h3>The bus and the meter</h3><p>Self-hosting doesn’t pay off because GPUs are cheap. It pays off when your traffic keeps them busy, the API can’t carry your peak, and the long prompts ride elsewhere. Most of the time the winner isn’t either extreme: own the base, rent the peaks. A per-token API charges for your average; a fixed fleet charges for your peak. Your traffic’s shape decides which of those is smaller.</p><p>So before you follow the hype, look at your week. If it spikes in one time zone and sleeps at night, don’t buy a bus for rush hour: buy a small one for the base, ride the meter for the peaks, and send the heavy luggage by taxi. If your valleys are filling up, or your users span continents, buy the bigger bus. Fill its empty seats with batch work, and keep the meter for the peaks, the airport runs and the bad days.</p><h3>Bonus read</h3><p>If you want to make sure your serving config is optimized before scaling up, check out this <a href="https://medium.com/@amirmordechai/alpha-inference-autonomous-ai-inference-optimization-with-google-cloud-alphaevolve-8f28b4e7530b">optimizer repo</a> built by my colleague <a href="https://medium.com/u/9e9136e68c86">Amir Davidoff</a>, you can bring your optimized serving config to mlops-dilemma.</p><p><strong>Disclaimer.</strong> This code is provided “as-is” as a demonstration only to illustrate a potential solution. The code does not constitute a Google product or service of any kind, and Google offers no support, warranties, or liability of any kind with its regard. Whoever chooses to use this code accepts all responsibility related to it, including for its implementation, use, and ongoing maintenance. For the avoidance of doubt, this code is not eligible for the Google Open Source Software Vulnerability Rewards Program.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21006f7492fa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/you-want-to-self-host-your-llm-heres-what-the-napkin-math-leaves-out-21006f7492fa">You Want to Self-Host Your LLM. Here’s What the Napkin Math Leaves Out.</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Prompting, Start Clicking: An Agent That Designs Its Own Studio with A2UI]]></title>
            <link>https://medium.com/google-cloud/stop-prompting-start-clicking-an-agent-that-designs-its-own-studio-with-a2ui-1945a1a1de61?source=rss-0f77ccfdfc85------2</link>
            <guid isPermaLink="false">https://medium.com/p/1945a1a1de61</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[a2ui]]></category>
            <category><![CDATA[gemini-enterprise]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Omri Ben-Tolila]]></dc:creator>
            <pubDate>Mon, 26 Oct 2026 23:57:00 GMT</pubDate>
            <atom:updated>2026-10-26T23:57:00.956Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eIqUfyUo-kKqZNQVdnT4mg.png" /></figure><p>A follow-up on A2UI in Gemini Enterprise: the agent looks at each image it generates and builds the controls for that image. Running on Agent Runtime, with the gotchas I hit along the way.</p><figure><img alt="The Agent-I:X studio in Gemini Enterprise: version chips, before and after, and the gauges picked for this image beside it" src="https://cdn-images-1.medium.com/max/1024/1*f2DO9P6WYICthm7RPM9QJg.png" /><figcaption><em>The studio in Gemini Enterprise after a quick-fix edit. The slider values the user hadn’t applied went in first (v2), then the edit (v3)</em></figcaption></figure><p>A few weeks ago my colleague Yonit Gruber-Hazani published <a href="https://medium.com/google-cloud/your-enterprise-agent-talks-too-much-give-it-a-ui-with-a2ui-on-cloud-run-4657e2b433a3">Your Enterprise Agent Talks Too Much. Give It a UI with A2UI on Cloud Run</a>. If you haven’t read it, start there. It explains what A2UI is, walks through the v0.9 messages (createSurface, updateComponents, updateDataModel), shows the agent card extension, and registers a Cloud Run agent in Gemini Enterprise over A2A. I won&#39;t repeat any of that here.</p><p>This post picks up where hers stops. Her operations dashboard shows the case for A2UI over walls of text. I wanted to see what happens when the UI is the main way you work, not a display: a creative studio where every control goes back to the agent, and where the agent decides <strong>which controls to show</strong> by looking at what it just made.</p><p>The code is at <a href="https://github.com/omribt1/agent-ix">github.com/omribt1/agent-ix</a>.</p><h3>The problem: prompt purgatory</h3><p>Image models are good now. Iterating with them through a chat box is still painful. You get an image that’s 80% right and then you guess adjectives: “slightly warmer, softer shadow, keep the mug where it is.” Sometimes the model changes the whole scene. Sometimes you just wanted a bit more exposure, which needs no model at all.</p><p>Creative people don’t work that way. They grab a slider, compare before and after, and answer questions like “studio background or outdoors?” So the goal for Agent-I:X was simple: <strong>refining an image should be done by clicking, not prompt engineering</strong>, and the clicking should happen where the user already is, in Gemini Enterprise.</p><p>A2UI fits because, as Yonit explains, the agent sends declarative JSON and the host renders its own vetted widgets. For a creative tool, that has two advantages beyond safety. The controls look native in GE without any frontend work. And the same JSON renders in any other A2UI host: the repo includes a small @a2ui/lit client that renders the exact same surfaces locally.</p><h3>What the agent does</h3><ol><li>You @-mention Agent-I:X in Gemini Enterprise and ask for an image (“a hero shot of a ceramic coffee mug for our spring campaign”). The agent expands the prompt and renders it with Nano Banana 2 Lite by default (fast drafts). Nano Banana 2 and Nano Banana Pro are one toggle away.</li><li>A Gemini vision call <strong>critiques the result</strong>: what kind of subject it is, what works, what’s off.</li><li>From that critique, the agent builds a studio card. It holds the image, quick-fix chips for flaws it can see, two guiding questions with options, the 3–5 tone gauges that matter for <em>this</em> image, render settings, a free-text box, and next steps (upscale, animate, download).</li><li>Every click is an A2A action back to the agent. The agent edits, re-critiques and sends a new card. Every version is kept, so “go back to v2” restores without regenerating.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eIqUfyUo-kKqZNQVdnT4mg.png" /><figcaption>Picking Agent-I:X from the @-mention list in Gemini Enterprise</figcaption></figure><h3>Controls chosen per asset</h3><p>A portrait gets different questions and gauges than a product shot or a landscape. That’s the part I find most interesting about agent-generated UI: the surface isn’t a fixed template the agent fills in. It’s chosen per asset.</p><p>The critique is a structured-output call. The model picks <em>what</em> to show; Python decides <em>how</em> it renders:</p><pre>class Critique(BaseModel):<br>    subject_type: Literal[&quot;product&quot;, &quot;portrait&quot;, &quot;landscape&quot;, &quot;food&quot;, &quot;interior&quot;, &quot;illustration&quot;, &quot;other&quot;]<br>    summary: str = Field(description=&quot;One sentence: what works and the main thing to improve.&quot;)<br>    quick_fixes: list[QuickFix] = Field(max_length=3, description=&quot;Specific flaws you can see.&quot;)<br>    questions: list[ClosedQuestion] = Field(min_length=1, max_length=2,<br>        description=&quot;Creative forks worth asking about for THIS image.&quot;)<br>    open_question: str = Field(description=&quot;One open question inviting a free-text refinement.&quot;)<br>    gauges: list[GaugeName] = Field(min_length=3, max_length=5,<br>        description=&quot;The pixel adjustments most useful for this image.&quot;)<br>    motion_ideas: list[str] = Field(min_length=2, max_length=3,<br>        description=&quot;2-5 word camera/subject motion ideas for a short clip.&quot;)</pre><p>built from the filter registry, so the model can only pick gauges that exist. Each quick fix and each answer option carries the edit instruction it will send to the image model, so a click maps directly to an edit.</p><p>GaugeName is a Literal built from the filter registry, so the model can only pick gauges that exist. They always appear in the registry’s order, so a slider keeps its place from card to card. If the pick doesn’t suit you, ask: “show me grain”, “only exposure and contrast”. A change_gauges tool swaps the sliders without rendering anything, and the choice sticks for the rest of the chat. Each quick fix and each answer option carries the edit instruction it will send to the image model, so a click maps directly to an edit.</p><p>I kept the A2UI JSON out of the LLM entirely. Deterministic Python builds the surface; the critique only decides what goes into it. Every surface is validated against the GE composite catalog before it’s sent:</p><pre>if errors := catalog().validate_components(messages):<br>    raise InvalidSurface(&quot;; &quot;.join(f&quot;{e.path}: {e.message}&quot; for e in errors))</pre><p>That check caught more bugs than any other test in the repo.</p><h3>Two kinds of controls</h3><p>Not every change needs a model. The studio splits controls by cost:</p><ul><li><strong>Tone gauges (warmth, exposure, contrast, grain…)</strong>: Live preview in the browser; <em>Apply</em> renders with Pillow, no model call (preview: no round trip; apply: one A2A round trip)</li><li><strong>Quick fixes, answers, free text</strong>: Nano Banana edit of the current image (3.5–10 s)</li><li><strong>New image (Lite)</strong>: Nano Banana 2 Lite (3.5–5 s)</li><li><strong>4K upscale</strong>: Nano Banana 2 / Pro (26 s / 39 s)</li><li><strong>Animate</strong>: Omni, ~4 s clip (~30 s)</li></ul><p>Gauges always apply to the last model-generated image, never on top of a previous filter result, so any slider state can be reproduced. If you move sliders and then click a quick fix without applying, the slider values travel with the edit instead of being lost.</p><figure><img alt="The guiding questions card in Gemini Enterprise" src="https://cdn-images-1.medium.com/max/1024/1*ST0qJ0YsqcUaAdBKv3eBjw.png" /><figcaption><em>“Ask me more” in Gemini Enterprise: new questions about the current image</em></figcaption></figure><h3>The action loop on Agent Runtime</h3><p>The agent runs on <strong>Agent Runtime</strong> (deployed with agents-cli), which serves A2A for you. GE calls the engine&#39;s /a2a/v1 endpoints directly. Once make publish registers it as an A2A agent, it shows up in the app&#39;s agent gallery next to the others.</p><figure><img alt="Agent-I:X in the “From your organization” agent gallery" src="https://cdn-images-1.medium.com/max/524/1*PUSBZ2wq3QoGXOfU99_Pww.png" /><figcaption>Agent-I:X in the “From your organization” agent gallery</figcaption></figure><p>When the user clicks a control, GE sends a DataPart containing the A2UI action. ADK&#39;s stock A2aAgentExecutor didn&#39;t fit for two reasons. It returns only the last event&#39;s parts, and my A2UI comes from a tool response mid-turn. It would also pass the action to the model as raw JSON. So the repo has a small custom executor that turns actions into a compact text line for the model:</p><pre>def action_to_text(action: dict[str, Any]) -&gt; str:<br>    hidden = {&quot;prompt&quot;, &quot;model&quot;, *(PENDING_FILTER_KEYS if _carries_filters(action) else ())}<br>    context = {k: v for k, v in (action.get(&quot;context&quot;) or {}).items() if k not in hidden}<br>    return f&quot;[ui-action] {action[&#39;name&#39;]} context={json.dumps(context, ensure_ascii=False)}&quot;</pre><p>Slider values that ride along with an edit go into session state, not the prompt. The tool applies them exactly instead of trusting the model to copy eight numbers into a second call. The instruction maps each [ui-action] name to a tool call with no confirmation step.</p><p>Two details from the GE side:</p><ul><li><strong>context.prompt is what the user &quot;said&quot;.</strong> GE shows it as the chat message for the click, so every action carries a human sentence (&quot;Apply my answers&quot;).</li><li><strong>Use a fresh </strong><strong>surfaceId per response.</strong> Reusing one across turns confused the renderer.</li></ul><h3>What I hit in Gemini Enterprise</h3><p>None of these were in the docs I had, and each cost me an afternoon.</p><p><strong>Agent Runtime needs an OAuth authorization.</strong> Agent Runtime’s A2A endpoint is a Google Cloud API (aiplatform.googleapis.com), so every call needs an OAuth token, and GE only sends one to an A2A agent when an authorization resource is attached to it. Without one, I got 401 CREDENTIALS_MISSING on every call. The fix is a Web OAuth client with GE&#39;s redirect URI, an authorization resource that uses it with the cloud-platform scope, and --authorization-id at publish time. GE then signs the user in once and calls the Agent Runtime endpoint with their token. The repo has a script that creates the authorization (deployment/create_ge_authorization.py), and make publish attaches it.</p><p>It’s an extra setup step, but it’s the more secure arrangement. Every request reaches Agent Runtime authenticated as the signed-in user rather than as a shared service account, so Google Cloud checks <em>that user’s</em> permissions on the agent, and calls can be audited per person (with Data Access audit logs turned on). Access is granted and revoked per person in IAM. Nothing long-lived is shared: GE holds short-lived user tokens. What your agent code receives is another matter, as the next point explains.</p><figure><img alt="Gemini Enterprise asking the user to authorize Agent-I:X" src="https://cdn-images-1.medium.com/max/1024/1*78I7OMm6CLizRWw68-KvfQ.png" /><figcaption><em>The first time someone uses the agent, GE asks them to authorize it. After that, every call carries their own token</em></figcaption></figure><p><strong>The user’s token doesn’t reach your code on Agent Runtime.</strong> Agent Runtime checks the user’s token, then replaces the Authorization header with its own Google-signed ID token (audience: the engine&#39;s internal URL) before the request reaches the agent. So the agent can&#39;t act as the user.</p><p><strong>MaterialImage blanks signed GCS URLs.</strong> Small thumbnails can be inlined as base64, but a studio needs 1600 px previews, and 2K/4K files behind &quot;Open full size&quot;, so I store assets in a private bucket and send V4 signed URLs. MaterialImage rendered them as src=&quot;about:blank&quot;. A probe card showed it loads data: and gstatic URLs but not signed GCS or Wikimedia URLs. The basic Image component (and Video) loads them fine:</p><pre>def _image(b: _Builder, id_: str, url: str | dict, alt: str) -&gt; str:<br>    # Basic Image, not MaterialImage: GE&#39;s MaterialImage only loads allowlisted hosts<br>    # and blanks signed GCS URLs (about:blank); Image and Video load them.<br>    return b.add(id_, &quot;Image&quot;, url=url, description=alt, fit=&quot;contain&quot;, variant=&quot;largeFeature&quot;)</pre><p><strong>No sticky or scrolling panels.</strong> The catalog’s style allowlist leaves out position and overflow on purpose (the schema comment cites clickjacking, CWE-1021). To keep the image in view while you adjust, the gauges sit beside the image using weight and minWidth, and wrap under it on a narrow card.</p><p><strong>One build gotcha.</strong> The Agent Runtime remote build installs with pip, which ignores uv’s override-dependencies. The evaluation extra of google-cloud-aiplatform pulls litellm, whose jsonschema pin conflicts with the A2UI SDK, so it lives in the dev dependency group only.</p><h3>Live filter preview, with no custom code in GE</h3><p>Live preview was the hardest obstacle: it almost made me drop the gauges entirely. A slider that does nothing until you click <em>Apply</em> is a form, not a studio. GE gives you no way to run your own code: no CSS filter style, no custom client functions, and a slider can&#39;t call the agent until a button is clicked. I tried IFrameSrcdoc (an HTML page with a slider inside), and it rendered nothing in our GE app.</p><p>What GE does have is data binding and formatString, and an Image url can be a formatString call. GE evaluates it again whenever the data model changes, and the sliders write to the data model. So the card&#39;s image is an SVG data URL whose CSS reads the slider values. Simplified from app/studio/live_preview.py (warmth, contrast and sharpness are blended layers inside the SVG, see below):</p><pre>chain = (<br>    f&quot;brightness(calc(1 + {_v(&#39;exposure&#39;)} * 0.006)) &quot;   # _v(&#39;exposure&#39;) == &quot;${/filters/exposure}&quot;<br>    f&quot;saturate(calc(1 + {_v(&#39;saturation&#39;)} * 0.01)) &quot;<br>    f&quot;blur(calc({_v(&#39;blur&#39;)} * 0.06px))&quot;<br>)<br>svg = f&quot;&lt;svg ...&gt;&lt;image href=&#39;data:image/jpeg;base64,${{/live/base}}&#39; style=&#39;filter:{chain}&#39;/&gt;&lt;/svg&gt;&quot;<br>url = &quot;data:image/svg+xml;utf8,&quot; + svg.replace(&quot;%&quot;, &quot;%25&quot;).replace(&quot;#&quot;, &quot;%23&quot;)<br>image_url = {&quot;call&quot;: &quot;formatString&quot;, &quot;args&quot;: {&quot;value&quot;: url}}</pre><p>Drag a gauge and GE redraws the image in the browser, with no call to the agent. <em>Apply</em> still renders the real result with Pillow. A few things made it work properly:</p><ul><li><strong>Same math as the server.</strong> Pillow’s warmth and sharpness are linear blends, so a pre-filtered copy faded in with opacity: calc(...) matches them. Exposure, saturation and blur are CSS filter functions with Pillow&#39;s constants. Compared pixel by pixel against Pillow, most gauges land within about 1 grey level out of 255.</li><li><strong>Contrast is a blend too, not CSS contrast(). </strong>Pillow pivots contrast on the image’s mean grey, CSS on 50%. brightness(1/2m) contrast(k) brightness(2m) moves the pivot to the mean.</li><li><strong>The real render wins at rest.</strong> The applied Pillow image sits on top with an opacity that is 1 only while every slider is at its applied value. After <em>Apply</em> you see the actual output, not an approximation.</li><li><strong>Images go in the data model, not the template.</strong> The A2UI reference renderer rejects formatString templates over 10,000 characters. The ~65 KB preview lives at /live/base, and the template stays small.</li><li><strong>Watch negative numbers.</strong> -${/filters/contrast} becomes --50 at -50, which CSS reads as a name and not a number, and the whole filter is dropped.</li></ul><p>The cost is about 80 KB per studio card, all from the embedded preview.</p><h3>Two hosts, one surface</h3><p><strong>[IMAGE 6: docs/img/local-studio.png]</strong><br>Alt text: The same studio surface in the local @a2ui/lit client<br>Caption: <em>The same surface in the local </em><em>@a2ui/lit client. Compare it with the Gemini Enterprise card at the top.</em></p><p>I built the local Lit client for fast iteration. It turned out to be the best argument for A2UI in this project. The agent doesn’t know or care whether GE or my client is rendering. The live preview used to be a feature of my client alone. Once it moved into the surface itself, I deleted the client-side version, and both hosts now run the same SVG. GE adds the enterprise parts: identity, the app directory and the chat history. Same JSON, same validation, two hosts.</p><h3>What I’d tell someone building this</h3><ul><li><strong>Read Yonit’s post first</strong> for the protocol and the registration flow.</li><li><strong>Decide where you run.</strong> Agent Runtime gives you A2A, the deploy pipeline and per-user OAuth, but your agent code never sees the user’s token.</li><li><strong>Let the model pick, let code render.</strong> A structured critique choosing from a closed set of controls gives you a per-asset UI without the model writing UI JSON.</li><li><strong>Validate every surface against the catalog in tests.</strong> GE fails quietly on a bad surface.</li><li><strong>Split controls by cost.</strong> Users notice the difference between instant and eight seconds. Don’t spend a model call on exposure.</li><li><strong>Probe the host.</strong> One-card probes answered the image, iframe and live preview questions in minutes, after hours of guessing.</li><li><strong>Data binding can stand in for client code.</strong> formatString plus an SVG data URL gave GE a live preview without a single line of code running in the host.</li></ul><p>The repo has the agent, the local client, tests, evals and the deploy steps: <a href="https://github.com/omribt1/agent-ix">github.com/omribt1/agent-ix</a>.</p><p><strong>References</strong></p><ul><li>Yonit Gruber-Hazani, <a href="https://medium.com/google-cloud/your-enterprise-agent-talks-too-much-give-it-a-ui-with-a2ui-on-cloud-run-4657e2b433a3">Your Enterprise Agent Talks Too Much. Give It a UI with A2UI on Cloud Run</a>, and her repo <a href="https://github.com/yonitg/ge-agent-a2ui">yonitg/ge-agent-a2ui</a></li><li><a href="https://a2ui.org/">A2UI specification</a></li><li><a href="https://adk.dev/">Agent Development Kit (ADK)</a></li><li><a href="https://cloud.google.com/gemini-enterprise">Gemini Enterprise</a></li></ul><blockquote>Disclaimer: This code is provided “as-is” as a demonstration only to illustrate a potential solution. The code does not constitute a Google product or service of any kind, and Google offers no support, warranties, or liability of any kind with its regard. Whoever chooses to use this code accepts all responsibility related to it, including for its implementation, use, and ongoing maintenance. For the avoidance of doubt, this code is not eligible for the Google Open Source Software Vulnerability Rewards Program.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1945a1a1de61" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/stop-prompting-start-clicking-an-agent-that-designs-its-own-studio-with-a2ui-1945a1a1de61">Stop Prompting, Start Clicking: An Agent That Designs Its Own Studio with A2UI</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>