Skip to main content

Creating the tools

A tool is a function that an agent can use to carry out actions like calling external APIs or looking up information in a data source, as part of following the instructions defined in the prompt. We’ll need two tools: one to give it access to our data source with the general weather information, and one to give the weather agent the ability to query the Open-Meteo API for real-time weather data. We’ll create the former first.
Before we create the tools, we need to create a service to which we can link them. You can use the sample code below.
Note the ID of your service. Now we’ll create a tool to access the data source.
This tool will query Helix, Syllable’s document management and search service, for an answer to the user’s question, using the tutorial_weather_facts data source that we created as its knowledge base.
  • The “endpoint” object gives the agent details on what API endpoint to call and how to pass the parameters (in the body of a POST request).
  • The “tool” object includes a description of the tool, which should be written as instructions to the agent regarding what the tool does. It also includes a “parameters” object, which describes the various parameters that the agent should gather from the user’s input and send to the API endpoint in the “endpoint” object.
  • The “static parameters” object also describes parameters that should be sent to the API, but are predetermined at configuration time, rather than gathered by the agent from the user’s input.
Now we’ll create our second tool, to call the Open-Meteo API.

Updating prompt to access tools

Now that we have our two tools, we can make them available to the prompt that we created earlier, so that any agents using that prompt will have access to the tools. We can use the prompts update function to accomplish this.
We have one more step before we’re able to create the agent, and that’s to add a greeting message for the agent to deliver to the user at the beginning of a conversation. Click “Create a message” below to continue the tutorial.

📚 Documentation References