<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: t4zxxx1</title>
    <description>The latest articles on DEV Community by t4zxxx1 (@t4zxxx1).</description>
    <link>https://dev.to/t4zxxx1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4280484%2F64a8b8b8-d0a2-4744-895e-7524fe09bfb8.png</url>
      <title>DEV Community: t4zxxx1</title>
      <link>https://dev.to/t4zxxx1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/t4zxxx1"/>
    <language>en</language>
    <item>
      <title>I measured 11 ways to give an AI agent a browser. The token bill ranged from 30k to 2.5M</title>
      <dc:creator>t4zxxx1</dc:creator>
      <pubDate>Thu, 03 Dec 2026 11:32:29 +0000</pubDate>
      <link>https://dev.to/t4zxxx1/i-measured-11-ways-to-give-an-ai-agent-a-browser-the-token-bill-ranged-from-30k-to-25m-409l</link>
      <guid>https://dev.to/t4zxxx1/i-measured-11-ways-to-give-an-ai-agent-a-browser-the-token-bill-ranged-from-30k-to-25m-409l</guid>
      <description>&lt;p&gt;Browser automation is where AI agents burn tokens fastest. A form that takes a human two minutes can cost an agent hundreds of thousands of tokens, and most of it is not "thinking": it is the model re-reading page dumps it has already seen.&lt;/p&gt;

&lt;p&gt;I wanted numbers instead of impressions, so I ran the same three tasks through eleven ways of giving an agent a browser and counted every token that entered the context. Disclosure up front: one of the eleven is &lt;a href="https://github.com/t4zxxx1/colibri-mcp" rel="noopener noreferrer"&gt;Colibri&lt;/a&gt;, the open-source MCP server I built, and the test pages are mine. Both points matter for how you read the results, and I come back to them at the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Three tasks:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;T1 — a grant application on two pages.&lt;/strong&gt; Reject cookies, fill 22 fields (text, numbers, dates, four dropdowns, one of them dependent on another, a town autocomplete, a radio choice), tick two declarations, go to page 2, read the summary, submit through a confirmation modal, read the protocol number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;T2 — list → detail.&lt;/strong&gt; In a list of 25 projects, open one and read its table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;T3 — navigation.&lt;/strong&gt; From a heavy home page, open the project list and read how many there are.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Eleven methods:&lt;/strong&gt; screenshots (computer use), Playwright MCP, playwright-slim, Playwright CLI (with and without loading its skill), agent-browser CLI (with and without its guide), agent-browser MCP, Fast Playwright MCP, and Colibri in two modes.&lt;/p&gt;

&lt;p&gt;Each tool was driven the most efficient way its own docs suggest, and the agents were simulated with hand-written sequences that execute for real in a browser. When a step failed, the simulated agent did what a real one would do: read the error, fix it, retry. The extra call was counted. Tokens were counted with Claude's public tokenizer, and screenshots with the official width × height / 750 formula.&lt;/p&gt;

&lt;p&gt;The metric that matters most is &lt;strong&gt;total context re-read&lt;/strong&gt;: on every turn the model re-reads the whole conversation, so a 5k-token snapshot on turn 3 is paid again on turns 4, 5, 6…&lt;/p&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F837yyd5x9p80ca9qdnak.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F837yyd5x9p80ca9qdnak.png" alt="Total context tokens to finish T1" width="799" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;T1 (22-field form, 2 pages)&lt;/th&gt;
&lt;th&gt;Calls&lt;/th&gt;
&lt;th&gt;Tokens returned by tools&lt;/th&gt;
&lt;th&gt;Total context re-read&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Screenshots&lt;/td&gt;
&lt;td&gt;54&lt;/td&gt;
&lt;td&gt;74,304&lt;/td&gt;
&lt;td&gt;2,480,688&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;agent-browser MCP&lt;/td&gt;
&lt;td&gt;40&lt;/td&gt;
&lt;td&gt;16,981&lt;/td&gt;
&lt;td&gt;1,374,984&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Playwright MCP&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;td&gt;23,421&lt;/td&gt;
&lt;td&gt;318,910&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;playwright-slim&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;23,455&lt;/td&gt;
&lt;td&gt;290,040&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;agent-browser CLI&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;19,010&lt;/td&gt;
&lt;td&gt;149,555&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fast Playwright MCP&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;13,622&lt;/td&gt;
&lt;td&gt;120,557&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Playwright CLI&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;13,175&lt;/td&gt;
&lt;td&gt;92,872&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;agent-browser CLI, no guide&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;9,396&lt;/td&gt;
&lt;td&gt;84,276&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Playwright CLI, no guide&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;8,706&lt;/td&gt;
&lt;td&gt;63,728&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Colibri, explicit steps&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;1,108&lt;/td&gt;
&lt;td&gt;39,427&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Colibri, &lt;code&gt;browse_task&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;612&lt;/td&gt;
&lt;td&gt;29,750&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On the short tasks the gaps shrink, as they should: in T2 Colibri re-read 22,292 tokens against 35,264 for Playwright CLI without its guide and 73,371 for Playwright MCP.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually drives the cost
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Number of turns beats size of each response.&lt;/strong&gt; Screenshots are not that big individually (~1.4k tokens each), but one action per call means 54 turns, and the conversation is re-read 54 times. agent-browser's MCP profile has the same problem: its default &lt;code&gt;core&lt;/code&gt; profile has no batch command, so 40 calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Full snapshots after every page change.&lt;/strong&gt; Playwright MCP is solid. It hit no errors at all in my runs. But it returns a full accessibility snapshot whenever the page changes, and on a real form that is thousands of tokens each time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Smaller tool definitions help less than you'd think.&lt;/strong&gt; playwright-slim cuts Playwright MCP's tool definitions by 63% (4,536 → 1,689 tokens), a real gain. But the pages stay the same size, so over a whole task the total drops by only 9%.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. CLIs are efficient, but the guide is a hidden cost.&lt;/strong&gt; Playwright CLI and agent-browser CLI were the strongest competitors, because snapshots go to a file and the agent reads only what it asks for. But loading their guides costs ~4.6k and ~9.6k tokens, which on short tasks eats most of the saving. They also need an agent with a shell (Claude Code, Codex…). In Claude Desktop, Cursor or VS Code chat you are back to MCP tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Errors are expensive.&lt;/strong&gt; Every failed step is one more full turn. A few reproducible ones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;agent-browser: &lt;code&gt;fill&lt;/code&gt; on a native date input answers "Done" but leaves it empty; &lt;code&gt;select&lt;/code&gt; on a dependent dropdown fails instead of waiting for it to fill.&lt;/li&gt;
&lt;li&gt;playwright-slim: the published schema says &lt;code&gt;ref&lt;/code&gt;, but the server wants &lt;code&gt;target&lt;/code&gt;, so the first click of every task fails.&lt;/li&gt;
&lt;li&gt;Fast Playwright MCP: a click that navigates after ~200 ms breaks the state capture ("Execution context was destroyed").&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I built from this
&lt;/h2&gt;

&lt;p&gt;Colibri attacks exactly those five points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pages as compact rows, not trees.&lt;/strong&gt; Each interactive element is one line: role, name, value, state (&lt;code&gt;req&lt;/code&gt;, &lt;code&gt;inv&lt;/code&gt;, &lt;code&gt;off&lt;/code&gt;…), plus flags for risky actions. A form page is a few hundred tokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Many steps in one call, diff back.&lt;/strong&gt; The agent sends all the foreseeable steps at once (fill, select, click, wait, read) and gets back only what changed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A local form engine (&lt;code&gt;browse_task&lt;/code&gt;).&lt;/strong&gt; The agent passes the user's data by label (&lt;code&gt;{"Town": "Ischia", "Start date": "2026-03-01"}&lt;/code&gt;) and a small local matcher decides which field gets what, including dependent menus, autocompletes and dates. If it isn't confident, it asks instead of guessing. No API key, zero model tokens for the matching.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safety in the server, not in the prompt.&lt;/strong&gt; The model can never type into password, card, CVV, OTP or IBAN fields. Submit, pay and delete buttons are blocked until the user says OK.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your real browser if you want it.&lt;/strong&gt; &lt;code&gt;CB_MODE=attach&lt;/code&gt; drives the Chrome you already have open, logins included.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Installing it is one line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add colibri -- npx -y @t4zxxx1/colibri-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works with any MCP client (Claude Desktop/Code, Codex, Copilot, Cursor, VS Code, Gemini CLI).&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it plays at home (please read)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;I built the test pages while developing Colibri&lt;/strong&gt;, modelled on public-administration portals. My tool plays at home. The competitors' errors listed above are real and reproducible, but on other sites the numbers can move in either direction.&lt;/li&gt;
&lt;li&gt;The agents are simulated. A real model may make more mistakes (more calls) or find shortcuts (fewer).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;browse_task&lt;/code&gt; shines on forms with vocabulary it knows. On unfamiliar pages it asks questions, and every question is one more call.&lt;/li&gt;
&lt;li&gt;CLI tools were favoured: every command of a step was chained into a single shell call, which real agents don't always do.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything is reproducible: the benchmark script, the pages and the raw results are in the repo (&lt;a href="https://github.com/t4zxxx1/colibri-mcp/blob/main/docs/benchmark.md" rel="noopener noreferrer"&gt;methodology and full tables&lt;/a&gt;). If you run it on your own sites, or catch me being unfair to a competitor, open an issue and I'll update the numbers.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Colibri is MIT-licensed and maintained in my spare time. If it saves you tokens, a ⭐ on &lt;a href="https://github.com/t4zxxx1/colibri-mcp" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; or &lt;a href="https://github.com/sponsors/t4zxxx1" rel="noopener noreferrer"&gt;sponsoring the work&lt;/a&gt; helps a lot.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>playwright</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
