Introduction
Kortix features a powerful and extensible tool system that enables AI agents to interact with external services, execute commands, manipulate files, and integrate with third-party platforms. The tool system is built on a modular architecture that supports three types of tools:- Built-in Tools - Core tools that ship with Kortix
- MCP Integrations - Tools from Model Context Protocol servers
- Custom Tools - User-defined tools for specific workflows
Architecture
Core Components
The tool system is built on several key components defined incore/agentpress/tool.py:
Tool Base Class
All tools inherit from the abstractTool base class:
Tool Schema Types
Tools use OpenAPI schemas to define their interface:Tool Results
All tool executions return a standardizedToolResult:
Tool Metadata System
Kortix uses decorators to attach metadata to tools and methods:Tool-Level Metadata
display_name- Human-readable tool namedescription- Short tool descriptionicon- UI icon identifiercolor- UI color stylingis_core- Whether tool is always enabledweight- Sort priority (lower = higher priority)visible- Whether shown in UIusage_guide- Detailed documentation loaded on-demand
Method-Level Metadata
Tool Registry
Thetool_registry.py module organizes all built-in tools into categories:
Tool Categories
Core Tools
Essential tools for agent communication and task management:- Message Tool - User communication
- Task List Tool - Task tracking
- Expand Message Tool - Message expansion
- Git Sync Tool - Git operations
Sandbox Tools
Tools for interacting with the execution environment:- Shell Tool - Execute bash commands
- Files Tool - File operations (create, edit, delete)
- File Reader Tool - Read file contents
- Vision Tool - Image analysis
- Canvas Tool - Visual canvas operations
- Spreadsheet Tool - Spreadsheet manipulation
- Presentation Tool - Presentation creation
Search Tools
Tools for information retrieval:- Web Search Tool - Search the internet
- Image Search Tool - Find images
- People Search Tool - Search for people
- Company Search Tool - Company information
- Paper Search Tool - Academic papers
Utility Tools
Specialized utility tools:- Browser Tool - Web scraping and browsing
- Vapi Voice Tool - Voice interactions
- Reality Defender Tool - Deepfake detection
- Apify Tool - Web automation
- Composio Upload Tool - File uploads for Composio
Agent Builder Tools
Tools for creating and managing agents:- Agent Config Tool - Configure agents
- Agent Creation Tool - Create new agents
- MCP Search Tool - Search MCP servers
- Credential Profile Tool - Manage credentials
- Trigger Tool - Configure triggers
Just-In-Time (JIT) Loading
Kortix uses a JIT loading system to optimize tool initialization:- Faster agent startup times
- Reduced memory footprint
- Dynamic tool discovery
- Automatic dependency resolution
Tool Execution Flow
- Tool Call - Agent decides to use a tool based on available schemas
- JIT Activation - Tool is loaded if not already active
- Schema Validation - Parameters validated against OpenAPI schema
- Execution - Tool method executed with validated parameters
- Result -
ToolResultreturned with success status and output
Helper Methods
TheTool base class provides convenient response methods:
Best Practices
Creating Tools
- Always inherit from
Toolbase class - Use
@tool_metadatadecorator with comprehensive information - Define methods with
@openapi_schemadecorator - Return
ToolResultfrom all tool methods - Include detailed
usage_guidefor complex tools
Schema Design
- Use clear, descriptive parameter names
- Provide detailed descriptions for each parameter
- Mark required vs optional parameters explicitly
- Set appropriate parameter types and constraints
- Include examples in descriptions
Error Handling
- Always catch exceptions and return
fail_response - Provide informative error messages
- Log errors for debugging
- Validate inputs before processing
Next Steps
- Built-in Tools - Explore all built-in tools
- MCP Integration - Connect external MCP servers
- Custom Tools - Create your own tools
- Composio Integration - Integrate with Composio platform