Skip to content

feat: add multi-port support for parallel server instances#15

Open
cs50victor wants to merge 1 commit intoSawyerHood:mainfrom
cs50victor:feature/multi-port-support
Open

feat: add multi-port support for parallel server instances#15
cs50victor wants to merge 1 commit intoSawyerHood:mainfrom
cs50victor:feature/multi-port-support

Conversation

@cs50victor
Copy link

Add --port and --cdp-port CLI flags to server.sh to enable running multiple dev-browser instances in parallel. This allows different subagents to each control their own browser instance.

Usage:
./server.sh --port 9222 # instance 1
./server.sh --port 9224 # instance 2 (parallel)

CDP port defaults to port + 1 unless explicitly set via --cdp-port.

Add --port and --cdp-port CLI flags to server.sh to enable running
multiple dev-browser instances in parallel. This allows different
subagents to each control their own browser instance.

Usage:
  ./server.sh --port 9222  # instance 1
  ./server.sh --port 9224  # instance 2 (parallel)

CDP port defaults to port + 1 unless explicitly set via --cdp-port.
@mattheworiordan
Copy link

I have hit this same issue, I regularly have sub-agents doing work to speed things up, and discovered that dev-browser is in fact a single point of congestion now, nullifying the advantages of dev browser.

Your approach @cs50victor could work, but then that requires agents to manage the assignment of ports based on availability and awareness of other sub-agents to doing work.

I wonder if there's a better way, such as:

  • Starting the server auto-discovers a new port, and returns that to the agent. So the agent no longer has a default port, but always just waits for the server to confirm the new port before it starts. I suspect this is cleanest.
  • Introduce support in dev-browser for the named page registry which already exists const registry = new Map<string, PageEntry>() ->
    // Registry: name -> PageEntry
    const registry = new Map<string, PageEntry>();
    . In theory each agent could just define a unique ID and use that.

@SawyerHood interested in your thoughts on this.

mattheworiordan added a commit to mattheworiordan/dev-browser that referenced this pull request Dec 30, 2025
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.
@cs50victor
Copy link
Author

auto port discovery would make the skill a lot easier for the model to use. I second this redesign.

@mattheworiordan
Copy link

auto port discovery would make the skill a lot easier for the model to use. I second this redesign.

See #24.
Hoping that is merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants