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:mutable default argument. (#901)
shudaizi19895b08613a27f2
diff --git a/browser_use/agent/views.py b/browser_use/agent/views.pyindex a8d490de8..6d8249727 100644--- a/browser_use/agent/views.py+++ b/browser_use/agent/views.py@@ -356,8 +356,10 @@ class AgentHistoryList(BaseModel):content.extend([r.extracted_content for r in h.result if r.extracted_content])return content- def model_actions_filtered(self, include: list[str] = []) -> list[dict]:+ def model_actions_filtered(self, include: list[str] | None = None) -> list[dict]:"""Get all model actions from history as JSON"""+ if include is None:+ include = []outputs = self.model_actions()result = []for o in outputs:diff --git a/browser_use/controller/registry/service.py b/browser_use/controller/registry/service.pyindex 20d80f189..be52a4b68 100644--- a/browser_use/controller/registry/service.py+++ b/browser_use/controller/registry/service.py@@ -24,10 +24,10 @@ Context = TypeVar('Context')class Registry(Generic[Context]):"""Service for registering and managing actions"""- def __init__(self, exclude_actions: list[str] = []):+ def __init__(self, exclude_actions: list[str] | None = None):self.registry = ActionRegistry()self.telemetry = ProductTelemetry()- self.exclude_actions = exclude_actions+ self.exclude_actions = exclude_actions if exclude_actions is not None else []@time_execution_sync('--create_param_model')def _create_param_model(self, function: Callable) -> Type[BaseModel]:diff --git a/browser_use/dom/views.py b/browser_use/dom/views.pyindex 05c597c62..f0acd9f86 100644--- a/browser_use/dom/views.py+++ b/browser_use/dom/views.py@@ -118,7 +118,7 @@ class DOMElementNode(DOMBaseNode):return '\n'.join(text_parts).strip()@time_execution_sync('--clickable_elements_to_string')- def clickable_elements_to_string(self, include_attributes: list[str] = []) -> str:+ def clickable_elements_to_string(self, include_attributes: list[str] | None = None) -> str:"""Convert the processed DOM content to HTML."""formatted_text = []