How to use proxies with browser-use AI agents
In browser-use, create Browser(proxy=ProxySettings(server="http://HOST:PORT", username="USERNAME", password="PASSWORD")) and pass that browser to your Agent. browser-use launches Chromium with the proxy and answers the proxy's login for you.
What you need
- An active CleanProxies plan: static ISP proxies for fixed US IPs, or rotating residential / mobile proxies for pools. The trial works too.
- Your credential line from the dashboard's proxy manager: host (or IP), port, username and password.
- Python 3.11 or later and
pip install browser-use(oruv add browser-use), with Chromium installed as its README describes. - An API key for the LLM you use with browser-use, set as an environment variable.
New to proxies? For the overview, read Proxies with Python Requests, Playwright and Puppeteer and Rotating vs sticky sessions. This guide goes deeper on browser-use only.
Your CleanProxies credentials
| Product | Line in your dashboard | Notes |
|---|---|---|
| Static ISP proxies | IP:PORT:USER:PASS | One line per dedicated IP. With IP whitelisting turned on, the line is just IP:PORT and no password is sent. |
| Rotating residential and mobile | HOST:PORT:USER:PASS | Generated in the proxy manager. The username carries the location and session you pick, so generate a new list to change them. |
Most tools want the same details as a URL: http://USERNAME:PASSWORD@HOST:PORT for HTTP(S) or socks5://USERNAME:PASSWORD@HOST:PORT for SOCKS5. The examples on this page use those placeholders; copy the host, port, username and password from your CleanProxies dashboard. To convert a whole list at once, paste it into the proxy list formatter.
How to set up CleanProxies in browser-use
- 1
Import ProxySettings
It isn't exported from the top-level package: usefrom browser_use.browser import ProxySettings. - 2
Create the browser with a proxy
Setservertohttp://HOST:PORT, plususernameandpassword.bypasstakes a comma-separated string such as"localhost,127.0.0.1". - 3
Hand the browser to the agent
Passbrowser=browsertoAgent(...)along with the task and LLM. - 4
Check the exit IP
Give the agent a first task of openinghttps://api.ipify.organd reporting the IP.
browser-use proxy example
import asyncio
from browser_use import Agent, Browser, ChatOpenAI
from browser_use.browser import ProxySettings
browser = Browser(
proxy=ProxySettings(
server="http://HOST:PORT",
username="USERNAME",
password="PASSWORD",
bypass="localhost,127.0.0.1",
)
)
async def main():
agent = Agent(
task="Open https://api.ipify.org and report the IP address shown",
llm=ChatOpenAI(model="gpt-4.1-mini"),
browser=browser,
)
history = await agent.run()
print(history.final_result())
asyncio.run(main())Swap in any LLM class browser-use supports; the proxy setup doesn't change. Credentials go in the username and password fields, not in the server URL.
Run several agents on different IPs
Give each agent its own Browser with its own proxy. With CleanProxies ISP proxies, that means one dedicated US IP per agent, so parallel agents never share an address.
def browser_for(line: str) -> Browser:
host, port, user, password = line.strip().split(":", 3)
return Browser(proxy=ProxySettings(server=f"http://{host}:{port}", username=user, password=password))
async def run_all(tasks, lines):
agents = [
Agent(task=task, llm=ChatOpenAI(model="gpt-4.1-mini"), browser=browser_for(line))
for task, line in zip(tasks, lines)
]
return await asyncio.gather(*(agent.run() for agent in agents))SOCKS5 and other limits
- browser-use passes the server to Chromium, and Chromium supports no SOCKS5 authentication. Use the HTTP form of your CleanProxies line, or SOCKS5 without credentials on an ISP proxy authorized by IP whitelisting.
- The LLM API calls don't go through this proxy; only the browser does. That keeps your residential GB for the pages the agent visits.
- Agents retry and wander. Set a step limit and give clear tasks so a confused agent doesn't burn bandwidth on a rotating plan.
Static ISP vs rotating residential in browser-use
Static ISP proxies
The default choice for agents: one dedicated US ISP IP per agent that never changes mid-task, with unlimited bandwidth for page-heavy tasks and a 0 fraud score so fewer CAPTCHAs interrupt the agent.
Rotating residential proxies
Generate sticky lines, not rotating ones. A rotating IP can change between the agent's clicks, which logs it out or triggers checks. Sticky sessions keep one residential IP for the session length you choose, in the country the task needs.
Verify your exit IP
The example's task makes the agent report its own exit IP. Compare it with your dashboard line before giving the agent real work.
Open What is my IP? through the proxy to see the address and headers a website receives, or paste up to ten lines into the free proxy checker to test connectivity, latency and exit IP before you start.
Troubleshooting browser-use proxy errors
| Problem | Likely cause | Fix |
|---|---|---|
| ImportError: cannot import name 'ProxySettings' from 'browser_use' | ProxySettings lives in a submodule. | Use from browser_use.browser import ProxySettings. |
| Agent reports your own IP | The browser with the proxy wasn't passed to the Agent. | Pass browser=browser to Agent(...). |
| ERR_TUNNEL_CONNECTION_FAILED or 407 | Credentials in the server URL or mistyped. | Use the separate username and password fields. |
| Agent gets logged out mid-task | A rotating residential line changed IP between steps. | Generate a sticky list, or use a static ISP proxy. |
| Many CAPTCHAs | Flagged IPs or too many agents on one IP. | One clean dedicated ISP IP per agent; slow the task down. |
Still stuck? Our 24/7 support team answers fast: contact us with the error and the line you used (leave the password out).
browser-use proxy FAQs
Yes. ProxySettings takes server, username, password and bypass. browser-use launches Chromium with the server and answers the proxy's authentication challenge with the username and password.