Skip to content

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

tweak cursorrules

Nick Sweeting3592eddc490e
diff --git a/.cursor/rules/browser-use-rules.mdc b/.cursor/rules/browser-use-rules.mdc
index a4f466525..899cfbb7d 100644
--- a/.cursor/rules/browser-use-rules.mdc
+++ b/.cursor/rules/browser-use-rules.mdc
@@ -39,7 +39,7 @@ uv sync
Do **not** replace `gpt-4o` with `gpt-4`. The model `gpt-4o` is a distinct release and supported.
* ✅ **Type-safe coding**
- Use **Pydantic models** for all internal action schemas, task inputs/outputs, and controller I/O. This ensures robust validation and LLM-call integrity.
+ Use **Pydantic v2 models** for all internal action schemas, task inputs/outputs, and controller I/O. This ensures robust validation and LLM-call integrity.
---
@@ -48,12 +48,13 @@ uv sync
To add a new action that your browser agent can execute:
```python
+from playwright.async_api import Page
from browser_use.core.controller import Controller, ActionResult
controller = Controller()
@controller.registry.action("Search the web for a specific query")
-async def search_web(query: str):
+async def search_web(query: str, page: Page):
# Implement your logic here, e.g., query a search engine and return results
result = ...
return ActionResult(extracted_content=result, include_in_memory=True)
@@ -71,7 +72,7 @@ async def search_web(query: str):
To define a task and run a browser-use agent:
```python
-from browser_use.core.agent import Agent
+from browser_use import Agent
from langchain.chat_models import ChatOpenAI
task = "Find the CEO of OpenAI and return their name"