mirror of
https://github.com/browser-use/browser-use.git
synced 2026-09-14 19:59:47 +08:00
96f39b3c75
Relocate deprecated doc sections from customize/ to legacy/ under Customize OS nav. Add redirects for all old paths and update cross-references in AGENTS.md and related mdx files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
952 B
Plaintext
37 lines
952 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](/legacy/actor/basics) actions.
|
|
</Note>
|