Skip to content

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

linter

Magnus Müller3cd7846b14ae
diff --git a/browser_use/llm/anthropic/chat.py b/browser_use/llm/anthropic/chat.py
index 861fd5b0b..367503eb4 100644
--- a/browser_use/llm/anthropic/chat.py
+++ b/browser_use/llm/anthropic/chat.py
@@ -141,7 +141,7 @@ class ChatAnthropic(BaseChatModel):
response = await self.get_client().messages.create(
model=self.model,
messages=anthropic_messages,
- system=system_prompt or NOT_GIVEN,
+ system=system_prompt if system_prompt else NOT_GIVEN,
**self._get_client_params_for_invoke(),
)
@@ -192,7 +192,7 @@ class ChatAnthropic(BaseChatModel):
model=self.model,
messages=anthropic_messages,
tools=[tool],
- system=system_prompt or NOT_GIVEN,
+ system=system_prompt if system_prompt else NOT_GIVEN,
tool_choice=tool_choice,
**self._get_client_params_for_invoke(),
)
diff --git a/browser_use/llm/aws/chat_anthropic.py b/browser_use/llm/aws/chat_anthropic.py
index 65eba410c..ccc8384cc 100644
--- a/browser_use/llm/aws/chat_anthropic.py
+++ b/browser_use/llm/aws/chat_anthropic.py
@@ -163,7 +163,7 @@ class ChatAnthropicBedrock(ChatAWSBedrock):
response = await self.get_client().messages.create(
model=self.model,
messages=anthropic_messages,
- system=system_prompt or NOT_GIVEN,
+ system=system_prompt if system_prompt else NOT_GIVEN,
**self._get_client_params_for_invoke(),
)
@@ -206,7 +206,7 @@ class ChatAnthropicBedrock(ChatAWSBedrock):
model=self.model,
messages=anthropic_messages,
tools=[tool],
- system=system_prompt or NOT_GIVEN,
+ system=system_prompt if system_prompt else NOT_GIVEN,
tool_choice=tool_choice,
**self._get_client_params_for_invoke(),
)
diff --git a/examples/integrations/agentmail/email_tools.py b/examples/integrations/agentmail/email_tools.py
index 438525c6c..b7e0acb60 100644
--- a/examples/integrations/agentmail/email_tools.py
+++ b/examples/integrations/agentmail/email_tools.py
@@ -99,7 +99,7 @@ class EmailTools(Tools):
"""
Wait for a message to be received in the inbox
"""
- async with self.email_client.websockets.connect() as ws:
+ async with self.email_client.websockets.connect() as ws: # type: ignore[attr-defined]
await ws.send_subscribe(message=Subscribe(inbox_ids=[inbox_id]))
try: