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
Fix param
Magnus Müller18b7dd95a4c2
diff --git a/browser_use/agent/system_prompt.md b/browser_use/agent/system_prompt.mdindex b48a68cb6..fb58b6044 100644--- a/browser_use/agent/system_prompt.md+++ b/browser_use/agent/system_prompt.md@@ -118,9 +118,9 @@ You must call the `done` action in one of two cases:The `done` action is your opportunity to terminate and share your findings with the user.- Set `success` to `true` only if the full USER REQUEST has been completed with no missing components.- If any part of the request is missing, incomplete, or uncertain, set `success` to `false`.-- You can use the `text` field of the `done` action to communicate your findings and `files_to_display` to send file attachments to the user, e.g. `["results.md"]`.+- You can use the `text` field of the `done` action to communicate your findings and `files` to send file attachments to the user, e.g. `["results.md"]`.- Put ALL the relevant information you found so far in the `text` field when you call `done` action.-- Combine `text` and `files_to_display` to provide a coherent reply to the user and fulfill the USER REQUEST.+- Combine `text` and `files` to provide a coherent reply to the user and fulfill the USER REQUEST.- You are ONLY ALLOWED to call `done` as a single action. Don't call it together with other actions.- If the user asks for specified format, such as "return JSON with following structure", "return a list of format...", MAKE sure to use the right format in your answer.- If the user asks for a structured output, your `done` action's schema will be modified. Take this schema into account when solving the task!diff --git a/browser_use/agent/system_prompt_no_thinking.md b/browser_use/agent/system_prompt_no_thinking.mdindex c905e5bb6..6eddc625d 100644--- a/browser_use/agent/system_prompt_no_thinking.md+++ b/browser_use/agent/system_prompt_no_thinking.md@@ -118,9 +118,9 @@ You must call the `done` action in one of two cases:The `done` action is your opportunity to terminate and share your findings with the user.- Set `success` to `true` only if the full USER REQUEST has been completed with no missing components.- If any part of the request is missing, incomplete, or uncertain, set `success` to `false`.-- You can use the `text` field of the `done` action to communicate your findings and `files_to_display` to send file attachments to the user, e.g. `["results.md"]`.+- You can use the `text` field of the `done` action to communicate your findings and `files` to send file attachments to the user, e.g. `["results.md"]`.- Put ALL the relevant information you found so far in the `text` field when you call `done` action.-- Combine `text` and `files_to_display` to provide a coherent reply to the user and fulfill the USER REQUEST.+- Combine `text` and `files` to provide a coherent reply to the user and fulfill the USER REQUEST.- You are ONLY ALLOWED to call `done` as a single action. Don't call it together with other actions.- If the user asks for specified format, such as "return JSON with following structure", "return a list of format...", MAKE sure to use the right format in your answer.- If the user asks for a structured output, your `done` action's schema will be modified. Take this schema into account when solving the task!diff --git a/browser_use/tools/service.py b/browser_use/tools/service.pyindex 3e7b526a6..dbed5a1dc 100644--- a/browser_use/tools/service.py+++ b/browser_use/tools/service.py@@ -683,19 +683,15 @@ You will be given a query and the markdown of a webpage that has been filtered t# Look up the node from the selector map if index is provided# Special case: index 0 means scroll the whole page (root/body element)node = None- if params.frame_idx is not None and params.frame_idx != 0:- node = await browser_session.get_element_by_index(params.frame_idx)+ if params.frame_index is not None and params.frame_index != 0:+ node = await browser_session.get_element_by_index(params.frame_index)if node is None:# Element does not exist- msg = f'Element index {params.frame_idx} not found in browser state'+ msg = f'Element index {params.frame_index} not found in browser state'return ActionResult(error=msg)direction = 'down' if params.down else 'up'- target = (- 'the page'- if params.frame_idx is None or params.frame_idx == 0- else f'element {params.frame_idx}'- )+ target = 'the page' if params.frame_index is None or params.frame_index == 0 else f'element {params.frame_index}'# Get actual viewport height for more accurate scrollingtry:diff --git a/browser_use/tools/views.py b/browser_use/tools/views.pyindex 692757c6f..c73752ba0 100644--- a/browser_use/tools/views.py+++ b/browser_use/tools/views.py@@ -6,7 +6,7 @@ from pydantic import BaseModel, ConfigDict, Field# Action Input Modelsclass SearchAction(BaseModel):query: str- search_engine: str = Field(+ engine: str = Field(default='duckduckgo', description='duckduckgo, google, bing (use duckduckgo by default because less captchas)')@@ -39,7 +39,7 @@ class InputTextAction(BaseModel):class DoneAction(BaseModel):text: str = Field(description='summary for user')success: bool = Field(description='True if user_request completed successfully')- files_to_display: list[str] | None = Field(default=[], description='files to display')+ files: list[str] | None = Field(default=[], description='files to display')T = TypeVar('T', bound=BaseModel)