Back to CourseLesson 6 of 12

Multi-Tool Agents

Real-world agents rarely rely on a single tool. A capable agent combines search tools for gathering information, compute tools for processing data, and action tools for producing outputs. This lesson covers how to register, organize, and optimize agents with multiple tools.

Registering Multiple Tools

CoFounder agents accept an array of tools. You can define them inline or import them from separate modules for better organization:

import { createAgent } from '@waymakerai/aicofounder-core';
import { searchTool } from './tools/search';
import { calculatorTool } from './tools/calculator';
import { emailTool } from './tools/email';
import { databaseTool } from './tools/database';
import { chartTool } from './tools/chart';

const agent = createAgent({
  name: 'multi-tool-agent',
  model: 'gpt-4o',
  systemPrompt: `You are a business analyst assistant. You can:
- Search the web for market data
- Query internal databases for company metrics
- Perform calculations and analysis
- Generate charts from data
- Send email reports to stakeholders

Always verify data from multiple sources before making claims.`,
  tools: [searchTool, calculatorTool, emailTool, databaseTool, chartTool],
});

Tool Selection Strategies

When an agent has many tools, the LLM must decide which one to use. The quality of this decision depends on how well you describe each tool. Follow these guidelines:

  • Distinct names -- Each tool name should clearly indicate its purpose. Avoid generic names like helper or process.
  • Detailed descriptions -- Explain when to use the tool and when not to. Include examples of good queries.
  • Non-overlapping scope -- If two tools do similar things, explain the difference in their descriptions.
// Bad: vague, overlapping descriptions
const badTools = [
  { name: 'search', description: 'Search for things' },
  { name: 'lookup', description: 'Look up information' },
];

// Good: specific, distinct descriptions
const goodTools = [
  {
    name: 'web_search',
    description: 'Search the public web for current information, news, and general knowledge. Use this for questions about recent events or public data.',
  },
  {
    name: 'internal_db_lookup',
    description: 'Query the internal company database for employee records, sales data, and inventory. Use this for company-specific questions. NOT for public information.',
  },
];

Tool Categories and Priority

CoFounder lets you organize tools into categories and assign priorities. This helps the agent prefer cheaper or faster tools when they can accomplish the task:

import { createAgent, ToolCategory } from '@waymakerai/aicofounder-core';

const agent = createAgent({
  name: 'prioritized-agent',
  model: 'gpt-4o',
  tools: [
    { ...cacheLookupTool, category: ToolCategory.RETRIEVAL, priority: 1 },
    { ...databaseTool, category: ToolCategory.RETRIEVAL, priority: 2 },
    { ...webSearchTool, category: ToolCategory.RETRIEVAL, priority: 3 },
    { ...calculatorTool, category: ToolCategory.COMPUTE, priority: 1 },
    { ...emailTool, category: ToolCategory.ACTION, priority: 1 },
  ],
  systemPrompt: `When retrieving information, try the cache first,
then the database, and only use web search as a last resort.`,
});

Combining Search, Compute, and Action Tools

The most powerful agents combine three types of tools:

  • Search tools -- Gather data from external sources (web search, database queries, API calls).
  • Compute tools -- Process and analyze data (calculations, data transformations, chart generation).
  • Action tools -- Produce side effects (send emails, create records, trigger workflows).

A well-designed system prompt guides the agent to use these in the right order: gather data first, analyze it, then take action only when confident in the results.

Managing Tool Count

More tools give agents more capabilities, but too many tools degrade performance. Each tool definition consumes tokens in the context window, and too many options can confuse the model. As a guideline:

  • Keep to 10-15 tools maximum per agent.
  • If you need more, use an orchestrator pattern (covered in Lesson 7) to delegate to specialized sub-agents.
  • Use the toolFilter option to dynamically show only relevant tools based on context.