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 bugs
mertunsalle6dfee739d24
diff --git a/browser_use/agent/views.py b/browser_use/agent/views.pyindex 372b3a689..200158559 100644--- a/browser_use/agent/views.py+++ b/browser_use/agent/views.py@@ -4,7 +4,7 @@ import jsonimport tracebackfrom dataclasses import dataclassfrom pathlib import Path-from typing import Any, List, TYPE_CHECKING+from typing import Anyfrom openai import RateLimitErrorfrom pydantic import BaseModel, ConfigDict, Field, ValidationError, create_model, model_validator@@ -187,20 +187,12 @@ class AgentOutput(BaseModel):def type_with_custom_actions_no_thinking(custom_actions: type[ActionModel]) -> type['AgentOutput']:"""Extend actions with custom actions and exclude thinking field"""- # Create a base model without thinking+ # Create a base model without thinking, but inheriting from AgentOutput+ # Override only the fields we need to changemodel_ = create_model(- 'AgentOutputNoThinking',- evaluation_previous_goal=(- str,- Field(- ..., description='One-sentence analysis of your last action. Clearly state success, failure, or uncertain.'- ),- ),- memory=(str, Field(..., description='1-3 sentences of specific memory of this step and overall progress.')),- next_goal=(- str,- Field(..., description='State the next immediate goals and actions to achieve it, in one clear sentence.'),- ),+ 'AgentOutput',+ __base__=AgentOutput,+ thinking=(type(None), Field(default=None, exclude=True)), # Exclude thinking from schemaaction=(List[custom_actions], # type: ignoreField(..., description='List of actions to execute', json_schema_extra={'min_items': 1}),@@ -208,9 +200,6 @@ class AgentOutput(BaseModel):__module__=AgentOutput.__module__,)- # Set the model config- model_.model_config = AgentOutput.model_config-# Add the current_state property with proper typingdef current_state_property(self: Any) -> AgentBrain:"""For backward compatibility - returns an AgentBrain with the flattened properties"""@@ -222,7 +211,7 @@ class AgentOutput(BaseModel):)model_.current_state = property(current_state_property)- model_.__doc__ = 'AgentOutput model with custom actions and no thinking field'+ model_.__doc__ = 'AgentOutput model with custom actions'return model_