API tools example: AI weather agent

AI agnets can communicate with any API endpoint you desire. Be it Zapier, The New York Times, Zendesk, your CRM, or any other platform with API accessibility – our Agents can connect seamlessly.

Unleash your creativity with natural language tools to retrieve the weather forecast, find the latest news articles, or even send an email to a friend! The possibilities are as broad as your imagination.

In this example, we’ll setup a city weather forecast AI agent that’ll utilize AccuWeather APIs to:

  1. Get the city’s location key from the user’s request via AccuWeather’s Location API request
  2. Use this location key to get the forecast for that city via AccuWeather’s Forecast API request

Setting up the API tool

  1. Go to “Training Center” then to the “API Tools” tab to create a new tool

  2. Give it a name and a description. Note that the description is used by the AI chatbot to understand when to use this tool, so be destrictive!

  3. AccuWeather’s Locations API require a ‘query’ parameter to lookup the city and return the location key, so let’s add a ‘query’ parameter in the “Parameters” tab. Enter “query” in the input field and click on the “Add Parameter” button

  4. In the “Description” field, describe in natural language how AI should understand what to expect, in this case we’ll enter “name of the city”. This is a required parameter for this tool so enable the “required parameter” toggle.

  5. In the “Action” tab, we’ll enter the API endpoint from AccuWeather’s Locations APIs (use your own apikey from AccuWeather if you’d like to use this endpoint):

  6. We’ll now add a new tool to utilize the location key received from the previous tool

  7. AccuWeather’s Forecast APIs require a ‘locationkey’ parameter, so let’s add that parameter for this tool

  8. Don’t forget to enter a description of what AI needs to expect. This is a required parameter for this tool so enable the “required parameter” toggle.

  9. Enter the AccuWeather’s Forecast API endpoint in the “Action” tab:

Setting up the AI Agent

  1. Create a new Chatbot, choose “AI Agent” type

  2. In the “Tools” tab, assign the tools we’ve created to this chatbot

  3. All done! Chatbot can now forecast weather on request