browser-use Proxy Configuration
Pass proxy settings when initializing the browser instance in your LangChain / browser-use agent script.
example.py
from browser_use import Agent
from langchain_openai import ChatOpenAI
import asyncio
async def run_browser_agent():
llm = ChatOpenAI(model="gpt-4o")
# Configure agent with residential proxy exit
agent = Agent(
task="Navigate to example.com, search for AI tools, and extract the top 3 results.",
llm=llm,
browser_config={
"headless": True,
"proxy": {
"server": "http://proxy.bytesflows.com:31112",
"username": "user-youraccount-country-us-session-agent01",
"password": "yourpassword"
}
}
)
history = await agent.run()
print("Agent execution complete. Final state:", history.final_result())
asyncio.run(run_browser_agent())