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
better descripiton for extract
Magnus Müller13836049618d
diff --git a/browser_use/tools/service.py b/browser_use/tools/service.pyindex 917b31107..06145e815 100644--- a/browser_use/tools/service.py+++ b/browser_use/tools/service.py@@ -38,6 +38,7 @@ from browser_use.tools.views import (ClickElementAction,CloseTabAction,DoneAction,+ ExtractAction,GetDropdownOptionsAction,InputTextAction,NavigateAction,@@ -577,15 +578,16 @@ class Tools(Generic[Context]):"""LLM extracts structured data from page markdown. Use when: on right page, know what to extract, haven't called before on same page+query. Can't get interactive elements. Set extract_links=True for URLs. Use start_from_char if truncated. If fails, use find_text instead.""",)async def extract(- query: str,+ params: ExtractAction,browser_session: BrowserSession,page_extraction_llm: BaseChatModel,file_system: FileSystem,- extract_links: bool = False,- start_from_char: int = 0,):# ConstantsMAX_CHAR_LIMIT = 30000+ query = params.query+ extract_links = params.extract_links+ start_from_char = params.start_from_char# Extract clean markdown using the unified methodtry:@@ -603,7 +605,7 @@ class Tools(Generic[Context]):if start_from_char > 0:if start_from_char >= len(content):return ActionResult(- error=f'start_from_char ({start_from_char}) exceeds content length ({len(content)}). Content has {final_filtered_length} characters after filtering.'+ error=f'start_from_char ({start_from_char}) exceeds content length {final_filtered_length} characters.')content = content[start_from_char:]content_stats['started_from_char'] = start_from_chardiff --git a/browser_use/tools/views.py b/browser_use/tools/views.pyindex 5775175a0..008c8f5f0 100644--- a/browser_use/tools/views.py+++ b/browser_use/tools/views.py@@ -4,6 +4,16 @@ from pydantic import BaseModel, ConfigDict, Field# Action Input Models+class ExtractAction(BaseModel):+ query: str+ extract_links: bool = Field(+ default=False, description='Set True to true if the query requires links, else false to safe tokens'+ )+ start_from_char: int = Field(+ default=0, description='Use this for long markdowns to start from a specific character (not index in browser_state)'+ )++class SearchAction(BaseModel):query: strengine: str = Field(