Skip to content

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

Enhance logging in service.py to include the specific query in the extracted content message, improving clarity for debugging and tracking purposes.

Magnus Müller837f0804df27
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.py
index ffd90fc03..638ffe397 100644
--- a/browser_use/controller/service.py
+++ b/browser_use/controller/service.py
@@ -279,7 +279,7 @@ class Controller(Generic[Context]):
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))
- msg = f'📄 Extracted from page\n: {output.content}\n'
+ msg = f'📄 Extracted from page for query "{content_to_extract}"\n: {output.content}\n'
logger.info(msg)
return ActionResult(
extracted_content=msg,