Tool Calling Agent#
Agents are a major use-case for language models. Agents are systems that use LLMs to determine what actions to take and what inputs to use for those actions. Some LLMs support Tool Calling / Function Calling, and can be used for Tool Calling Agents.
Features#
Pre-built Tools: Leverages core library agent and tools.
Tool Calling / Function calling Agent: Leverages tool / function input schema to appropriately route to the correct tool
Custom Plugin System: Developers can bring in new tools using plugins.
Agentic Workflows: Fully configurable via YAML for flexibility and productivity.
Ease of Use: Simplifies developer experience and deployment.
Configuration#
The Tool Calling Agent may be utilized as a Workflow or a Function.
Example config.yml
#
In your YAML file, to use the Tool Calling Agent as a workflow:
workflow:
_type: tool_calling_agent
tool_names: [wikipedia_search, current_datetime, code_generation]
llm_name: nim_llm
verbose: true
handle_tool_errors: true
In your YAML file, to use the Tool Calling Agent as a function:
functions:
calculator_multiply:
_type: calculator_multiply
calculator_inequality:
_type: calculator_inequality
calculator_divide:
_type: aiq_simple_calculator/calculator_divide
math_agent:
_type: tool_calling_agent
tool_names:
- calculator_multiply
- calculator_inequality
- calculator_divide
llm_name: agent_llm
verbose: true
handle_tool_errors: true
description: 'Useful for performing simple mathematical calculations.'
Configurable Options#
-
tool_names
: A list of tools that the agent can call. The tools must be functions configured in the YAML file -
llm_name
: The LLM the agent should use. The LLM must be configured in the YAML file -
verbose
: Defaults to False (useful to prevent logging of sensitive data). If set to True, the Agent will log input, output, and intermediate steps. -
handle_tool_errors
: Defaults to True. All tool errors will be caught and a ToolMessage with an error message will be returned, so the Tool Calling Agent can try again. -
max_iterations
: Defaults to 15. The maximum number of tool calls the Agent may perform. -
description
: Defaults to “Tool Calling Agent Workflow”. When the Tool Calling Agent is configured as a function, this config option allows us to control the tool description (for example, when used as a tool within another agent).
How a Tool-Calling Agent Works#
A Tool-Calling Agent is an AI system that directly invokes external tools based on structured function definitions. Unlike ReAct agents, it does not reason between steps but instead relies on predefined tool schemas to decide which tool to call. To decide which tool(s) to use to answer the question, the Tool Calling Agent utilizes its tools’ name, description, and input parameter schema.
Step-by-Step Breakdown of a Tool-Calling Agent#
User Query – The agent receives an input or problem to solve.
Function Matching – The agent determines the best tool to call based on the input.
Tool Execution – The agent calls the tool with the necessary parameters.
Response Handling – The tool returns a structured response, which the agent passes to the user.
Example Walkthrough#
Imagine a tool-calling agent needs to answer:
“What’s the current weather in New York?”
Single Step Execution#
User Query: “What’s the current weather in New York?”
Function Matching: The agent identifies the
get_weather(location)
tool.Tool Execution: Calls
get_weather("New York")
.Response Handling: The tool returns
72°F, clear skies
, and the agent directly provides the answer.
Since tool-calling agents execute function calls directly, they are more efficient for structured tasks that don’t require intermediate reasoning.
Limitations#
- Requires an LLM that supports tool calling or function calling.
- Does not perform complex reasoning and decision-making between tool calls.
- Since it uses the tool name, description, and input parameters, it requires well-named input parameters for each tool.