Skip to main content

Overview

Agentor provides a flexible tool system that allows agents to interact with external APIs, databases, and services. Tools can be registered globally, created as reusable classes, or defined inline.

Tool Types

Agentor supports multiple tool formats:
  1. Function Tools - Decorated Python functions
  2. BaseTool Classes - Reusable tool classes with multiple capabilities
  3. String References - Tools registered in the global registry
  4. MCP Servers - External Model Context Protocol servers

Function Tools

Create simple tools using the @function_tool decorator:

Type Hints and Descriptions

The decorator automatically generates JSON schemas from type hints and docstrings. The LLM sees:

Tool Registry

Register tools globally for reuse across agents (src/agentor/tools/registry.py:23):
Use registered tools by name:

Built-in Tools

Agentor includes these built-in tools in the registry:
  • get_weather - Weather information (src/agentor/tools/registry.py:33)
  • current_datetime - Current date and time (src/agentor/tools/registry.py:43)
List available tools:

BaseTool Class

Create reusable tool classes with multiple capabilities (src/agentor/tools/base.py:18):

Capability Decorator

The @capability decorator (src/agentor/tools/base.py:12) marks methods as agent-callable tools:
Each capability becomes a separate tool for the LLM.

Dynamic Tools from Functions

Create a tool from any function (src/agentor/tools/base.py:100):

Serving Tools as MCP Servers

Serve any BaseTool as a standalone MCP server (src/agentor/tools/base.py:73):
This automatically:
  1. Creates a LiteMCP server
  2. Registers all @capability methods as MCP tools
  3. Serves at http://0.0.0.0:8000/mcp

Built-in Tool Implementations

Agentor includes production-ready tools in src/agentor/tools/:

Weather Tool

GitHub Tool

Gmail Tool

Shell Tool

Shell tools can execute arbitrary commands. Use with caution and proper sandboxing.

Tool JSON Schema

Convert tools to JSON schema for documentation (src/agentor/tools/base.py:58):
Output:

Tool Search API

Reduce context bloat with semantic tool search:
This returns only relevant tools based on the query, reducing token usage.

Error Handling

Handle tool errors gracefully:
The agent receives the error message and can adjust its strategy.

Tool Context and Authentication

Tools receive context with API keys and configuration (src/agentor/tools/registry.py:15):
Tools access this context:

OpenAI Function Conversion

All tools automatically convert to OpenAI function format (src/agentor/tools/base.py:46):

Next Steps

MCP Integration

Connect external MCP servers as tools

Skills System

Combine tools with contextual instructions

Tool search

Use semantic search to reduce context size
Last modified on May 5, 2026