Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Flight example
magmuellered6510963dc9
diff --git a/examples/flight_search.py b/examples/flight_search.pyindex 2846c78bd..44be1542d 100644--- a/examples/flight_search.py+++ b/examples/flight_search.py@@ -7,6 +7,9 @@ Simple try of the agent.import osimport sys+from browser_use.browser.browser import Browser, BrowserConfig+from browser_use.browser.context import BrowserContext, BrowserContextConfig+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))import asyncio@@ -16,20 +19,23 @@ from browser_use import Agent, AgentHistoryList, Controllerllm = ChatOpenAI(model='gpt-4o')# browser = Browser(config=BrowserConfig(headless=False))-controller = Controller()agent = Agent(- task='Find flights on kayak.com from Zurich to Beijing on 25.12.2024 to 02.02.2025',+ task=(+ 'Find flights on kayak.com from Zurich to San Francisco on 25.12.2024 to 02.02.2025, make sure to select the right month '+ ),llm=llm,- controller=controller,- # browser=browser,+ validate_output=True,+ browser_context=BrowserContext(+ browser=Browser(config=BrowserConfig(headless=False)),+ ),)async def main():- history: AgentHistoryList = await agent.run(2)+ history: AgentHistoryList = await agent.run(20)# await controller.browser.close(force=True)-+ input('Press Enter to close the browser')# await browser.close()