# Weather Flow with Open Meteo API

This tutorial demonstrates how to build and test a Weather App using the [Flow editor](https://docs.ixhello.com/ixhc2/flows/flow-editor). The flow retrieves the actual weather information based on the **location** and **number of days** the user wants to look ahead.&#x20;

After this tutorial you'll have learned how to:&#x20;

* 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&#x20;

1. Setup the connection to Open meteo using the [Open Meteo REST API tutorial](https://docs.ixhello.com/ixhc2/general/tutorials/configure-open-meteo-rest-api)

## Step 1: Configure the Flow settings <a href="#step-1-configure-the-flow-settings" id="step-1-configure-the-flow-settings"></a>

1. Sign in to **ixHello Customer v2**.
2. In the left navigation menu, go to **Flows**
3. Select **Create flow** to configure the flow settings.

<table><thead><tr><th width="272">Setting</th><th>Value</th></tr></thead><tbody><tr><td>Name</td><td>Weather App with Open Meteo</td></tr><tr><td>Description</td><td>Converse about the weather information retrieved from Open Meteo based on the location and time period the user provides, summarize the call before ending. </td></tr><tr><td>Persona. Text-to-Speech (TTS) language and voice</td><td>The language and voice for the app. Choose any one you desire. </td></tr></tbody></table>

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2FBC1oMH2mPVD8MAktslsY%2Fstep1-flow-settings.png?alt=media&#x26;token=f333c4b6-4c9d-444f-9837-70ce4e89230d" alt="Configured flow settings"><figcaption></figcaption></figure>

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

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2Focr5FhcAJ9Cm3pfUrog8%2Fstep1-flow-editor-starting-point.png?alt=media&#x26;token=38e7491b-e66d-4c53-83c3-0c840e963885" alt="Flow editor detail page for a new flow - end of step 1"><figcaption></figcaption></figure>

## 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.&#x20;

1. Add an Agent node to the canvas&#x20;
2. Connect it to the start node.
3. Select the agent node to open the right sidebar

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2FhzW1Fcrp6YI5QtC9aYI4%2Fstep1-add-agent-node.png?alt=media&#x26;token=87459ac0-2d9e-4ea2-a3ff-2741e7c115bd" alt=""><figcaption></figcaption></figure>

### 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.&#x20;

<table><thead><tr><th width="272">Setting</th><th>Value</th></tr></thead><tbody><tr><td>Name</td><td>Collect city location and number of days</td></tr><tr><td>System prompt </td><td><p>You are an assistant that needs to retrieve a location, and number of days, from a user.</p><p></p><p>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.</p><p></p><p>Use this city to determine the coordinates (latitude, longitude). Do not talk about the latitude and longitude to the user.</p><p><br>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.</p><p></p><p>You can't answer any other questions.</p></td></tr><tr><td>Memory identifier</td><td><em>empty</em> </td></tr><tr><td>Iteration limit</td><td><em>empty</em></td></tr><tr><td>Single turn</td><td><em>Leave unchecked</em></td></tr><tr><td>Take initiative</td><td><strong>Checked.</strong> This forces the agent to send the first message when the session starts. </td></tr></tbody></table>

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2Ff8TKxkSnFIQyoBwN4JF5%2Fstep-3.png?alt=media&#x26;token=1d2549b2-e894-4700-92c4-21a646e59cb8" alt="configured agent details - end of step 3"><figcaption></figcaption></figure>

### 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.

1. 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.
   1. Enter the goal description: **The coordinates (latitude and longitude) for the city and the number of days**
2. 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.&#x20;
   1. Enter the slot description: **The latitude of the city the user mentioned**
   2. Update the slot type to **Number,** since we're collecting a numeric value.&#x20;
   3. Slot is optional stays **unchecked.** This slot is required to reach the goal.&#x20;
3. 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.&#x20;
   1. Enter the slot description: **The longitude of the city the user mentioned**
   2. Update the slot type to **Number,** since we're collecting a numeric value.&#x20;
   3. Slot is optional stays **unchecked.** This slot is required to reach the goal.&#x20;
4. 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.&#x20;
   1. Enter the slot description: **Number of days**
   2. Update the slot type to **Number,** since we're collecting a numeric value.&#x20;
   3. Slot is optional stays **unchecked.** This slot is required to reach the goal.&#x20;

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2F8p65aLICe5MCWo2qV5Ll%2Fstep4.png?alt=media&#x26;token=1793a896-fc39-4596-a574-50688fbba24b" alt="configured agent goals - end of step 4"><figcaption></figcaption></figure>

## Step 5: Add and configure the API Call node &#x20;

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.&#x20;

1. Add an API call node to the canvas and connect it to the **collectedInfo** exit of the agent.&#x20;
2. Open the **API call node.**&#x20;
3. Configure the API: **Open Meteo** and Method: **Daily Weather.** The request and response section becomes available.&#x20;
4. Configure the Request variables
   1. latitude > **lat**
   2. longitude > **lon**
   3. days > **days**&#x20;
5. 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.&#x20;

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2F0EzVCPcrmK5zNyZCMOW5%2Fstep-5.png?alt=media&#x26;token=2909ccdb-373d-4c3c-b1ba-8994cdab4624" alt="configured say node - end of step 5"><figcaption></figcaption></figure>

## 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.

1. Add an Agent node to the canvas&#x20;
2. Connect it to the **API call node success** exit.
3. Select the agent node to open the right sidebar

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2F0DawpMWGWgehX3d5c6wK%2Fstep-6.png?alt=media&#x26;token=8186f3d0-494f-44d5-88b3-4d6a625b28c0" alt=""><figcaption></figcaption></figure>

### Step 7: Configure the agent details.&#x20;

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.

<table><thead><tr><th width="272">Setting</th><th>Value</th></tr></thead><tbody><tr><td>Name</td><td>Weather agent</td></tr><tr><td>System prompt </td><td><p>You are a weather agent who can interpret and answer question about a weather forecast. Today is {today}.</p><p></p><p>Available data is provided as JSON: </p><p>{daily_weather_result}</p><p></p><p>Start by providing tomorrow's maximum and minimum temperature and ask if the user wants more information.</p><p></p><p>Answer additional questions about the provided data. Keep your answers brief as if you're talking to a person.</p><p></p><p>You can't answer any other questions and can only use the provided data.</p></td></tr><tr><td>Memory identifier</td><td><em>empty</em> </td></tr><tr><td>Iteration limit</td><td><em>empty</em></td></tr><tr><td>Single turn</td><td><em>Leave unchecked</em></td></tr><tr><td>Take initiative</td><td><strong>Checked.</strong> This forces the agent to send the first message. </td></tr></tbody></table>

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2FBnmmqer66XgV6BJTxlDJ%2Fstep-7.png?alt=media&#x26;token=d80eb7ec-fb7b-4e70-a70c-4c9d53bb2fa8" alt=""><figcaption></figcaption></figure>

### 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.&#x20;

1. 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.
   1. Enter the goal description: **use this goal if the user has no more questions**

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2FzBnRDL35JsERRhxvhYuw%2Fstep-8.png?alt=media&#x26;token=a3c70cea-5314-4af2-aa64-36212754440b" alt=""><figcaption></figcaption></figure>

## 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 F**ailure** exit of the API call node.&#x20;
* 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.**&#x20;

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2F9z11kjvzlJSc4miwvdul%2Fstep-9.png?alt=media&#x26;token=a9b14a86-0913-499f-98fb-895966d1cfcd" alt=""><figcaption></figcaption></figure>

## Step 10: add an end node to complete the flow&#x20;

1. Add an end node to the canvas.&#x20;
2. Connect it to the Say node
3. Connect it to the **End** exit of the Weather agent.&#x20;
4. **Save** the flow. The state switches from invalid to valid and is ready to be tested.&#x20;

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2FaVuHEUpujb7inNljWskY%2Fstep-10.png?alt=media&#x26;token=5d9b57f3-157f-48e9-a2d8-0ca5ee5dbc24" alt=""><figcaption></figcaption></figure>

## Step 11: Test and tweak the Weather flow

Click the **Test** button in the top right corner and try out your Weather app!

<figure><img src="https://4187494610-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFe4cpY1jy0FJ4kgC7wSx%2Fuploads%2FD0ztMOib8coKmJeNrD5v%2Fstep-11.png?alt=media&#x26;token=2d25facf-2207-4c10-a170-68b9af3ecd96" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
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.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ixhello.com/ixhc2/general/tutorials/weather-flow-with-open-meteo-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
