feat: add AGENT_BROWSER_CDP env var for --cdp flag#489
Open
bukacdan wants to merge 2 commits intovercel-labs:mainfrom
Open
feat: add AGENT_BROWSER_CDP env var for --cdp flag#489bukacdan wants to merge 2 commits intovercel-labs:mainfrom
bukacdan wants to merge 2 commits intovercel-labs:mainfrom
Conversation
Contributor
|
@bukacdan is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
856f93b to
06a32f4
Compare
Read AGENT_BROWSER_CDP env var as a fallback for the --cdp CLI flag, matching the pattern used by other flags (--proxy, --provider, etc.). CLI --cdp still takes precedence when both are set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update --help output, README, SKILL.md, and docs site to mention the new AGENT_BROWSER_CDP env var alongside the --cdp flag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Problem
When
agent-browseris used programmatically by an AI agent (e.g., inside an agentic loop that drives abrowser), connecting to an existing browser via CDP currently requires one of two approaches:
Pass
--cdpon every command -- the agent must remember to include--cdp 9222(or a WebSocket URL)on every single
agent-browserinvocation throughout its session. In practice, agents can and do forgetflags between calls, leading to commands silently launching a new browser instead of controlling the intended
one.
Run
agent-browser connectat the start -- this persists the CDP endpoint in the session, but itrelies on the agent executing the right setup command first and maintaining the same session for every
subsequent call. If the session is lost or the connect step is skipped, the same silent-failure mode occurs.
Both approaches are fragile in agentic contexts because they depend on the agent's behavioral consistency
across many invocations -- something that is inherently unreliable.
Solution
Add
AGENT_BROWSER_CDPenvironment variable support, following the establishedAGENT_BROWSER_*conventionalready used by
--proxy(AGENT_BROWSER_PROXY),--provider(AGENT_BROWSER_PROVIDER),--auto-connect(
AGENT_BROWSER_AUTO_CONNECT), and others.When
AGENT_BROWSER_CDPis set, everyagent-browsercommand automatically uses the specified CDP endpointwithout requiring any flags. The CLI
--cdpflag still takes precedence when both are present, preservingfull backward compatibility.