Skip to content
Python AI browser agent

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

browser-use lets an LLM drive a real Chromium browser. Agents click through many pages per task, so they need an IP that is clean and stays put for the whole task: a CleanProxies static ISP IP or a sticky residential session.
  • 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 (or uv 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

Every CleanProxies product works over HTTP(S) and SOCKS5. This is what the dashboard gives you.
ProductLine in your dashboardNotes
Static ISP proxiesIP:PORT:USER:PASSOne line per dedicated IP. With IP whitelisting turned on, the line is just IP:PORT and no password is sent.
Rotating residential and mobileHOST:PORT:USER:PASSGenerated 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. 1

    Import ProxySettings

    It isn't exported from the top-level package: use from browser_use.browser import ProxySettings.
  2. 2

    Create the browser with a proxy

    Set server to http://HOST:PORT, plus username and password. bypass takes a comma-separated string such as "localhost,127.0.0.1".
  3. 3

    Hand the browser to the agent

    Pass browser=browser to Agent(...) along with the task and LLM.
  4. 4

    Check the exit IP

    Give the agent a first task of opening https://api.ipify.org and reporting the IP.

browser-use proxy example

agent.pyPython
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.

One browser per ISP linePython
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

Both products use the same setup. What changes is how long an IP stays with you.

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.

Static ISP ProxiesAs low as $0.75/IP

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.

Rotating Residential ProxiesAs low as $0.63/GB

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

ProblemLikely causeFix
ImportError: cannot import name 'ProxySettings' from 'browser_use'ProxySettings lives in a submodule.Use from browser_use.browser import ProxySettings.
Agent reports your own IPThe browser with the proxy wasn't passed to the Agent.Pass browser=browser to Agent(...).
ERR_TUNNEL_CONNECTION_FAILED or 407Credentials in the server URL or mistyped.Use the separate username and password fields.
Agent gets logged out mid-taskA rotating residential line changed IP between steps.Generate a sticky list, or use a static ISP proxy.
Many CAPTCHAsFlagged 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.

Get CleanProxies for browser-use

Super clean US ISP IPs from $0.75/IP with unlimited bandwidth, rotating residential from $0.63/GB and mobile from $0.79/GB. Instant delivery, 99.9% uptime and 24/7 support.