"code": "tab_gone", data.targetId, and optional data.lastUrl
- `tab list`, `tab new`, and `tab ` still work in that state, so an agent can recover by binding a new tab
- Tabs opened by other sessions or the user never steal the pinned session's active tab
The flag is sticky per session: pass it once and later commands and daemon restarts keep the strict semantics. Pass `--no-pin-tab` to explicitly turn the pin off again. See [Sessions](/sessions) for the multi-session workflow and [Commands](/commands) for tab refs by CDP target id.
The structured lastUrl is emitted only for sanitized HTTP(S) URLs and about:blank. Credentials, query strings, and fragments are removed from HTTP(S) URLs, while opaque URLs such as data: are omitted. Batch JSON exposes the recovery object under result.
When re-running a shared-tab script such as the repro from #1530, add `--pin-tab` to the first command for every session. Without it, `open` intentionally preserves the legacy behavior and navigates the shared active tab, so the original script still collides. The same rule applies when sessions attach with `--auto-connect` instead of `--cdp`.
## Color scheme
Use `--color-scheme` to set a persistent preference when connecting via CDP:
```bash
agent-browser --cdp 9222 --color-scheme dark open https://example.com
agent-browser --cdp 9222 snapshot # stays in dark mode
```
Or set it globally via config or environment variable:
```bash
AGENT_BROWSER_COLOR_SCHEME=dark agent-browser --cdp 9222 open https://example.com
```
## Use cases
This enables control of:
- Electron apps
- Chrome/Chromium with remote debugging
- WebView2 applications
- Remote browser services (via WebSocket URL)
- Any browser exposing a CDP endpoint
## Global options
| Option | Description |
|---|---|
--session <name> | Use isolated session |
--profile <path> | Persistent browser profile directory |
-p <provider> | Browser provider (browserbase, browseruse, kernel, browserless, agentcore, or a configured browser.provider plugin) |
--headers <json> | HTTP headers scoped to origin |
--executable-path | Custom browser executable |
--args <args> | Browser launch args (comma-separated) |
--user-agent <ua> | Custom User-Agent string |
--proxy <url> | Proxy server URL |
--proxy-bypass <hosts> | Hosts to bypass proxy |
--json | JSON output for scripts |
--name, -n | Locator name filter |
--exact | Exact, case-sensitive match (accessible name for role) |
--headed | Show browser window |
{"--cdp | CDP connection (port or WebSocket URL) |
--auto-connect | Auto-discover and connect to running Chrome |
--pin-tab | Pin the session to its bound tab (strict tab binding) |
--no-pin-tab | Disable a sticky pin previously enabled with --pin-tab |
--color-scheme <scheme> | Persistent color scheme (dark, light, no-preference) |
--debug | Debug output |