<?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: vitron</title>
    <description>The latest articles on DEV Community by vitron (@vitronai).</description>
    <link>https://dev.to/vitronai</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%2F3980390%2Fe5e06378-e699-4618-b6cd-a86a0f6968b0.jpeg</url>
      <title>DEV Community: vitron</title>
      <link>https://dev.to/vitronai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vitronai"/>
    <language>en</language>
    <item>
      <title>We threw out our Playwright wrapper and built a browser runtime from scratch. Here's the architecture.</title>
      <dc:creator>vitron</dc:creator>
      <pubDate>Fri, 12 Jun 2026 03:26:00 +0000</pubDate>
      <link>https://dev.to/vitronai/we-threw-out-our-playwright-wrapper-and-built-a-browser-runtime-from-scratch-heres-the-49j5</link>
      <guid>https://dev.to/vitronai/we-threw-out-our-playwright-wrapper-and-built-a-browser-runtime-from-scratch-heres-the-49j5</guid>
      <description>&lt;p&gt;Every time your AI agent checks whether a button exists, it sends a JSON message over a socket, crosses three process boundaries, and waits for a response. On your own machine. For a DOM node that's already in memory.&lt;br&gt;
That's Playwright. We decided to fix it.&lt;/p&gt;


&lt;h2&gt;
  
  
  The problem with existing browser automation
&lt;/h2&gt;

&lt;p&gt;Most browser automation tools were designed for a specific job: a human writes a JavaScript test suite, a CI runner executes it, the human reads the report.&lt;/p&gt;

&lt;p&gt;AI agents have a fundamentally different shape. They don't write scripts upfront. They decide, act, verify, decide again. Tight loops, dozens of iterations per session, each requiring fresh DOM state. Every millisecond of per-step latency compounds.&lt;/p&gt;

&lt;p&gt;When we ran our first benchmarks, the number that stopped us was this: 580ms average latency per step with a CDP-based bridge. On a 10-step verification flow, that's six seconds of an agent just waiting.&lt;/p&gt;

&lt;p&gt;We started digging into where the time was going.&lt;/p&gt;


&lt;h2&gt;
  
  
  What's actually happening under the hood
&lt;/h2&gt;

&lt;p&gt;Most tools talk to browsers via the Chrome DevTools Protocol (CDP). CDP is a message-passing interface: your test process sends a JSON command over a socket, the browser processes it, sends a JSON response back.&lt;/p&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.amazonaws.com%2Fuploads%2Farticles%2F49yrghtgte8whw18a3lt.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.amazonaws.com%2Fuploads%2Farticles%2F49yrghtgte8whw18a3lt.png" alt="alethia-arch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every action crosses at least three process boundaries:&lt;/p&gt;

&lt;p&gt;test process → driver → browser process → DOM&lt;/p&gt;

&lt;p&gt;For a human-written test suite running overnight in CI, this is fine. For an agent in a tight decide-act-verify loop, it's a structural tax that never goes away.&lt;/p&gt;

&lt;p&gt;The async model compounds it. Between &lt;code&gt;await page.click('#submit')&lt;/code&gt; and the next line, the DOM might have changed. The usual answer is retry logic, timeouts, and waitFor helpers — all of which add latency. None of it is anyone's fault. It's inherent to the architecture.&lt;/p&gt;


&lt;h2&gt;
  
  
  The insight: what if the driver lived in the same process as the DOM?
&lt;/h2&gt;

&lt;p&gt;We weren't targeting CI runs against chromium.example.com. We were targeting AI agents verifying localhost:3000 apps running on the same machine as the agent, usually generated by that same agent five minutes earlier.&lt;/p&gt;

&lt;p&gt;For that use case, the cross-process architecture is pure overhead.&lt;/p&gt;

&lt;p&gt;We built Alethia around a zero-IPC model: the driver and the DOM live in the same V8 isolate. Reading document.querySelector('button').textContent is a function call, not a network round-trip. No CDP socket. No marshaling. No async race between action and DOM state.&lt;/p&gt;

&lt;p&gt;Two process boundaries remain between your agent and the runtime (agent ↔ MCP bridge, bridge ↔ runtime). Then zero between the runtime and the DOM.&lt;/p&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.amazonaws.com%2Fuploads%2Farticles%2F9ymtyua11umgdjbo6av7.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.amazonaws.com%2Fuploads%2Farticles%2F9ymtyua11umgdjbo6av7.png" alt="benchmark-pw-table"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are reproducible, we publish the full benchmark harness at &lt;a href="https://github.com/vitron-ai/alethia-anvil" rel="noopener noreferrer"&gt;alethia-anvil&lt;/a&gt;. Clone it, run it yourself.&lt;/p&gt;


&lt;h2&gt;
  
  
  The safety problem nobody was solving
&lt;/h2&gt;

&lt;p&gt;While we were benchmarking, we noticed something else: no existing browser automation tool had any concept of intent-based safety guardrails.&lt;/p&gt;

&lt;p&gt;An AI agent can misinterpret an instruction. It can be manipulated by injected content on the page. And if your testing tool happily executes a DELETE /api/users/all or confirms a $500 purchase, the agent won't know it did something wrong until it's too late.&lt;/p&gt;

&lt;p&gt;We built a policy gate called EA1 directly into the runtime. Every step is classified by intent before it executes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;read (navigation, assertions) — always allowed&lt;/li&gt;
&lt;li&gt;write-low (form input, drafts) — allowed by default&lt;/li&gt;
&lt;li&gt;write-high (delete, purchase, transfer) — blocked by default&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The gate lives in the same process as the executor. Agents cannot bypass it. When a destructive action is attempted, it fails closed and logs the attempt to the audit trail.&lt;/p&gt;

&lt;p&gt;This matters especially for AI agents because you're not always watching. The safety guarantee needs to be architectural, not advisory.&lt;/p&gt;


&lt;h2&gt;
  
  
  The token cost problem
&lt;/h2&gt;

&lt;p&gt;One thing we didn't anticipate: round-trip snapshot tools are expensive on tokens, not just time.&lt;/p&gt;

&lt;p&gt;Most MCP-based automation returns a full accessibility snapshot after every single action. On a simple app that's ~800 tokens per step. On a production app with a complex accessibility tree, several thousand. Across a 10-step flow, you're burning context that the agent mostly ignores.&lt;/p&gt;

&lt;p&gt;Alethia returns one compact response per flow — a ~200-token semantic snapshot of what's on screen, not a raw DOM dump.&lt;/p&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.amazonaws.com%2Fuploads%2Farticles%2F2rtunt56imfl9w93d879.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.amazonaws.com%2Fuploads%2Farticles%2F2rtunt56imfl9w93d879.png" alt="token-table"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not flooding the context window with accessibility trees is what keeps multi-step agent sessions coherent.&lt;/p&gt;


&lt;h2&gt;
  
  
  How to try it
&lt;/h2&gt;

&lt;p&gt;Alethia ships as an MCP server. Two commands:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install -g @vitronai/alethia&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add to your MCP config (Claude Code, Cursor, Cline, etc.):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"alethia"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"alethia-mcp"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then ask your agent to test something:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Navigate to http://localhost:3000, sign in with test@example.com, assert the dashboard is visible.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;No test script. No await page.waitForSelector. No driver setup. The agent speaks plain English; Alethia compiles it to actions, runs the EA1 gate, executes against the live DOM, and returns per-step results with a SHA-256 chained audit trail.&lt;/p&gt;




&lt;h2&gt;
  
  
  See it live in 60 seconds
&lt;/h2&gt;

&lt;p&gt;Alethia ships with a built-in demo app. Paste this into Claude Code:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Use alethia_serve_demo to start the demo server. Navigate to the app. Assert TaskFlow is visible. Type dev@company.com into the email field. Click Sign In. Assert "Signed in as" is visible. Click Delete and report what EA1 decides.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The agent starts a localhost server, drives the app with plain English, and EA1 blocks the delete. You'll see each step highlighted on screen in real time — green for pass, red for blocked. That last step is the point: your agent just tried to do something destructive, and the runtime stopped it without you lifting a finger.&lt;/p&gt;




&lt;h2&gt;
  
  
  Who this is for
&lt;/h2&gt;

&lt;p&gt;Browser automation was designed for a world where humans write test scripts. AI agents that generate and verify code in real time are a different paradigm entirely: tighter loops, no upfront scripts, and consequences if the agent acts without guardrails.&lt;/p&gt;

&lt;p&gt;AI agents need a tool built for that loop, not one adapted from something that wasn't.&lt;/p&gt;

&lt;p&gt;That's what we built. &lt;a href="//www.vitron.ai"&gt;vitron.ai&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;The runtime is patent pending (U.S. 19/571,437). The MCP bridge is MIT-licensed and &lt;a href="https://github.com/vitron-ai/alethia-mcp" rel="noopener noreferrer"&gt;auditable on GitHub&lt;/a&gt;. Questions or licensing: &lt;a href="mailto:team@vitron.ai"&gt;team@vitron.ai&lt;/a&gt;&lt;/p&gt;

</description>
      <category>testing</category>
      <category>ai</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
