Multi-agent concurrency and external browser mode#24
Open
mattheworiordan wants to merge 4 commits intoSawyerHood:mainfrom
Open
Multi-agent concurrency and external browser mode#24mattheworiordan wants to merge 4 commits intoSawyerHood:mainfrom
mattheworiordan wants to merge 4 commits intoSawyerHood:mainfrom
Conversation
Add serveWithExternalBrowser() that connects to an existing browser via CDP instead of launching Playwright's Chromium. Key features: - Connect to any browser with CDP enabled (Chrome for Testing, Chrome Beta, etc.) - Auto-launch browser if not running (with BROWSER_PATH env var) - Browser stays open after server stops (user manages lifecycle) - No extension required - direct CDP connection New files: - src/external-browser.ts - Core implementation - scripts/start-external-browser.ts - Startup script Use case: Local development with visible browser automation where you want to inspect results after automation completes.
When multiple AI agents run browser automation tasks in parallel, they need separate HTTP API ports while potentially sharing the same browser instance. This adds automatic port allocation to avoid conflicts. Key changes: - Add port-manager.ts for dynamic port allocation (range 9222-9300) - Server tracking via ~/.dev-browser/active-servers.json - PORT=XXXX output for agent discovery - Config file support at ~/.dev-browser/config.json - Update both standalone and external browser modes Architecture: Agent 1 → server (port 9222) ┐ Agent 2 → server (port 9224) ├→ Shared Browser (CDP 9223) Agent 3 → server (port 9226) ┘ See docs/CONCURRENCY.md for design decisions and usage examples. Addresses concerns raised in PR SawyerHood#15 about single-point congestion.
When a dev-browser server crashes, its Chrome browser may still be running on the CDP port. This adds smart cleanup to detect and terminate orphaned browsers before launching new ones. Key changes: - Enhanced ServerInfo structure to track CDP port and mode - Added detectOrphanedBrowsers() to find browsers with no registered server - Added cleanupOrphanedBrowsers() to safely terminate orphans - Standalone mode now cleans orphans on startup (before launching browser) - External mode tracks CDP port but doesn't clean (browser is intentionally external) This restores crash recovery functionality that was previously in start-server.ts, but in a smarter way that respects multi-agent scenarios.
4 tasks
- Add ~/.dev-browser/config.json for browser configuration - Auto-detect Chrome for Testing on macOS/Linux/Windows - Add --standalone flag to force Playwright mode - Skip npm install when dependencies unchanged (hash check) - Rename port-manager.ts to config.ts with browser config - Let browser use default profile unless userDataDir explicitly set - Simplify SKILL.md documentation with single startup flow
mjdaly
added a commit
to mjdaly/dev-browser
that referenced
this pull request
Jan 16, 2026
Adds support for Chrome for Testing via CDP and multi-agent concurrency. - External browser mode keeps browser open after automation - Auto-detects Chrome for Testing installation - New config file at ~/.dev-browser/config.json - Better support for multi-agent workflows Source: SawyerHood#24 Co-authored-by: Matthew O'Riordan <matthew@ably.com>
mjdaly
added a commit
to mjdaly/dev-browser
that referenced
this pull request
Jan 16, 2026
Adds support for Chrome for Testing via CDP and multi-agent concurrency. - External browser mode keeps browser open after automation - Auto-detects Chrome for Testing installation - New config file at ~/.dev-browser/config.json - Better support for multi-agent workflows Source: SawyerHood#24 Co-authored-by: Matthew O'Riordan <matthew@ably.com>
4 tasks
|
Multi-agent concurrency would be very helpful to me. It seems unrelated to external browser mode. Please break your changes into separate PRs if possible. |
Author
|
I would but this repo is a ghost town. No PRs are being merged so seems pointless. |
|
That's a bummer. This skill has been amazing for me to get my agents to verify their own work. I ended up switching to https://github.com/vercel-labs/agent-browser since it supports concurrent named sessions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
External Browser Mode
Connect to external browsers (Chrome for Testing, Chrome Beta, etc.) via CDP:
BROWSER_PATHor connect to existing browserMulti-Agent Concurrency
~/.dev-browser/config.jsonCrash Recovery
Test plan
This Depends on external browser mode #20. However, this PR is asking for merge to main, and thus includes commits from that branch. This is unavoidable because of Github :(