Tool Development Guide

This section describes how to encapsulate your own capabilities as tools (Tools) that can be called by the Agent, and automatically trigger execution during conversations via LLM.


Objectives and Applicable Scenarios

Through tool development, you can enable the Agent to call local capabilities to complete specific tasks, such as:

  • Device control (DAQ, PLC, robotic arms)

  • File I/O and report generation

  • Data queries and calculations

  • Image processing and visual analysis

  • Device data analysis


Basic Tool Composition

A callable tool typically consists of two parts:

  1. VI file: Specific execution logic

  2. JSON description: Tool name, function description, parameter definitions, and other metadata

The LLM first reads the JSON description to determine whether to call, then passes parameters to the corresponding VI for execution.


Detailed Development Steps

Step 1: Create New VI File

Open LabVIEW, create a new VI, and write the tool logic. On the front panel, you must include a string output control named result, which is the standard exit for the Agent to retrieve tool execution results.

Example requirements (using "get date and time" as an example):

  • Output control name: result

  • Output type: String

  • Output content: Final result text of tool execution

Step 2: Save VI to Tool Directory

Save the VI in a separate subfolder under tools\basic_tools. It is recommended to have one folder per tool, and the folder should have the same name as the VI, with an all-English name without spaces. Example path: C:\Program Files\National Instruments\LabVIEW 2018\examples\VIRobotics\AI Agent\tools\basic_tools\get_date_and_time

Step 3: Generate Tool JSON

Generate the corresponding JSON description file for the current VI using the built-in editor in this toolkit:

Tools -> VIRobotics GenAI -> Agent_VI_Editor

Operation sequence:

  1. Open Agent_VI_Editor

  2. Load the written VI

  3. Enter VI description, parameter descriptions, and parameter comments

  4. Click "Generate JSON"

  5. Confirm the JSON file has been generated in the same directory as the VI


Debugging and Troubleshooting

Common issues:

  • Tool not triggered: Unclear description or incomplete parameter definitions; folder name does not match VI name

  • Tool triggered but execution failed: Incorrect VI input types or path configuration

  • Tool executed successfully but abnormal response: Tool result return format does not meet expectations

Recommendations:

  • Run VI locally first

  • Then verify tool calling in basic_call_tools.vi

  • Finally, do comprehensive verification in AI_Agent_Full.vi


Next Steps


Technical Support

If you encounter issues during use, please first consult the relevant sections or contact technical support: