Skip to content

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

Linter

Magnus Müllerca60441b9449
diff --git a/examples/code_agent/extract_products.py b/examples/code_agent/extract_products.py
index 23d416ed9..03dc9c6a2 100644
--- a/examples/code_agent/extract_products.py
+++ b/examples/code_agent/extract_products.py
@@ -19,7 +19,7 @@ import asyncio
from lmnr import Laminar
-from browser_use.code_use import CodeAgent, export_to_ipynb
+from browser_use.code_use import CodeAgent
Laminar.initialize()
@@ -41,31 +41,6 @@ Go to https://www.flipkart.com. Continue collecting products from Flipkart in th
print('Running code-use agent...')
session = await agent.run()
- # Print summary
- print(f'\n{"=" * 60}')
- print('Session Summary')
- print(f'{"=" * 60}')
- print(f'Total cells executed: {len(session.cells)}')
- print(f'Total execution count: {session.current_execution_count}')
-
- # Print each cell
- for i, cell in enumerate(session.cells):
- print(f'\n{"-" * 60}')
- print(f'Cell {i + 1} (Status: {cell.status.value})')
- print(f'{"-" * 60}')
- print('Code:')
- print(cell.source)
- if cell.output:
- print('\nOutput:')
- print(cell.output)
- if cell.error:
- print('\nError:')
- print(cell.error)
-
- # Export to Jupyter notebook
- notebook_path = export_to_ipynb(session, 'product_extraction.ipynb')
- print(f'\n✓ Exported session to Jupyter notebook: {notebook_path}')
-
finally:
await agent.close()
diff --git a/examples/code_agent/filter_webvoyager_dataset.py b/examples/code_agent/filter_webvoyager_dataset.py
new file mode 100644
index 000000000..d7ddddbf7
--- /dev/null
+++ b/examples/code_agent/filter_webvoyager_dataset.py
@@ -0,0 +1,27 @@
+import asyncio
+
+from browser_use.code_use import CodeAgent
+
+
+async def main():
+ task = """
+Find the WebVoyager dataset, download it and create a new version where you remove all tasks which have older dates than today.
+"""
+
+ # Create code-use agent
+ agent = CodeAgent(
+ task=task,
+ max_steps=25,
+ )
+
+ try:
+ # Run the agent
+ print('Running code-use agent to filter WebVoyager dataset...')
+ session = await agent.run()
+
+ finally:
+ await agent.close()
+
+
+if __name__ == '__main__':
+ asyncio.run(main())