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
Separated internal output model from suplied model, and fixed a parsing bug of Enum fields
guybensimhon1dc24574e7c50
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.pyindex a1ec1f131..cf468f287 100644--- a/browser_use/controller/service.py+++ b/browser_use/controller/service.py@@ -1,5 +1,6 @@import asyncioimport json+import enumimport loggingfrom typing import Dict, Generic, Optional, Type, TypeVar@@ -44,8 +45,9 @@ class Controller(Generic[Context]):if output_model is not None:# Create a new model that extends the output model with success parameter- class ExtendedOutputModel(output_model): # type: ignore+ class ExtendedOutputModel(BaseModel): # type: ignoresuccess: bool = True+ data: output_model@self.registry.action('Complete task - with return text and if the task is finished (success=True) or not yet completly finished (success=False), because last step is reached',@@ -53,7 +55,13 @@ class Controller(Generic[Context]):)async def done(params: ExtendedOutputModel):# Exclude success from the output JSON since it's an internal parameter- output_dict = params.model_dump(exclude={'success'})+ output_dict = params.data.model_dump()++ # Enums are not serializable, convert to string+ for key, value in output_dict.items():+ if isinstance(value, enum.Enum):+ output_dict[key] = value.value+return ActionResult(is_done=True, success=params.success, extracted_content=json.dumps(output_dict))else: