Run stealth Browser-Use agents over persistent Chrome profiles without bot blocks
Connect Browser-Use and Playwright to your existing authenticated Chrome profile over CDP port 9222 so AI agents complete multi-step web forms and extractions without triggering CAPTCHAs.
Why default setups fall short
Fresh headless Chromium instances get flagged immediately by anti-bot walls because they lack real cookies, GPU fingerprints, and session history. The most reliable workflow shared by automation engineers on X launches a dedicated local Chrome user-data directory with remote debugging enabled on localhost:9222, then attaches Browser-Use over Chrome DevTools Protocol (CDP) with a strict Pydantic output schema.
Prerequisites before starting
- Python 3.11+ with browser-use and playwright installed
- Google Chrome or Chromium installed locally
- An OpenAI, Anthropic, or Gemini API key for the agent controller
Step-by-step implementation
1. Launch a dedicated persistent Chrome profile on localhost:9222
Never run automated agents inside your personal password-manager profile. Create an isolated ~/.chrome-agent-profile directory, log in once manually to the target SaaS dashboards, and expose CDP strictly on 127.0.0.1:9222.
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \ --remote-debugging-port=9222 \ --user-data-dir="$HOME/.chrome-agent-profile" \ --no-first-run
2. Attach Browser-Use to the live CDP session instead of spawning Chromium
Configure BrowserConfig(cdp_url='http://127.0.0.1:9222') so Browser-Use reuses the warm browser tabs, cookies, and TLS fingerprint without resetting session storage.
browser = Browser(config=BrowserConfig(
cdp_url="http://127.0.0.1:9222",
disable_security=False
))
3. Enforce a Pydantic Controller output schema and step cap
Always pass a Pydantic model to Controller(output_model=...) and set max_steps=18 so the agent stops immediately once structured data is captured and never loops indefinitely on unexpected modals.
result = await agent.run(max_steps=18) parsed = ExtractionResult.model_validate_json(result.final_result())
4. Restrict navigation to an explicit domain allowlist
Prevent prompt injection from third-party web pages by configuring allowed_domains in BrowserContextConfig so the browser agent cannot navigate to external URLs.