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
Merge branch 'main' into mert/better_browser_exceptions
Mert Unsal93d808ad914e
diff --cc browser_use/tools/service.pyindex 51b485a8b,492c8c2c5..dddba7099--- a/browser_use/tools/service.py+++ b/browser_use/tools/service.py@@@ -170,10 -177,11 +170,10 @@@ class Tools(Generic[Context])memory = f"Searched Google for '{params.query}'"msg = f'🔍 {memory}'logger.info(msg)- return ActionResult(extracted_content=memory, include_in_memory=True, long_term_memory=memory)+ return ActionResult(extracted_content=memory, long_term_memory=memory)except Exception as e:logger.error(f'Failed to search Google: {e}')- clean_msg = extract_llm_error_message(e)- return ActionResult(error=f'Failed to search Google for "{params.query}": {clean_msg}')+ return ActionResult(error=f'Failed to search Google for "{params.query}": {str(e)}')@self.registry.action('Navigate to URL, set new_tab=True to open in new tab, False to navigate in current tab', param_model=GoToUrlAction@@@ -506,10 -505,11 +499,10 @@@assert new_target_id, 'SwitchTabEvent did not return a TargetID for the new tab that was switched to'memory = f'Switched to Tab with ID {new_target_id[-4:]}'logger.info(f'🔄 {memory}')- return ActionResult(extracted_content=memory, include_in_memory=True, long_term_memory=memory)+ return ActionResult(extracted_content=memory, long_term_memory=memory)except Exception as e:logger.error(f'Failed to switch tab: {type(e).__name__}: {e}')- clean_msg = extract_llm_error_message(e)- return ActionResult(error=f'Failed to switch to tab {params.tab_id}: {clean_msg}')+ return ActionResult(error=f'Failed to switch to tab {params.tab_id or params.url}.')@self.registry.action('Close an existing tab', param_model=CloseTabAction)async def close_tab(params: CloseTabAction, browser_session: BrowserSession):@@@ -689,10 -689,11 +681,10 @@@ Provide the extracted information in amsg = f'🔍 {long_term_memory}'logger.info(msg)- return ActionResult(extracted_content=msg, include_in_memory=True, long_term_memory=long_term_memory)+ return ActionResult(extracted_content=msg, long_term_memory=long_term_memory)except Exception as e:logger.error(f'Failed to dispatch ScrollEvent: {type(e).__name__}: {e}')- clean_msg = extract_llm_error_message(e)- error_msg = f'Failed to scroll: {clean_msg}'+ error_msg = 'Failed to execute scroll action.'return ActionResult(error=error_msg)@self.registry.action(@@@ -708,10 -709,11 +700,10 @@@memory = f'Sent keys: {params.keys}'msg = f'⌨️ {memory}'logger.info(msg)- return ActionResult(extracted_content=memory, include_in_memory=True, long_term_memory=memory)+ return ActionResult(extracted_content=memory, long_term_memory=memory)except Exception as e:logger.error(f'Failed to dispatch SendKeysEvent: {type(e).__name__}: {e}')- clean_msg = extract_llm_error_message(e)- error_msg = f'Failed to send keys: {clean_msg}'+ error_msg = f'Failed to send keys: {str(e)}'return ActionResult(error=error_msg)@self.registry.action(