Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Persistent browser automation CLI supporting headless Chromium, visible Chrome, real Chrome profiles, and cloud browsers.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/multi-session.md
1# Multiple Browser Sessions23## Why use multiple sessions45When you need more than one browser at a time:6- Cloud browser for scraping + local Chrome for authenticated tasks7- Two different Chrome profiles simultaneously8- Isolated browser for testing that won't affect the user's browsing9- Running a headed browser for debugging while headless runs in background1011## How sessions are isolated1213Each `--session NAME` gets:14- Its own daemon process15- Its own Unix socket (`~/.browser-use/{name}.sock`)16- Its own PID file and state file17- Its own browser instance (completely independent)18- Its own tab ownership state (multi-agent locks don't cross sessions)1920## The `--session` flag2122Must be passed on every command targeting that session:2324```bash25browser-use --session work open <url> # goes to 'work' daemon26browser-use --session work state # reads from 'work' daemon27browser-use state # goes to 'default' daemon (different browser)28```2930If you forget `--session`, the command goes to the `default` session. This is the most common mistake — you'll interact with the wrong browser.3132## Combining sessions with browser modes3334```bash35# Session 1: cloud browser36browser-use --session cloud cloud connect3738# Session 2: connect to user's Chrome39browser-use --session chrome connect4041# Session 3: headed Chromium for debugging42browser-use --session debug --headed open <url>43```4445Each session is fully independent. The cloud session talks to a remote browser, the chrome session talks to the user's Chrome, and the debug session manages its own Chromium — all running simultaneously.4647## Listing and managing sessions4849```bash50browser-use sessions51```5253Output:54```55SESSION PHASE PID CONFIG56cloud running 12345 cloud57chrome running 12346 cdp58debug ready 12347 headed59```6061PHASE shows the daemon lifecycle state: `initializing`, `ready`, `starting`, `running`, `shutting_down`, `stopped`, `failed`.6263```bash64browser-use --session cloud close # close one session65browser-use close --all # close every session66```6768## Common patterns6970**Cloud + local authenticated:**71```bash72browser-use --session scraper cloud connect73browser-use --session scraper open https://example.com74# ... scrape data ...7576browser-use --session auth --profile "Default" open https://github.com77browser-use --session auth state78# ... interact with authenticated site ...79```8081**Throwaway test browser:**82```bash83browser-use --session test --headed open https://localhost:300084# ... test, debug, inspect ...85browser-use --session test close # done, clean up86```8788**Environment variable:**89```bash90export BROWSER_USE_SESSION=work91browser-use open <url> # uses 'work' session without --session flag92```93