Overview
Tools are the building blocks that give agents the ability to interact with external systems, execute code, search the web, and perform specialized tasks. The platform provides a flexible tool system that supports both built-in tools and external integrations via MCP (Model Context Protocol).Tool Architecture
Base Tool Class
All tools inherit from theTool base class which provides schema registration and result handling:
backend/core/agentpress/tool.py:82-150
Tool Schemas
Tools define their interface using OpenAPI-compatible schemas:backend/core/agentpress/tool.py:24-32
Tool Metadata
Tools include rich metadata for discovery and UI rendering:backend/core/agentpress/tool.py:45-65
Tool Categories
The platform organizes tools into logical categories:Core Tools
Essential tools for agent communication and task management:backend/core/tools/tool_registry.py:4-9
Sandbox Tools
Tools for interacting with the sandboxed environment:backend/core/tools/tool_registry.py:11-24
Search Tools
Tools for finding information on the web and in databases:backend/core/tools/tool_registry.py:26-32
Utility Tools
Specialized tools for specific use cases:backend/core/tools/tool_registry.py:34-40
Agent Builder Tools
Tools for creating and configuring agents:backend/core/tools/tool_registry.py:42-48
Just-In-Time (JIT) Tool Loading
The platform uses JIT loading to minimize startup time and memory usage. Tools are only loaded when first needed.JIT Loader
backend/core/jit/loader.py:42-109
Core Tools
Some tools are always loaded at startup:backend/core/jit/loader.py:22-40
Dependency Resolution
JIT loading automatically handles tool dependencies:backend/core/jit/loader.py:119-149
Tool Execution
Tool Results
All tools return standardizedToolResult objects:
backend/core/agentpress/tool.py:35-43
Error Handling
Tools should handle errors gracefully:MCP Tool Integration
The platform supports external tools via Model Context Protocol (MCP). See MCP Concepts for details.MCP Tool Wrapper
MCP tools are wrapped to provide a consistent interface:backend/core/tools/mcp_tool_wrapper.py
Tool Registry
The tool registry manages all available tools:backend/core/tools/tool_registry.py:59-68
Tool Discovery
backend/core/tools/tool_registry.py:71-137
Tool Configuration
Agents configure which tools are available:JIT Configuration
JIT loading can be restricted by configuration:backend/core/jit/config.py
Tool Output Streaming
Tools can stream their output in real-time:Performance Considerations
Lazy Loading
Tools are imported only when needed:Caching
Tool schemas are cached to avoid repeated generation:backend/core/jit/loader.py:92
Parameter Detection
The JIT loader automatically detects required initialization parameters:backend/core/jit/loader.py:85-87
Related Concepts
Agents
Learn about agents that use tools
MCP
Explore external tool integrations via MCP
Sandboxes
Understand where sandbox tools execute
Threads
See how tools are used in conversations