Skip to content

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

more intro explanation to custom actions

Nick Sweeting2450bd3ad280
diff --git a/docs/customize/custom-functions.mdx b/docs/customize/custom-functions.mdx
index 706c89b39..93e28fd4a 100644
--- a/docs/customize/custom-functions.mdx
+++ b/docs/customize/custom-functions.mdx
@@ -6,7 +6,15 @@ icon: "function"
## Action Function Registration
-Custom action functions can be either `sync` or `async`. Keep them focused and single-purpose.
+Custom actions are functions *you* provide, that are added to our [default tools](https://github.com/browser-use/browser-use/blob/main/browser_use/controller/service.py) the agent can use to accomplish tasks.
+Action functions can request arbitrary parameters that the LLM has to come up with + a fixed set of framework-provided arguments for browser APIs/`Agent(context)`/etc.
+
+By default, the Browser Use Agent gets the built-in set of actions (`open_tab`, `scroll_down`, `extract_content`, [and more](https://github.com/browser-use/browser-use/blob/main/browser_use/controller/service.py)),
+but you can extend them to implement custom or optimized behavior.
+
+To register your own custom functions (which can be `sync` or `async`), they are decorated them with the `@controller.action(...)` decorator which saves them into the `Controller.registry`.
+
+For examples of custom actions (e.g. uploading files, asking a human-in-the-loop for help, drawing a polygon with the mouse, etc.), see [examples/custom-functions](https://github.com/browser-use/browser-use/tree/main/examples/custom-functions).
```python
from pydantic import BaseModel
@@ -215,8 +223,6 @@ controller = Controller(exclude_actions=['open_tab', 'search_google'])
agent = Agent(controller=controller, ...)
```
-For more examples like file upload or notifications, visit [examples/custom-functions](https://github.com/browser-use/browser-use/tree/main/examples/custom-functions).
-
If you want actions to only be available on certain pages, and to not tell the LLM about them on other pages,
you can use the `allowed_domains` and `page_filter`:
diff --git a/tests/test_service.py b/tests/test_service.py
index ba21a4765..dd7a3cbe3 100644
--- a/tests/test_service.py
+++ b/tests/test_service.py
@@ -152,7 +152,6 @@ class TestRegistry:
# Assert that the included action was added to the registry
assert 'included_action' in registry_with_excludes.registry.actions
- @pytest.mark.asyncio
async def test_execute_action_with_and_without_browser_context(self):
"""
Test that the execute_action method correctly handles actions with and without a browser context.