Browser Use is one of the most popular open-source frameworks for AI agents that work in a real browser. Version 1.0 changed how it works: the model now writes Python against the Chrome DevTools Protocol (CDP) in a persistent session. It also changed how proxies work, and anyone running agents on their own infrastructure needs to know how. This guide shows a pattern we tested for putting Browser Use agents behind residential proxies, then covers sticky sessions, country targeting and running many agents at once. For the wider context, see our AI agents overview.
How proxies work in Browser Use 1.0
Browser Use 1.0 offers several kinds of browser:
| Browser | What it is | Proxy |
|---|---|---|
Browser() | A Browser Use Cloud browser, the default | The cloud’s own option, cloud_proxy_country_code |
Browser('chromium') | A fresh local Chrome or Chromium | Not supported yet, per the docs |
Browser('chrome') | The Chrome you have open | Whatever that Chrome uses |
Browser(cdp_url=...) | Any browser with a CDP endpoint | Whatever that browser uses |
The 0.x proxy option is gone. The migration guide is explicit: “Cloud: cloud_proxy_country_code. Local: not yet.” So to use your own residential proxies with your own browsers, start the browser yourself, with the proxy, and connect the agent through cdp_url.
The catch: proxy authentication
Residential proxies use a username and password, and Chrome’s --proxy-server flag has no place for them. Chrome asks for the credentials in a dialog, which an agent cannot answer.
Playwright solves this. When it launches a browser with a proxy username and password, it answers the proxy’s login challenge itself. We tested whether that also covers pages opened by a separate program over CDP, which is how Browser Use connects:
| Launch method | Page opened by a separate CDP client |
|---|---|
launch_persistent_context with proxy credentials | Loaded through the proxy: a German residential IP, as requested |
launch plus new_context | Timed out: the login challenge was not answered |
The persistent context is the one to use. The Playwright process must keep running while the agent works, because it is the one answering the proxy.
The launcher
This function starts one browser per agent, behind a sticky residential session in the country you choose, with locale and time zone to match:
import os, tempfile, uuid
from playwright.async_api import async_playwright
USER = os.environ["SHIFTER_USER"]
PASSWORD = os.environ["SHIFTER_PASS"]
async def launch_browser(pw, port, country, locale, timezone):
session = uuid.uuid4().hex[:12]
return await pw.chromium.launch_persistent_context(
tempfile.mkdtemp(prefix=f"agent-{port}-"),
channel="chrome",
headless=True,
locale=locale,
timezone_id=timezone,
proxy={
"server": "http://p.shifter.io:443",
"username": f"{USER}-country-{country}-sid-{session}-ttl-900",
"password": PASSWORD,
},
args=[f"--remote-debugging-port={port}"],
)
Each browser gets its own temporary profile, its own debugging port and its own proxy session id. The credentials come from environment variables, never from code or the command line.
Running agents in parallel
Browser Use requires one browser per agent: “Two agents running on one Browser at once raise RuntimeError.” With the launcher, that is natural:
import asyncio
from browser_use import Agent, Browser, ChatAnthropic
JOBS = [
("de", "de-DE", "Europe/Berlin", "In the browser, find the price of the 1 TB model on shop.example and report it."),
("fr", "fr-FR", "Europe/Paris", "In the browser, find the price of the 1 TB model on shop.example and report it."),
("jp", "ja-JP", "Asia/Tokyo", "In the browser, find the price of the 1 TB model on shop.example and report it."),
]
async def main():
async with async_playwright() as pw:
contexts, agents = [], []
for i, (country, locale, tz, task) in enumerate(JOBS):
port = 9300 + i
contexts.append(await launch_browser(pw, port, country, locale, tz))
agents.append(Agent(
task,
llm=ChatAnthropic("claude-sonnet-5-5"),
browser=Browser(cdp_url=f"http://127.0.0.1:{port}"),
))
try:
results = await asyncio.gather(
*(a.run(max_steps=30, timeout=600) for a in agents),
return_exceptions=True,
)
for (country, *_), r in zip(JOBS, results):
print(country, r if isinstance(r, Exception) else r.final_result())
finally:
for ctx in contexts:
await ctx.close()
asyncio.run(main())
Pin the library version you test with. Browser Use’s own README asks users to pin exactly, because “releases move fast and can break APIs”.
Sessions: one identity per agent
The proxy username decides how the agent appears to sites:
| Username ending | Use it for |
|---|---|
-country-de | One-off page loads where a new IP each time is fine |
-country-de-sid-abc123-ttl-900 | An agent task: the same German IP for up to 15 minutes |
-country-us-city-chicago-sid-abc123-ttl-900 | City-specific results, such as local prices or listings |
Rules that keep agents stable:
- One session per agent, never shared. Two agents on one IP look like one very busy visitor.
- Make the time-to-live longer than the task. An IP that changes mid-checkout looks like account takeover.
- New session on failure. If an agent hits a block, retry with a new session id and a fresh profile, not the same identity.
- Match locale and time zone to the exit. A Tokyo IP with a German browser is easy to spot.
Geo-targeting the work, not just the browser
Browser Use’s documentation makes an important point: “The proxy applies to the browser only. Python networking in the agent’s cells (http_get, urllib, requests) runs on your machine.” An agent that decides to fetch a page with Python, instead of in the browser, will see your location, not the proxy’s. Its advice is to say “in the browser” in the task when location matters, which the example above does.
Cloud browsers or your own
Browser Use Cloud browsers come with their own proxy option, set per browser with a country code. Running your own browsers behind your own proxy provider makes sense when you need:
- City or network targeting, not just a country, for local prices, listings or search results.
- Control over sessions, such as a fixed exit for a whole task or a long login flow.
- One proxy account for agents, scrapers and monitoring, with one bill and one set of usage reports.
- Your own infrastructure, for data that should not leave your environment.
The trade-off is operations: you run the browsers, the ports and the clean-up yourself.
Scaling up
- Concurrency. Browser Use raises the process’s open-file limit so that “100 agents in one process fit on macOS”. Memory is usually the real limit: every agent runs a full Chrome. Use a semaphore to cap how many run at once.
- Bandwidth. Residential proxies are billed per GB, and agents load whole pages. Cap
max_stepsandtimeout, and give agents narrow tasks with a direct starting URL instead of a search. - Ports and profiles. Allocate ports from a range and delete temporary profiles after each run.
- Security. The debugging port has no authentication. Browser Use’s docs warn that on a shared machine other local users can attach to such a browser, so run agents in containers or on dedicated hosts.
- Identity. Sites are starting to ask agents who they act for. Our explainer on Cloudflare’s agent identity proposal covers where that is heading.
For the earlier framework generation, our guide to proxies for LangChain, CrewAI and AutoGen agents uses the same session approach. For agents inside a code editor, see Playwright MCP with residential proxies.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
The agent cannot connect to cdp_url | The browser has not finished starting, or the port is taken | Launch first, then create the agent; allocate unique ports |
| Pages hang, then time out | The launcher process exited, so nobody answers the proxy login | Keep the Playwright process running for the whole run |
| The agent reports your real location | It fetched with Python instead of the browser | Say “in the browser” in the task |
RuntimeError when running in parallel | Two agents share one Browser | One browser, one port, one session per agent |
| Blocks partway through a task | The session expired or the site flagged the identity | Longer time-to-live, or retry with a new session and profile |
The bottom line
Browser Use 1.0 does not take a proxy for local browsers yet, but it connects to any browser over CDP. Launch each browser with Playwright’s persistent context and an authenticated residential proxy, give every agent its own sticky session and country, keep location-sensitive work in the browser, and scale with one browser per agent.
Sources and references
- Browser Use, README and installation: github.com
- Browser Use, migrating from 0.x to 1.0: github.com
- Browser Use documentation, browsers, cloud proxy and parallel agents: docs.browser-use.com
- Browser Use documentation, agent run options: docs.browser-use.com
- Playwright, BrowserType.launchPersistentContext: playwright.dev