Weather Flow with Open Meteo API
This tutorial demonstrates how to build and test a Weather App using the Flow editor. The flow retrieves the actual weather information based on the location and number of days the user wants to look ahead.
After this tutorial you'll have learned how to:
Collect variables with an agent node
Configure an API call node to retrieve weather information
Configure an agent to converse about the weather.
Before you begin
Setup the connection to Open meteo using the Open Meteo REST API tutorial
Step 1: Configure the Flow settings
Sign in to ixHello Customer v2.
In the left navigation menu, go to Flows
Select Create flow to configure the flow settings.
Name
Weather App with Open Meteo
Description
Converse about the weather information retrieved from Open Meteo based on the location and time period the user provides, summarize the call before ending.
Persona. Text-to-Speech (TTS) language and voice
The language and voice for the app. Choose any one you desire.

Click Save to create the flow and continue to the flow editor.

Step 2: Add agent node that retrieves information
Let's add an agent node that's going to retrieve the location and number of days that's needed to invoke the Open Meteo Daily Method.
Add an Agent node to the canvas
Connect it to the start node.
Select the agent node to open the right sidebar

Step 3: Configure the agent details
Configure the following agent details. The system prompt explains what kind of agent it is, the task it needs to complete and sets some basic guards to prevent misuse.
Name
Collect city location and number of days
System prompt
You are an assistant that needs to retrieve a location, and number of days, from a user.
Start the conversation with the following message: Hi, I can tell you all about the weather forecast if you provide me with a city and the number of days you want to look ahead.
Use this city to determine the coordinates (latitude, longitude). Do not talk about the latitude and longitude to the user.
The number of days needs to be a positive number between 1 and 10. Round up or down when the provided number is out of this range.
You can't answer any other questions.
Memory identifier
empty
Iteration limit
empty
Single turn
Leave unchecked
Take initiative
Checked. This forces the agent to send the first message when the session starts.

Step 4: Configure the agent goal
This agent has a single goal, collecting the needed variable slots that are needed to execute the API call to retrieve actual weather information.
Select the Add goal field and enter the value collectedInfo. Press <enter> or click the + icon to add the goal. The collectedInfo goal is added to the agent.
Enter the goal description: The coordinates (latitude and longitude) for the city and the number of days
Select the Add slot field and enter the value lat. Press <enter> or click the + icon to add the goal. The lat slot is added to the agent.
Enter the slot description: The latitude of the city the user mentioned
Update the slot type to Number, since we're collecting a numeric value.
Slot is optional stays unchecked. This slot is required to reach the goal.
Select the Add slot field and enter the value lon. Press <enter> or click the + icon to add the goal. The lon slot is added to the agent.
Enter the slot description: The longitude of the city the user mentioned
Update the slot type to Number, since we're collecting a numeric value.
Slot is optional stays unchecked. This slot is required to reach the goal.
Select the Add slot field and enter the value days. Press <enter> or click the + icon to add the goal. The days slot is added to the agent.
Enter the slot description: Number of days
Update the slot type to Number, since we're collecting a numeric value.
Slot is optional stays unchecked. This slot is required to reach the goal.

Step 5: Add and configure the API Call node
Let's add an API call node that's going to retrieve the daily weather information based on the collected information that the Agent Node has retrieve.
Add an API call node to the canvas and connect it to the collectedInfo exit of the agent.
Open the API call node.
Configure the API: Open Meteo and Method: Daily Weather. The request and response section becomes available.
Configure the Request variables
latitude > lat
longitude > lon
days > days
Configure the request output prefix to daily_weather. On a successful API call the information is stored in the daily_weather_result variable. And can be used further in the flow.

Step 6: Add agent node that converses about the weather.
Let's add an agent node that's going to talk to the user about the actual weather information that is returned after and successful API call execution.
Add an Agent node to the canvas
Connect it to the API call node success exit.
Select the agent node to open the right sidebar

Step 7: Configure the agent details.
The goal of this agent is to answer any questions the user has about the weather until the user doesn't need any further information. To do this the agent needs to know what day it is, and get access to the information the API returned in the daily_weather_result variable.
Name
Weather agent
System prompt
You are a weather agent who can interpret and answer question about a weather forecast. Today is {today}.
Available data is provided as JSON:
{daily_weather_result}
Start by providing tomorrow's maximum and minimum temperature and ask if the user wants more information.
Answer additional questions about the provided data. Keep your answers brief as if you're talking to a person.
You can't answer any other questions and can only use the provided data.
Memory identifier
empty
Iteration limit
empty
Single turn
Leave unchecked
Take initiative
Checked. This forces the agent to send the first message.

Step 8: Configure the agent goal
This weather agent has a single goal, to continue talking to the user until they mention they don't need any additional information.
Select the Add goal field and enter the value end. Press <enter> or click the + icon to add the goal. The end goal is added to the agent.
Enter the goal description: use this goal if the user has no more questions

Step 9: Add and configure a Say node on a failed API call
Let's configure the behavior when the Daily Weather API call fails.
Add a say node to the canvas and connect it to the Failure exit of the API call node.
Open the Say node
Configure the following message: Sorry, we're unable to retrieve the weather forecast at this time. Please try again at a later time.

Step 10: add an end node to complete the flow
Add an end node to the canvas.
Connect it to the Say node
Connect it to the End exit of the Weather agent.
Save the flow. The state switches from invalid to valid and is ready to be tested.

Step 11: Test and tweak the Weather flow
Click the Test button in the top right corner and try out your Weather app!

The agent returns technical information in the second chat message ...Please provide a positive number between 1 and 10. Try to tune the system prompt to improve the behavior.
Last updated
Was this helpful?