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
Enhance user guidance in data extraction: add reminder to save information during read state and refine instructions for structured data extraction to clarify usage and file saving practices.
mertunsallf7a8e99f130f
diff --git a/browser_use/agent/message_manager/service.py b/browser_use/agent/message_manager/service.pyindex 2d7cb6f48..ad1ccfd84 100644--- a/browser_use/agent/message_manager/service.py+++ b/browser_use/agent/message_manager/service.py@@ -404,6 +404,8 @@ Next goal: {model_output.current_state.next_goal}"""if self.read_state_description == self.read_state_initialization:self.read_state_description = ''+ else:+ self.read_state_description += '\nMAKE SURE TO SAVE THIS INFORMATION INTO A FILE OR TO MEMORY IF YOU NEED IT LATER.'def add_sensitive_data(self, current_page_url) -> None:sensitive_data = self.settings.sensitive_datadiff --git a/browser_use/controller/service.py b/browser_use/controller/service.pyindex 7a0f85f5b..f0320e264 100644--- a/browser_use/controller/service.py+++ b/browser_use/controller/service.py@@ -312,18 +312,15 @@ class Controller(Generic[Context]):# Content Actions@self.registry.action("""Extract structured, semantic data (e.g. product description, price, all information about XYZ) from the current webpage based on a textual query.-Only use this action for extracting specific information from a single item/article/product page. Do NOT use this for pages with listings or search results with many items.+Only use this for extracting info from a single product/article page, not listing or search results pages.Use include_links=True if extraction requires links.-If you want to persist the extracted data, optionally set the file_to_save parameter to a file name. ALWAYS use a new file name with .txt or .md extension for each extraction.""",)async def extract_structured_data(query: str,page: Page,page_extraction_llm: BaseChatModel,- file_system: FileSystem,include_links: bool = False,- file_to_save: str = '',):from functools import partial@@ -374,10 +371,6 @@ If you want to persist the extracted data, optionally set the file_to_save paramextracted_content = f'Page Link: {page.url}\nQuery: {query}\nExtracted Content:\n{output_text}'memory = f'Extracted content from {page.url} for query "{query}"'logger.info(f'📄 {memory}')- if file_to_save:- result = await file_system.write_file(file_to_save, output_text)- logger.info(f'💾 {result}')- memory += '\n' + resultreturn ActionResult(extracted_content=extracted_content,include_in_memory=False,