Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

File desc

Magnus Müller59c32a2585d1
diff --git a/browser_use/tools/service.py b/browser_use/tools/service.py
index 895844211..e5916e7df 100644
--- a/browser_use/tools/service.py
+++ b/browser_use/tools/service.py
@@ -938,7 +938,7 @@ You will be given a query and the markdown of a webpage that has been filtered t
# File System Actions
@self.registry.action(
- 'Supports formats: .txt, .md, .json, .jsonl, .csv, .pdf. For PDF files, write content in markdown format and it will be automatically converted to a properly formatted PDF document.'
+ 'Write complete content to a file. Use this to create new files or overwrite entire file contents. For targeted edits within existing files, use replace_file instead. Supports formats: .txt, .md, .json, .jsonl, .csv, .pdf. For PDF files, write content in markdown format and it will be automatically converted to a properly formatted PDF document.'
)
async def write_file(
file_name: str,
@@ -959,13 +959,17 @@ You will be given a query and the markdown of a webpage that has been filtered t
logger.info(f'💾 {result}')
return ActionResult(extracted_content=result, long_term_memory=result)
- @self.registry.action('')
+ @self.registry.action(
+ 'Replace specific text within a file by searching for old_str and replacing with new_str. Use this for targeted edits like updating todo checkboxes or modifying specific lines without rewriting the entire file.'
+ )
async def replace_file(file_name: str, old_str: str, new_str: str, file_system: FileSystem):
result = await file_system.replace_file_str(file_name, old_str, new_str)
logger.info(f'💾 {result}')
return ActionResult(extracted_content=result, long_term_memory=result)
- @self.registry.action('')
+ @self.registry.action(
+ 'Read the complete content of a file. Use this to view file contents before editing or to retrieve data from files.'
+ )
async def read_file(file_name: str, available_file_paths: list[str], file_system: FileSystem):
if available_file_paths and file_name in available_file_paths:
result = await file_system.read_file(file_name, external_file=True)