Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
clarify docs that Field descriptions are included in LLM action prompts
Nick Sweeting126bdaec5868
diff --git a/docs/customize/custom-functions.mdx b/docs/customize/custom-functions.mdxindex 793b8bea1..b29003b20 100644--- a/docs/customize/custom-functions.mdx+++ b/docs/customize/custom-functions.mdx@@ -43,7 +43,7 @@ agent = Agent(<Note>Keep your action function names and descriptions short and concise:- The LLM chooses between actions to run solely based on the function name and description- - The LLM decides how to fill the action params based on the argument names and type hints+ - The LLM decides how to fill action params based on their names, type hints, & defaults</Note>---@@ -69,12 +69,13 @@ def click_element(css_selector: str, page: Page) -> ActionResult:### Pydantic ModelYou can define a pydantic model for the parameters your action expects.-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 modelwith the values filled by the LLM will be passed as the first argument `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.```python@@ -86,6 +87,7 @@ class MyParams(BaseModel):field1: intfield2: str = 'default value'field3: Annotated[str, AfterValidator(lambda s: s.lower())] # example: enforce always lowercase+ field4: str = Field(default='abc', description='Detailed description for the LLM')@controller.action('My action', param_model=MyParams)def my_action(params: MyParams, page: Page) -> ActionResult: