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
anthropic: tool choice auto when thinking (cannot force it)
Laith Weinbergerdfbb5c09ed16
diff --git a/browser_use/llm/anthropic/chat.py b/browser_use/llm/anthropic/chat.pyindex a6f3dd256..91a4d78ab 100644--- a/browser_use/llm/anthropic/chat.py+++ b/browser_use/llm/anthropic/chat.py@@ -88,6 +88,14 @@ class ChatAnthropic(BaseChatModel):model = self.name.lower()return 'claude-fable-5' in model or 'claude-mythos-5' in model+ def _requires_auto_tool_choice(self) -> bool:+ model = self.name.lower()+ if 'claude-fable-5' in model or 'claude-mythos-5' in model:+ return True+ if self.thinking is None:+ return False+ return self.thinking.get('type') != 'disabled'+def _validate_thinking_config(self) -> None:if not self.thinking or not self._is_adaptive_thinking_only_model():return@@ -313,8 +321,11 @@ class ChatAnthropic(BaseChatModel):cache_control=CacheControlEphemeralParam(type='ephemeral'),)- # Force the model to use this tool- tool_choice = ToolChoiceToolParam(type='tool', name=tool_name)+ if self._requires_auto_tool_choice():+ tool_choice = {'type': 'auto'}+ else:+ # Force the model to use this tool+ tool_choice = ToolChoiceToolParam(type='tool', name=tool_name)response = await self._create_message(model=self.model,