Quick Start
Create a simple tool using the@function_tool decorator:
Tool Creation Methods
Function Tools
The simplest way to create tools is with decorated functions:- Function name becomes the tool name
- Docstring becomes the tool description (helps the LLM understand when to use it)
- Type hints are required for parameters
- Return type should be
stror JSON-serializable
BaseTool Classes
For more complex tools with multiple capabilities:Dynamic Tools with from_function
Create tools dynamically from any function:Using Built-in Tools
Two built-in tools can be referenced by string name:get_weather— current weather for a city. NeedsWEATHER_API_KEYcurrent_datetime— the current date and time
Provider-hosted tools such as web search are not supported. Agentor runs its own agent loop, so a tool whose body lives on the provider has nothing to invoke. Write a function tool that calls a search API instead.
Real-World Tool Examples
API Integration Tool
Database Tool
File Operations Tool
Tool Best Practices
Serving Tools as MCP Servers
You can serve any BaseTool as an MCP server:Next Steps
- Learn about building MCP servers for tool sharing
- Add streaming support to see tool calls in real-time
- Serve an agent that uses your tools
