Custom Tools
Register custom tools that agents can invoke during task execution.
Getting Started By Browser Use
The Idea
Browser Use comes with powerful built-in actions for web automation, but what if you need domain-specific functionality?
The tools template shows you how to extend agent capabilities by registering a custom save_to_file tool.
Requirements
You'll need one API Key:
- Browser Use
Get your Browser Use API Key here
Installation
uvx browser-use init --template tools
Customization
Build your own custom tools by following these steps:
- Create a Tools Registry - Initialize a
Tools()instance to manage custom actions - Define Custom Actions - Use the
@tools.registry.action()decorator to register functions - Return Action Results - Provide feedback to the agent with
ActionResultobjects - Pass to Agent - Integrate your custom tools when initializing the Agent
In the end, this comes down to a few lines of code, like:
tools = Tools()
@tools.registry.action('my_function')
async def my_function(filename: str, content: str):
# Do Something
return ActionResult(extracted_content="...")
agent = Agent(task=task, llm=llm, tools=tools)