Skip to main content

Tools

Tools are a mechanism that allows LLMs to dynamically call actions during their execution. Instead of having fixed, pre-defined actions, tools give LLMs the ability to decide which actions to call based on the context and their reasoning.

What is a Tool?

A tool defines:
  • An action that an LLM can choose to call
  • When and how the LLM can use that action
  • Input parameters the LLM should provide
  • The expected output format and usage

Bot Invocation

Allow LLMs to call other bots dynamically

Memory Operations

Enable LLMs to search and store memories as needed

Web Research

Let LLMs search the web and parse content

Code Execution

Allow LLMs to run code when needed

Tool Definition

Basic Tool Structure

from erdo import Tool

# Tool for bot invocation
bot_tool = Tool(
    name="invoke_specialist_bot",
    description="Call a specialist bot for specific analysis tasks",
    actiontype="bot.ask",
    parameters={
        "bot_name": "{{bot_name}}",
        "question": "{{question}}",
        "context": "{{context}}"
    }
)

# Tool for memory search
memory_tool = Tool(
    name="search_knowledge",
    description="Search stored knowledge and memories",
    actiontype="memory.search",
    parameters={
        "query": "{{search_query}}",
        "limit": 5,
        "tags": "{{relevant_tags}}"
    }
)

Using Tools in LLM Actions

Tools are provided to LLM actions to expand their capabilities:
from erdo.actions import llm
from erdo import Tool

# LLM action with multiple tools available
analyst_action = llm.message(
    model="claude-sonnet-4",
    query="Analyze this data and provide insights: {{data}}",
    tools=[
        Tool(
            name="search_similar_analysis",
            description="Search for similar previous analyses",
            actiontype="memory.search",
            parameters={
                "query": "{{query}}",
                "memory_types": ["analysis", "insights"]
            }
        ),
        Tool(
            name="invoke_data_specialist",
            description="Get expert analysis from data specialist bot",
            actiontype="bot.ask",
            parameters={
                "bot_name": "data-analyst",
                "question": "{{question}}"
            }
        ),
        Tool(
            name="run_calculations",
            description="Execute code for complex calculations",
            actiontype="codeexec.execute",
            parameters={
                "code": "{{python_code}}"
            }
        )
    ]
)

Common Tool Patterns

Bot Invocation Tools

Allow LLMs to call specialist bots:
# Security analysis tool
security_tool = Tool(
    name="security_check",
    description="Analyze code or systems for security vulnerabilities",
    actiontype="bot.ask",
    parameters={
        "bot_name": "security-checker",
        "question": "{{security_question}}",
        "code_or_config": "{{target_content}}"
    }
)

# Data analysis tool
data_tool = Tool(
    name="analyze_data",
    description="Perform statistical analysis on datasets",
    actiontype="bot.ask",
    parameters={
        "bot_name": "data-analyst",
        "question": "{{analysis_question}}",
        "dataset": "{{data}}"
    }
)

Memory Tools

Enable LLMs to interact with memory:
# Memory search tool
search_memory = Tool(
    name="search_knowledge_base",
    description="Search for relevant information in memory",
    actiontype="memory.search",
    parameters={
        "query": "{{search_term}}",
        "limit": 10,
        "tags": "{{filter_tags}}"
    }
)

# Memory storage tool
store_memory = Tool(
    name="save_insight",
    description="Store important insights for future reference",
    actiontype="memory.store",
    parameters={
        "content": "{{insight_content}}",
        "description": "{{insight_description}}",
        "tags": "{{insight_tags}}"
    }
)

Research Tools

Web search and content parsing:
# Web search tool
web_search = Tool(
    name="search_web",
    description="Search the internet for current information",
    actiontype="websearch.search",
    parameters={
        "query": "{{search_query}}",
        "num_results": "{{result_count}}"
    }
)

# Content parsing tool
parse_content = Tool(
    name="parse_webpage",
    description="Extract and analyze content from web pages",
    actiontype="webparser.parse",
    parameters={
        "url": "{{page_url}}",
        "extract_format": "markdown"
    }
)

Code Execution Tools

Allow LLMs to run code dynamically:
# Python execution tool
python_tool = Tool(
    name="execute_python",
    description="Run Python code for calculations and data processing",
    actiontype="codeexec.execute",
    parameters={
        "code": "{{python_code}}",
        "requirements": "{{pip_packages}}"
    }
)

# Data analysis tool
analysis_tool = Tool(
    name="analyze_dataset",
    description="Perform statistical analysis on data",
    actiontype="codeexec.execute",
    parameters={
        "code": """
import pandas as pd
import numpy as np

# Load and analyze data
data = {{dataset}}
df = pd.DataFrame(data)

# Perform analysis
{{analysis_code}}
"""
    }
)

Tool Selection by LLMs

How LLMs Choose Tools

LLMs select tools based on:
  1. Tool descriptions - Clear, specific descriptions help LLMs choose correctly
  2. Context relevance - LLMs match tools to the current task
  3. Parameter requirements - LLMs consider what information they have available
  4. Expected outcomes - LLMs choose tools that will help achieve their goals

Example Tool Selection

# Research workflow with multiple tool options
research_action = llm.message(
    model="claude-sonnet-4",
    query="Research and analyze the latest trends in {{industry}}",
    tools=[
        Tool(
            name="search_recent_news",
            description="Find recent news and articles about the industry",
            actiontype="websearch.search",
            parameters={"query": "{{search_terms}}"}
        ),
        Tool(
            name="check_past_research",
            description="Look for previous research we've done on this topic",
            actiontype="memory.search",
            parameters={"query": "{{research_topic}}"}
        ),
        Tool(
            name="get_expert_analysis",
            description="Get analysis from our industry expert bot",
            actiontype="bot.ask",
            parameters={
                "bot_name": "industry-analyst",
                "question": "{{expert_question}}"
            }
        ),
        Tool(
            name="analyze_data_trends",
            description="Analyze numerical data and identify trends",
            actiontype="codeexec.execute",
            parameters={"code": "{{analysis_code}}"}
        )
    ]
)

Tool Composition

Chaining Tool Calls

LLMs can use multiple tools in sequence:
# Multi-step research tool
comprehensive_research = Tool(
    name="comprehensive_research",
    description="Perform thorough research using multiple sources",
    actiontype="llm.message",
    parameters={
        "model": "claude-sonnet-4",
        "query": "Research {{topic}} thoroughly",
        "tools": [
            # First search for current information
            {"actiontype": "websearch.search", "query": "{{topic}} 2024"},
            # Then check our existing knowledge
            {"actiontype": "memory.search", "query": "{{topic}}"},
            # Finally get expert perspective
            {"actiontype": "bot.ask", "bot_name": "research-analyst"}
        ]
    }
)

Best Practices

Be Specific: Clearly describe what the tool does and when to use itInclude Context: Explain the expected input and outputUse Examples: Show parameter formats and usage patternsAvoid Ambiguity: Make tool purposes distinct and non-overlapping
Clear Parameters: Use descriptive parameter namesFlexible Inputs: Allow LLMs to provide parameters in natural waysValidation: Validate parameters to prevent errorsDocumentation: Document expected parameter formats
Logical Grouping: Provide related tools togetherAppropriate Scope: Don’t overwhelm LLMs with too many optionsClear Boundaries: Make tool purposes distinctFallback Options: Provide alternative tools for similar tasks
Efficient Actions: Ensure underlying actions perform wellError Handling: Handle tool failures gracefullyTimeout Management: Set appropriate timeoutsResource Limits: Manage computational resources

Tool Categories

Bot Interactions

Invoke specialist bots, ask questions, chain bot workflows

Memory Operations

Search knowledge, store insights, manage organizational memory

Research & Analysis

Web search, content parsing, data analysis, trend identification

Code & Computation

Execute code, perform calculations, process data, generate reports
Tools empower LLMs to be more than just text generators - they become intelligent agents that can dynamically choose the right actions to accomplish complex tasks.