Overview
Agentor provides multiple ways to create tools that agents can use to interact with external systems, APIs, and data sources. Tools enable agents to perform actions beyond text generation.
The @tool decorator creates dual-mode tools usable by both Agentor agents and the LLM client.
Signature:
Parameters:
name (str): Optional custom tool name (defaults to function name)
description (str): Optional description (defaults to docstring)
Example with custom name:
The @function_tool decorator creates tools compatible with the OpenAI function calling format.
Parameters:
name_override (str): Optional custom name for the tool
strict_mode (bool): Enable strict parameter validation (default: True)
Example:
BaseTool is the base class for creating custom tools with multiple capabilities.
Basic Usage
Class Definition
Methods
list_capabilities
List all capabilities of the tool.
Returns: List of (name, function) tuples for all capabilities
to_openai_function
Convert all capabilities to OpenAI-compatible FunctionTools.
Returns: List of FunctionTool objects
json_schema
Convert all capabilities to JSON Schema format.
Returns: List of tool schemas
serve
Serve the tool as an MCP (Model Context Protocol) server.
Parameters:
name (str): Optional server name (defaults to tool name)
port (int): Port to serve on (default: 8000)
Example:
from_function
Create a BaseTool from a standalone function.
Example:
@capability Decorator
Mark a method as a tool capability that agents can invoke.
Tools can be registered and referenced by string name:
MCP Servers
Agentor includes several built-in tools:
Best Practices
- Clear Descriptions: Always provide clear docstrings - they become tool descriptions for the LLM
- Type Hints: Use type hints for all parameters and return values
- Error Handling: Handle errors gracefully within tool functions
- Focused Tools: Keep tools focused on specific tasks
- Idempotent Operations: Make tools safe to retry when possible
- Documentation: Document expected inputs and outputs
- Agentor - Using tools with agents
- LLM - Direct LLM usage with tools
Last modified on May 5, 2026