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
Update sample_images type
zhcn0fc797b9f67c
diff --git a/browser_use/agent/message_manager/service.py b/browser_use/agent/message_manager/service.pyindex c7d8961ba..2c6e17489 100644--- a/browser_use/agent/message_manager/service.py+++ b/browser_use/agent/message_manager/service.py@@ -18,8 +18,8 @@ from browser_use.filesystem.file_system import FileSystemfrom browser_use.llm.messages import (BaseMessage,ContentPartTextParam,+ ContentPartImageParam,SystemMessage,- UserMessage,)from browser_use.observability import observe_debugfrom browser_use.utils import match_url_with_domain_pattern, time_execution_sync@@ -109,7 +109,7 @@ class MessageManager:vision_detail_level: Literal['auto', 'low', 'high'] = 'auto',include_tool_call_examples: bool = False,include_recent_events: bool = False,- sample_images: list[UserMessage] | None = None,+ sample_images: list[ContentPartTextParam | ContentPartImageParam] | None = None,):self.task = taskself.state = statediff --git a/browser_use/agent/prompts.py b/browser_use/agent/prompts.pyindex 00663aeaa..901e1503d 100644--- a/browser_use/agent/prompts.py+++ b/browser_use/agent/prompts.py@@ -93,7 +93,7 @@ class AgentMessagePrompt:screenshots: list[str] | None = None,vision_detail_level: Literal['auto', 'low', 'high'] = 'auto',include_recent_events: bool = False,- sample_images: list[UserMessage] | None = None,+ sample_images: list[ContentPartTextParam | ContentPartImageParam] | None = None,):self.browser_state: 'BrowserStateSummary' = browser_state_summaryself.file_system: 'FileSystem | None' = file_systemdiff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex c91a79225..603a59a27 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -24,7 +24,7 @@ from browser_use.agent.cloud_events import ()from browser_use.agent.message_manager.utils import save_conversationfrom browser_use.llm.base import BaseChatModel-from browser_use.llm.messages import BaseMessage, UserMessage+from browser_use.llm.messages import BaseMessage, UserMessage, ContentPartTextParam, ContentPartImageParamfrom browser_use.llm.openai.chat import ChatOpenAIfrom browser_use.tokens.service import TokenCost@@ -179,7 +179,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):step_timeout: int = 120,directly_open_url: bool = True,include_recent_events: bool = False,- sample_images: list[UserMessage] | None = None,+ sample_images: list[ContentPartTextParam | ContentPartImageParam] | None = None,**kwargs,):if page_extraction_llm is None: