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
Reduce tokens for extract
Magnus Müller301fab0726c9
diff --git a/browser_use/filesystem/file_system.py b/browser_use/filesystem/file_system.pyindex 1f4fc3f18..c7dffb403 100644--- a/browser_use/filesystem/file_system.py+++ b/browser_use/filesystem/file_system.py@@ -376,7 +376,7 @@ class FileSystem:await file_obj.write(content, self.data_dir)self.files[extracted_filename] = file_objself.extracted_content_count += 1- return f'Extracted content saved to file {extracted_filename} successfully.'+ return extracted_filenamedef describe(self) -> str:"""List all files with their content information using file-specific display methods"""diff --git a/browser_use/tools/service.py b/browser_use/tools/service.pyindex 03ea6291f..ee3140373 100644--- a/browser_use/tools/service.py+++ b/browser_use/tools/service.py@@ -672,8 +672,8 @@ You will be given a query and the markdown of a webpage that has been filtered tmemory = extracted_contentinclude_extracted_content_only_once = Falseelse:- save_result = await file_system.save_extracted_content(extracted_content)- memory = f'Extracted content from {current_url} for query: {query}\nContent saved to file system: {save_result} and displayed in <read_state>.'+ file_name = await file_system.save_extracted_content(extracted_content)+ memory = f'Query: {query}\nContent in {file_name} and once in <read_state>.'include_extracted_content_only_once = Truelogger.info(f'📄 {memory}')