Skip to content

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

Refine tools documentation for clarity and completeness

Magnus Müllerce2a7270153d
diff --git a/docs/customize/tools-register.mdx b/docs/customize/tools-register.mdx
index 1d82bb4c6..1db955a50 100644
--- a/docs/customize/tools-register.mdx
+++ b/docs/customize/tools-register.mdx
@@ -1,6 +1,6 @@
---
title: "Add Tools"
-description: "You can add your own tools!"
+description: ""
icon: "plus"
mode: "wide"
---
@@ -15,9 +15,9 @@ Examples:
- calling LLMs
- get 2fa codes
- send emails
-...
+- ...
-To register your own custom functions (`sync` or `async`), add `@controller.action(...)`.
+Simply add `@controller.action(...)` to your function.
```python
from browser_use import Controller, Agent
@@ -34,23 +34,15 @@ def ask_human(question: str) -> ActionResult:
agent = Agent(task='...', llm=llm, controller=controller)
```
-
-
-## Decorator Parameters
-
-The `@controller.action()` decorator accepts these parameters:
-
-- **`description`** *(required)* - What the tool does, the LLM uses this to decide when to call it. Explain here the rules how to use the tool.
+- **`description`** *(required)* - What the tool does, the LLM uses this to decide when to call it.
- **`allowed_domains`** - List of domains where tool can run (e.g. `['*.example.com']`), defaults to all domains
-<Note>
- - The Agent chooses between tools to run solely based on the function name and description
- - The Agent fills tool parameters based on their names, type hints, & defaults
-</Note>
+The Agent fills your function parameters based on their names, type hints, & defaults.
+
## Available Objects
-Your tools have access to these objects:
+Your function has access to these objects:
- **`browser_session: BrowserSession`** - Current browser session for CDP access
- **`cdp_client`** - Direct Chrome DevTools Protocol client
@@ -67,8 +59,8 @@ You can use Pydantic for the tool parameters:
from pydantic import BaseModel
class Cars(BaseModel):
- name: str
- price: int
+ name: str = Field(description='The name of the car, e.g. "Toyota Camry"')
+ price: int = Field(description='The price of the car as int in USD, e.g. 25000')
@controller.action(description='Save cars to file')
def save_cars(cars: list[Cars]) -> str:
diff --git a/docs/customize/tools-remove.mdx b/docs/customize/tools-remove.mdx
index c285714bc..916eef150 100644
--- a/docs/customize/tools-remove.mdx
+++ b/docs/customize/tools-remove.mdx
@@ -1,11 +1,10 @@
---
title: "Remove Tools"
-description: "Exclude default tools from your controller"
+description: "You can exclude default tools when creating a controller:"
icon: "minus"
mode: "wide"
---
-You can exclude default tools when creating a controller:
```python
from browser_use import Controller
diff --git a/docs/customize/tools-response.mdx b/docs/customize/tools-response.mdx
index 4e2e46737..a0185b83d 100644
--- a/docs/customize/tools-response.mdx
+++ b/docs/customize/tools-response.mdx
@@ -40,14 +40,13 @@ def advanced_tool() -> ActionResult:
## Why `extracted_content` and `long_term_memory`?
With this you control the context for the LLM.
-### 1. Simple response
+### 1. Include short content always in context
```python
def simple_tool() -> str:
- return "Hello, world!" # Keep in context for all future steps (recommended)
+ return "Hello, world!" # Keep in context for all future steps
```
-This is equivalent to: `ActionResult(extracted_content="Hello, world!")` and `ActionResult(long_term_memory="Hello, world!")` without any other properties.
-### 2. Long content - show once, remember subset
+### 2. Show long content once, remember subset in context
```python
return ActionResult(
extracted_content="[500 lines of product data...]", # Shows to LLM once
@@ -57,7 +56,7 @@ return ActionResult(
```
We save the full `extracted_content` to files which the LLM can read in future steps.
-### 3. Long content - show never, remember subset
+### 3. Dont show long content, remember subset in context
```python
return ActionResult(
extracted_content="[500 lines of product data...]", # The LLM never sees this because `long_term_memory` overrides it and `include_extracted_content_only_once` is not used