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 prompt format in service.py to change 'Page content:' to 'answer:' for improved clarity in JSON response structure.
Magnus Müllerb835bd01dc18
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.pyindex 514c9568e..ffd90fc03 100644--- a/browser_use/controller/service.py+++ b/browser_use/controller/service.py@@ -275,7 +275,7 @@ class Controller(Generic[Context]):content += f'\n\nIFRAME {iframe.url}:\n'content += markdownify.markdownify(await iframe.content())- prompt = 'Extract information from this webpage based on the query. Focus only on content relevant to the query. If the query is vague, provide a brief summary of the page. Respond in JSON format.\nQuery: {content_to_extract}\nPage content:\n{page}'+ prompt = 'Extract information from this webpage based on the query. Focus only on content relevant to the query. If the query is vague, provide a brief summary of the page. Respond in JSON format.\nQuery: {content_to_extract}\n answer:\n{page}'template = PromptTemplate(input_variables=['content_to_extract', 'page'], template=prompt)try:output = await page_extraction_llm.ainvoke(template.format(content_to_extract=content_to_extract, page=content))