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
refactor(controller): use ainvoke for async LLM call in extract_content
Haskely026ac9551a24
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.pyindex 2ccabe496..8b0d2f5fc 100644--- a/browser_use/controller/service.py+++ b/browser_use/controller/service.py@@ -325,7 +325,7 @@ class Controller(Generic[Context]):prompt = 'Your task is to extract the content of the page. You will be given a page and a goal and you should extract all relevant information around this goal from the page. If the goal is vague, summarize the page. Respond in json format. Extraction goal: {goal}, Page: {page}'template = PromptTemplate(input_variables=['goal', 'page'], template=prompt)try:- output = page_extraction_llm.invoke(template.format(goal=goal, page=content))+ output = await page_extraction_llm.ainvoke(template.format(goal=goal, page=content))msg = f'📄 Extracted from page\n: {output.content}\n'logger.info(msg)return ActionResult(extracted_content=msg, include_in_memory=True)