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
tweak controller action param setup to avoid double browser_session arg
Nick Sweeting5cbb48a7182a
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex eb3a024be..21cedfdf3 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -229,16 +229,15 @@ class Agent(Generic[Context]):self.settings.use_vision_for_planner = Falselogger.info(- f'🧠 Starting a browser-use agent with base_model={self.model_name}'+ f'🧠 Starting a browser-use agent {self.version} with base_model={self.model_name}'f'{" +tools" if self.tool_calling_method == "function_calling" else ""}'f'{" +rawtools" if self.tool_calling_method == "raw" else ""}'f'{" +vision" if self.settings.use_vision else ""}'f'{" +memory" if self.enable_memory else ""}, '- f'{" +planner_model={self.planner_model_name}" if self.planner_model_name else ""}'- f'{" +reasoning" if self.settings.is_planner_reasoning else ""}'- f'{" +vision" if self.settings.use_vision_for_planner else ""}, '- f'extraction_model={getattr(self.settings.page_extraction_llm, "model_name", None)}, '- f'" on version v{self.version}"'+ f'{" +vision" if self.settings.use_vision_for_planner else ""}'+ f'{" planner_model={self.planner_model_name}" if self.planner_model_name else ""}'+ f'{" +planner_reasoning" if self.settings.is_planner_reasoning else ""}'+ f' extraction_model={getattr(self.settings.page_extraction_llm, "model_name", None)}, ')# Verify we can connect to the LLMdiff --git a/browser_use/controller/registry/service.py b/browser_use/controller/registry/service.pyindex 35cb00935..82734bda9 100644--- a/browser_use/controller/registry/service.py+++ b/browser_use/controller/registry/service.py@@ -168,14 +168,31 @@ class Registry(Generic[Context]):extra_args['has_sensitive_data'] = Trueif is_pydantic:+ # Check for browser-related fields in Pydantic model+ model_dict = validated_params.model_dump()+ for key in ['browser_session', 'browser', 'browser_context']:+ if key in model_dict and key in extra_args:+ # If browser is in both places, remove from model+ model_copy = validated_params.model_copy(deep=True)+ setattr(model_copy, key, None)+ validated_params = model_copy+ breakreturn await action.function(validated_params,**extra_args,)+ # Convert validated params to dict+ param_dict = validated_params.model_dump()++ # Remove browser_session from params if it exists to avoid passing it twice+ for key in ['browser_session', 'browser', 'browser_context']:+ if key in param_dict and key in extra_args:+ del param_dict[key]+return await action.function(**{- **validated_params.model_dump(),+ **param_dict,**extra_args,})