Skip to main content

Understanding Tool Types

UnifAI offers different ways to access and use tools in your agents. You can choose between dynamic discovery, static toolkits, or specific static actions based on your application's needs.

Dynamic Tools

Dynamic tools allow your agent to discover and use tools on-the-fly based on the context. This is the default behavior.

import { Tools } from 'unifai-sdk';

// Dynamic tools enabled by default
const tools = new Tools({ apiKey: 'YOUR_AGENT_API_KEY' });

// Or explicitly enable dynamic tools
const dynamicTools = await tools.getTools({ dynamicTools: true });

Benefits of dynamic tools:

  • Automatic discovery of relevant tools based on context
  • Access to the full UnifAI tool ecosystem
  • Tools are filtered to match the current user query
  • New tools become available without code changes

Static Toolkits

Static toolkits give you more control by specifying entire toolkits to be made available to your agent.

// Get tools from specific toolkits
const toolkitTools = await tools.getTools({
dynamicTools: false, // Optional: disable dynamic tools
staticToolkits: ["toolkit_id_1", "toolkit_id_2"]
});

Benefits of static toolkits:

  • Predictable set of available tools
  • Reduced latency (no tool discovery needed)
  • Full control over which toolkits your agent can access

Static Actions

Static actions provide the most granular control, allowing you to specify individual actions (tools).

// Get specific actions
const actionTools = await tools.getTools({
dynamicTools: false, // Optional: disable dynamic tools
staticActions: ["action_id_1", "action_id_2"]
});

Benefits of static actions:

  • Maximum control over individual tools
  • Minimal set of tools for specialized agents
  • Ability to combine specific actions from different toolkits

Combining Approaches

You can combine these approaches to create a customized tool setup:

// Combine dynamic and static tools
const combinedTools = await tools.getTools({
dynamicTools: true, // Enable dynamic discovery
staticToolkits: ["essential_toolkit_id"], // Always include this toolkit
staticActions: ["critical_action_id"] // Always include this specific action
});

This approach gives you the flexibility of dynamic discovery while ensuring that certain critical tools are always available to your agent.

Caching Behavior

You can control the caching behavior of tool results:

// Enable cache control
const toolsWithCache = await tools.getTools({ cacheControl: true });

When cache control is enabled, the LLM provider will treat tool results as ephemeral content that shouldn't be stored long-term.