<- all tokdocs

Testing Electron Apps With Vercel agent-browser Over CDP

By , founder of Mavric and Apso

View on TikTok ->

Vercel's agent-browser is a command-line tool that lets AI coding agents control a browser, and it can attach to a running Electron app over the Chrome DevTools Protocol (CDP). A TikTok from Isaac Dyor (@isaacdyor) recommends giving each agent its own worktree, its own app instance and its own debugging port instead of using computer use. The core command is real and documented, but the port belongs on the Electron process rather than the dev server, and the video's claim that computer use fails on Linux is wrong.

What is agent-browser?

vercel-labs/agent-browser is a public Vercel Labs repository, Apache-2.0 licensed, that describes itself as "Browser automation CLI for AI agents. Fast native Rust CLI." It installs with npm install -g agent-browser, Homebrew or Cargo.

Its CDP mode documentation lists agent-browser connect 9222 for a persistent binding and agent-browser --cdp 9222 snapshot for a single command. --cdp also accepts a full WebSocket URL for remote browser services. The same page says CDP mode can control "Electron apps, Chrome/Chromium with remote debugging, WebView2 applications, Remote browser services (via WebSocket URL), Any browser exposing a CDP endpoint." Electron is the first item on Vercel's own list.

How to test Electron apps with agent-browser

The video describes four steps:

  1. Put each coding agent in its own git worktree.
  2. Have each agent start its own app with an explicit remote debugging port, such as 9222, 9223 and 9224.
  3. Have each agent attach with agent-browser --cdp 9222.
  4. Skip computer use, because the connection runs over CDP into the Chromium that Electron embeds.

This works because Electron is Node plus Chromium, and Chromium exposes a DevTools endpoint when you start it with --remote-debugging-port.

Where do you set --remote-debugging-port in Electron?

On the Electron binary, not the dev server. The video says to "start its own dev server with an explicit remote debugging port," but a Vite or webpack dev server only serves renderer assets over HTTP and has no DevTools endpoint. Electron's command-line switches documentation lists --remote-debugging-port as "Enables remote debugging over HTTP on the specified port," and says switches can be added with app.commandLine.appendSwitch() in the main script before the ready event.

Electron's main-process debugging guide covers --inspect and --inspect-brk on port 9229. That is a separate channel for debugging Node in the main process.

Does Chrome 136 block remote debugging for Electron?

No. Google's March 17, 2025 post says that from Chrome 136, --remote-debugging-port and --remote-debugging-pipe "will no longer be respected if attempting to debug the default Chrome data directory" and must be paired with --user-data-dir. That targets your everyday Chrome profile. An Electron app uses its own userData directory, so the rule does not apply to it.

agent-browser vs computer use

CDP gives the agent structure instead of pixels. The README describes snapshot as returning an accessibility tree with element references rather than screenshots, so the model gets stable handles like <button id="export" disabled> instead of coordinates. It also documents console for browser console output, errors for uncaught exceptions and network requests with filters for type, method and status code.

That matters most when something fails. In the video's example, a computer-use agent sees a red "Test failed" badge. A CDP-attached agent reads TypeError: fps is undefined at export.ts:42 and a POST /api/export 500, which tells it where to look.

Separate ports also keep agents apart. Computer use on one shared desktop lets agents collide, which the video shows as "Agent 2 clicked Agent 1's button." When several sessions share one browser, the CDP docs say --pin-tab is needed, because "attaching with no binding opens a fresh tab instead of adopting an existing one." Separate Electron processes on separate ports avoid that.

Does computer use work on Linux?

Yes. The video's spoken claim is narrow: a macOS computer-use setup does not carry over to the cloud. A slide in the video goes further and puts red crosses on Windows, Linux and Cloud VPS. Anthropic's computer use reference implementation describes itself as "a Linux desktop in Docker with X11 + VNC," and points to a separate quickstart that "runs natively on macOS (no container)." Linux in a container is the reference platform.

The video's banner "No screen to click in the cloud" is closer to the real advantage. CDP does not need a display at all, while computer use needs a real or virtual screen.

Known issues with agent-browser CDP mode

agent-browser issue #1272, opened April 19, 2026 against version 0.17.1 and still open, reports that when an externally launched browser restarts and gets a new webSocketDebuggerUrl, "the CDP launch command is silently skipped" because the daemon is already running. The agent stays bound to a stale URL. Agents restart dev servers often, so expect to reconnect after a restart.

What is Compound?

Dyor says the setup has helped him build "my own desktop app compound." corporationdev/compound is a public MPL-2.0 Electron app, a video editor built for AI agents with SolidJS modules and projects written as JSX. Its README says "Edit videos with Claude Code, Codex, Cursor, Copilot, or Gemini CLI." Local setup needs Node 22 and Bun 1.3.11.

Bottom line

agent-browser --cdp 9222 attaches to a running Electron app, and Vercel documents Electron as a target. Set the debugging port on the Electron process, either as a switch or with app.commandLine.appendSwitch(), and plan for reconnects after restarts. The DOM, console and network access is the strongest reason to prefer CDP over computer use, which does run on Linux.

Sources

Published September 22, 2026. Based on a TikTok by @isaacdyor. Full video notes (markdown)