Skip to content

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

Merge branch 'main' into docs

Nick Sweetingb8fb64224f91
diff --cc docs/customize/custom-functions.mdx
index c148a9a28,b29003b20..f4d59bb5f
--- a/docs/customize/custom-functions.mdx
+++ b/docs/customize/custom-functions.mdx
@@@ -68,12 -68,14 +68,13 @@@ def click_element(css_selector: str, pa
### Pydantic Model
-You can define a pydantic model for the parameters your action expects.
+You can define a pydantic model for the parameters your action expects by setting a `@controller.action(..., param_model=MyParams)`.
- This allows you to use optional parameters, default values, `Annotated[...]` types with custom validation, and other features offered by pydantic.
+ This allows you to use optional parameters, default values, `Annotated[...]` types with custom validation, field descriptions, and other features offered by pydantic.
-When the agent calls calls your agent function, an instance of your model
-with the values filled by the LLM will be passed as the first argument `params` to your action function.
+When the agent calls calls your agent function, an instance of your model with the values filled by the LLM will be passed as the argument named `params` to your action function.
Using a pydantic model is helpful because it allows more flexibility and power to enforce the schema of the values the LLM should provide.
-The LLM gets the entire pydantic JSON schema for your params, so it will see the action name & description + individual field names, types, descriptions, and default values.
++The LLM gets the entire pydantic JSON schema for your `param_model`, it will see the function name & description + individual field names, types, descriptions, and default values.
```python