In this post I will be constructing an AI Agent to help the user make flight reservations. I have got a lot of information and various starter Workflows from a great blog post by Rosaria Silipo and Patricia Bacelar (here is the link).
Basically what we are going to do is get some input from our User, pass this input to a LLM and get an answer. What is 'special' here, is that instead of having the LLM only rely on its internal knowledge, we will also instruct it to access a set of tools WE will create to help it answer specific questions.
As a first step, I will show you a workflow that allows you to test out the tools you will create (we will see this later on)
I will quickly go over the nodes in this workflow here:
In the first block, we will authenticate ourselves and select the LLM we are going to use. In this case gpt-40-mini from OpenAI.
This model is free for use (with a limited amount of tokens). All you have to do is create an API key here. Copy this key and paste it into the 'password' field of the Credentials Configuration node.
The two nodes under the 'Tool list' heading retrieve all the files (workflows) in the 'Tools' folder, relative to the folder our workflow is in, and convert them into possible Tools for the LLM to use.
Below I have copied the output of the 'Workflow to tool' node. It shows all the tools that were discovered in the folder indicated by the previous node. The tool tha interests us for now is the 'Airport lookup' tool, which we will develop on the next page.
IMPORTANT: Notice the icon next to the tool name in the red area on the screenshot. This indicates that the Workflow to Tool node has successfully retrieved the description of our tool. In case this icon is crossed out, the LLM will not be able to use this tool. The most likely cause is that you forgot to put in the tool description correctly.
The next node in our workflow is the Agent Prompter. As you see from the comment, this does quite a lot of things.
Below is a screenshot of its configuration dialog. The System message and User message are the instructions (the prompt) for the LLM
System message: ## TOOL CALLING
If you are not sure about file content or codebase structure pertaining to
the user's request, use your tools to read files and gather the relevant
information: do NOT guess or make up an answer.
User message: Find the airport name of the airport with IATA code BRU
Use the tool descriptions provided to choose the most suitable ones. If no tool is appropriate or available, respond with a polite apology.
Avoid including any unnecessary details not directly relevant to solving the user's issue.
The system message is generic and should usually not be changed.
The user message is case-specific. As in this case we want to test if the Airport lookup tool is called and working correctly, we ask the prompt to find the airport name for IATA code BRU.
We will now execute the Agent Prompter node. Below you can see its output:
This looks good! From the conversation, we can see the LLM correctly called the Airport lookup Tool and passed the IATA code BRU as a parameter.
And finally, below you can see the output of the View Agent Conversation node. Looks OK .
On the next page , we will see how to develop the Airport Lookup tool.