Skip to main content

Quick Example

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,
)
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.
Use browser_session parameter in tools for deterministic Actor actions.