$npx -y skills add agentscope-ai/QwenPaw --skill browser_cdp-enUse this skill when the user explicitly wants to connect to a running Chrome browser, scan local CDP ports, specify a cdp_port, or share a single browser across multiple agents/tools. By default, browser_use already launches the browser using managed CDP; if the user does not w
| 1 | # Browser CDP Reference |
| 2 | |
| 3 | By default, **browser_use** launches and manages the local Chrome/Chromium via **managed CDP**, but this does not mean the CDP port should be exposed to the user or other tools every time. |
| 4 | |
| 5 | This skill focuses on more "explicit" CDP usage: |
| 6 | |
| 7 | 1. **Scanning local CDP ports** |
| 8 | 2. **Connecting to an existing Chrome (`connect_cdp`)** |
| 9 | 3. **Explicitly specifying a `cdp_port` when launching the browser** |
| 10 | 4. **Sharing a single browser instance across multiple agents/tools** |
| 11 | |
| 12 | In other words: |
| 13 | |
| 14 | - The default `start` uses managed CDP under the hood, but users typically do not need to understand or be aware of CDP details |
| 15 | - Only enter the scope of this skill when the user explicitly mentions "connect to an existing browser / scan ports / specify a port / share a browser" |
| 16 | |
| 17 | > **Privacy Recommendation** |
| 18 | > |
| 19 | > If the user does not want to expose browser history, cookies, page content, or session data, recommend using `private_mode=true`, which switches to Playwright-managed mode. |
| 20 | |
| 21 | > **Warning: One browser instance per workspace** |
| 22 | > |
| 23 | > Only one browser can be running or connected per workspace at a time. If a browser instance already exists, you must execute `stop` first before switching to a new browser or a new CDP connection. |
| 24 | |
| 25 | --- |
| 26 | |
| 27 | ## When to Use |
| 28 | |
| 29 | Use this skill only when the user explicitly expresses one of the following intentions: |
| 30 | |
| 31 | - "Connect to my already-open Chrome" |
| 32 | - "Scan for available CDP ports on this machine" |
| 33 | - "Launch the browser with a fixed debug port" |
| 34 | - "Let other agents/tools connect to this browser too" |
| 35 | - "Attach to the browser via the remote debugging port" |
| 36 | |
| 37 | In the following cases, you should typically **not** use this skill: |
| 38 | |
| 39 | - The user just says "open the browser" |
| 40 | - The user just says "open a visible window" |
| 41 | - The user does not mention sharing, ports, CDP, or remote debugging |
| 42 | |
| 43 | In these cases, use the standard `start`, adding `headed=true` if needed — refer to **browser_visible**. |
| 44 | |
| 45 | --- |
| 46 | |
| 47 | ## Scenario 1: Scanning Local CDP Ports |
| 48 | |
| 49 | Default scan range is **9000–10000**: |
| 50 | |
| 51 | ```json |
| 52 | {"action": "list_cdp_targets"} |
| 53 | ``` |
| 54 | |
| 55 | Specify a single port: |
| 56 | |
| 57 | ```json |
| 58 | {"action": "list_cdp_targets", "port": 9222} |
| 59 | ``` |
| 60 | |
| 61 | Custom scan range: |
| 62 | |
| 63 | ```json |
| 64 | {"action": "list_cdp_targets", "port_min": 8000, "port_max": 12000} |
| 65 | ``` |
| 66 | |
| 67 | Use cases: |
| 68 | |
| 69 | - The user has manually launched Chrome with a remote debugging port |
| 70 | - You do not know the exact port and need to scan first |
| 71 | - You need to verify available attach targets on the local machine before connecting |
| 72 | |
| 73 | --- |
| 74 | |
| 75 | ## Scenario 2: Connecting to an Existing Chrome |
| 76 | |
| 77 | Connect to an existing CDP endpoint: |
| 78 | |
| 79 | ```json |
| 80 | {"action": "connect_cdp", "cdp_url": "http://localhost:9222"} |
| 81 | ``` |
| 82 | |
| 83 | Characteristics: |
| 84 | |
| 85 | - After a successful connection, you can continue using standard operations such as `open`, `snapshot`, `click`, `type`, etc. |
| 86 | - This **attaches to an external browser**, not a new process launched by QwenPaw |
| 87 | - `stop` only disconnects — it **will not close the external browser** |
| 88 | - External CDP connections are also subject to idle auto-stop management, but the auto-stop semantics for external CDP is "auto-disconnect, not close the external browser" |
| 89 | |
| 90 | Use cases: |
| 91 | |
| 92 | - The user has their own Chrome open and wants the agent to take over directly |
| 93 | - You need to attach to the user's existing login state or open tabs |
| 94 | |
| 95 | --- |
| 96 | |
| 97 | ## Scenario 3: Launching with an Explicit cdp_port |
| 98 | |
| 99 | If the user explicitly requests a fixed port, or needs to provide the endpoint to other tools, specify `cdp_port` in `start`: |
| 100 | |
| 101 | ```json |
| 102 | {"action": "start", "cdp_port": 9222} |
| 103 | ``` |
| 104 | |
| 105 | To also open a visible window: |
| 106 | |
| 107 | ```json |
| 108 | {"action": "start", "headed": true, "cdp_port": 9222} |
| 109 | ``` |
| 110 | |
| 111 | Current behavior: |
| 112 | |
| 113 | - If the explicitly specified `cdp_port` is already in use, an error is raised immediately — it will not forcefully reuse the port |
| 114 | - If `cdp_port` is not specified, an available port is automatically selected, which usually avoids multi-workspace conflicts |
| 115 | - Auto-selecting an available port still has a tiny race window: between "finding an available port" and "Chrome actually binding to the port", another process could theoretically claim it; on failure, cleanup occurs and an error is reported, but there is no automatic retry |
| 116 | |
| 117 | Therefore: |
| 118 | |
| 119 | - **Do not pass `cdp_port` proactively when the user has not explicitly requested a port** |
| 120 | - **Only pass `cdp_port` explicitly when the user requests a fixed port or external sharing** |
| 121 | |
| 122 | --- |
| 123 | |
| 124 | ## Multi-Workspace and Port Conflicts |
| 125 | |
| 126 | The current port strategy for multiple workspaces: |
| 127 | |
| 128 | - **Explicitly specified port**: |