Files
browser-use__browser-use/docs/customize/tools/basics.mdx
Cursor Agent 1c70a9dbc5 docs: fix custom tool registry documentation to prevent common pitfalls
- Fix basics.mdx: change browser: Browser to browser_session: BrowserSession
- Fix basics.mdx: use async functions and proper ActionResult return type
- Add Warning about parameter name matching in basics.mdx
- Add Warning and Common Pitfalls section in add.mdx with clear examples
- Update AGENTS.md embedded docs to match

The agent injects special parameters by name matching, not by type.
Using incorrect parameter names (e.g., browser instead of browser_session)
causes tools to fail silently, which was a common user confusion.

Co-authored-by: mailmertunsal <mailmertunsal@gmail.com>
2026-01-18 20:12:46 +00:00

37 lines
955 B
Plaintext

---
title: "Basics"
description: "Tools are the functions that the agent has to interact with the world."
icon: "play"
mode: "wide"
---
## Quick Example
```python
from browser_use import Tools, ActionResult, BrowserSession
tools = Tools()
@tools.action('Ask human for help with a question')
async def ask_human(question: str, browser_session: BrowserSession) -> ActionResult:
answer = input(f'{question} > ')
return ActionResult(extracted_content=f'The human responded with: {answer}')
agent = Agent(
task='Ask human for help',
llm=llm,
tools=tools,
)
```
<Warning>
**Important**: The parameter must be named exactly `browser_session` with type `BrowserSession` (not `browser: Browser`).
The agent injects parameters by name matching, so using the wrong name will cause your tool to fail silently.
</Warning>
<Note>
Use `browser_session` parameter in tools for deterministic [Actor](/customize/actor/basics) actions.
</Note>