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
Search with user input
magmueller54f476a41cde
diff --git a/src/tests/test_search.py b/src/tests/test_search.pyindex e05cebcc2..dccdef346 100644--- a/src/tests/test_search.py+++ b/src/tests/test_search.py@@ -92,7 +92,50 @@ async def test_wikipedia_tabs():task = 'open 3 wikipedia pages in different tabs and summarize me the content of all pages.'run_folder = setup_run_folder('wikipedia_tabs')- controller = ControllerService()+ controller = ControllerService(keep_open=True)++ model = ChatAnthropic(+ model_name='claude-3-5-sonnet-20240620', timeout=25, stop=None, temperature=0.3+ )+ model = ChatOpenAI(model='gpt-4o', temperature=0.3)++ agent = AgentService(+ task, model, controller, use_vision=True, save_file=f'{run_folder}/conversation'+ )++ try:+ max_steps = 50+ for i in range(max_steps):+ print(f'\n📍 Step {i+1}')+ action, result = await agent.step()+ if result.done:+ print('\n✅ Task completed successfully')+ print('Extracted content:', result.extracted_content)+ break+ print('result:\n', result.model_dump_json(indent=4))++ except KeyboardInterrupt:+ print('\nReceived interrupt, closing browser...')+ controller.browser.close()+ raise+ except:+ print('\n' + '=' * 50)+ print('❌ Failed to complete task in maximum steps')+ print('=' * 50)+ assert False, 'Failed to complete task in maximum steps'+ finally:+ controller.browser.close()+++# clear && pytest src/tests/test_search.py::test_albert_image_search -v -s+@observe()+async def test_albert_image_search():+ # task = 'open 3 wikipedia pages in different tabs and then go back to the first one and summarize me the content of the page.'+ task = 'find an image of albert einstein and ask me for further instructions.'+ run_folder = setup_run_folder('albert_einstein_image_search')++ controller = ControllerService(keep_open=True)model = ChatAnthropic(model_name='claude-3-5-sonnet-20240620', timeout=25, stop=None, temperature=0.3