Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix disabled thinking mode

mertunsall578360b29306
diff --git a/browser_use/agent/views.py b/browser_use/agent/views.py
index 6b717d5c1..67f3408e2 100644
--- a/browser_use/agent/views.py
+++ b/browser_use/agent/views.py
@@ -193,24 +193,25 @@ 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, but inheriting from AgentOutput
- # Override only the fields we need to change
- model_ = create_model(
+ class AgentOutputNoThinking(AgentOutput):
+ @classmethod
+ def model_json_schema(cls):
+ schema = super().model_json_schema()
+ del schema['properties']['thinking']
+ return schema
+
+ model = create_model(
'AgentOutput',
- __base__=AgentOutput,
- thinking=(
- type(None), # type: ignore
- Field(default=None, exclude=True),
- ), # Exclude thinking from schema
+ __base__=AgentOutputNoThinking,
action=(
list[custom_actions], # type: ignore
Field(..., description='List of actions to execute', json_schema_extra={'min_items': 1}),
),
- __module__=AgentOutput.__module__,
+ __module__=AgentOutputNoThinking.__module__,
)
- model_.__doc__ = 'AgentOutput model with custom actions'
- return model_
+ model.__doc__ = 'AgentOutput model with custom actions'
+ return model
class AgentHistory(BaseModel):