Skip to main content

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 the Tool base class which provides schema registration and result handling:
Reference: backend/core/agentpress/tool.py:82-150

Tool Schemas

Tools define their interface using OpenAPI-compatible schemas:
Reference: backend/core/agentpress/tool.py:24-32

Tool Metadata

Tools include rich metadata for discovery and UI rendering:
Reference: 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:
Reference: backend/core/tools/tool_registry.py:4-9

Sandbox Tools

Tools for interacting with the sandboxed environment:
Reference: backend/core/tools/tool_registry.py:11-24

Search Tools

Tools for finding information on the web and in databases:
Reference: backend/core/tools/tool_registry.py:26-32

Utility Tools

Specialized tools for specific use cases:
Reference: backend/core/tools/tool_registry.py:34-40

Agent Builder Tools

Tools for creating and configuring agents:
Reference: 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

Reference: backend/core/jit/loader.py:42-109

Core Tools

Some tools are always loaded at startup:
Reference: backend/core/jit/loader.py:22-40

Dependency Resolution

JIT loading automatically handles tool dependencies:
Reference: backend/core/jit/loader.py:119-149

Tool Execution

Tool Results

All tools return standardized ToolResult objects:
Reference: 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:
Reference: backend/core/tools/mcp_tool_wrapper.py

Tool Registry

The tool registry manages all available tools:
Reference: backend/core/tools/tool_registry.py:59-68

Tool Discovery

Reference: 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:
Reference: 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:
Reference: backend/core/jit/loader.py:92

Parameter Detection

The JIT loader automatically detects required initialization parameters:
Reference: backend/core/jit/loader.py:85-87

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