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
fix parallel_agents example
Nick Sweeting531527b83f29
diff --git a/examples/features/parallel_agents.py b/examples/features/parallel_agents.pyindex 907bffa94..48006f9bb 100644--- a/examples/features/parallel_agents.py+++ b/examples/features/parallel_agents.py@@ -11,20 +11,19 @@ load_dotenv()from langchain_openai import ChatOpenAIfrom browser_use.agent.service import Agent-from browser_use.browser import BrowserProfile, BrowserSession+from browser_use.browser import BrowserSessionbrowser_session = BrowserSession(- browser_profile=BrowserProfile(- disable_security=True,- headless=False,- save_recording_path='./tmp/recordings',- user_data_dir='~/.config/browseruse/profiles/default',- )+ keep_alive=True,+ headless=False,+ save_recording_path='./tmp/recordings',+ user_data_dir='~/.config/browseruse/profiles/default',)llm = ChatOpenAI(model='gpt-4o')async def main():+ await browser_session.start()agents = [Agent(task=task, llm=llm, browser_session=browser_session)for task in [@@ -41,16 +40,8 @@ async def main():]]- await asyncio.gather(*[agent.run() for agent in agents])-- agentX = Agent(- task='Go to apple.com and return the title of the page',- llm=llm,- browser_session=browser_session,- )- await agentX.run()-- await browser_session.close()+ print(await asyncio.gather(*[agent.run() for agent in agents]))+ await browser_session.kill()if __name__ == '__main__':