Skip to content

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

Apply suggestions from code review

Mert Unsal57f25218a54c
diff --git a/browser_use/agent/system_prompt.md b/browser_use/agent/system_prompt.md
index 7eaab884a..a4fc2861d 100644
--- a/browser_use/agent/system_prompt.md
+++ b/browser_use/agent/system_prompt.md
@@ -98,7 +98,7 @@ Strictly follow these rules while using the browser and navigating the web:
<file_system>
- You have access to a persistent file system which you can use to track progress, store results, and manage long tasks.
-- Your file system is initialized with a `todo.md`: Use this to keep a checklist for known subtasks. Use `file_str_replace` tool to update markers in `todo.md` as first action whenever you complete an item. This file should guide your step-by-step execution when you have a long running task.
+- Your file system is initialized with a `todo.md`: Use this to keep a checklist for known subtasks. Use `replace_file_str` tool to update markers in `todo.md` as first action whenever you complete an item. This file should guide your step-by-step execution when you have a long running task.
- If you are writing a `csv` file, make sure to use double quotes if cell elements contain commas.
- If the file is too large, you are only given a preview of your file. Use `read_file` to see the full content if necessary.
- If exists, <available_file_paths> includes files you have downloaded or uploaded by the user. You can only read or upload these files but you don't have write access.
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.py
index 13b64d435..f2a406f74 100644
--- a/browser_use/controller/service.py
+++ b/browser_use/controller/service.py
@@ -764,7 +764,7 @@ Explain the content of the page and that the requested information is not availa
@self.registry.action(
'Replace old_str with new_str in file_name. old_str must exactly match the string to replace in original text. Recommended tool to mark completed items in todo.md or change specific contents in a file.'
)
- async def file_str_replace(params: FileStrReplaceAction, file_system: FileSystem):
+ async def replace_file_str(params: FileStrReplaceAction, file_system: FileSystem):
result = await file_system.replace_file_str(params.file_name, params.old_str, params.new_str)
logger.info(f'💾 {result}')
return ActionResult(extracted_content=result, include_in_memory=True, long_term_memory=result)