Ir para o conteúdo

3.2 - Travel Agency Use Case

Overview

Let's explore a hypothetical scenario.

Our client runs a travel agency who wants to enhance their customer experience using AI. n addition to answering general user queries via their documentation, this client wants to provide personalized travel recommendations—specifically, what to wear based on current weather forecasts.

We’ll explore two methods for building this solution in mAIstro:

  1. Using a prebuilt NeuralSeek Example Agent to get a quick-start demonstration.
  2. Building a fully customized mAIstro agent tailored to user queries.

Example Agent

NeuralSeek's Example Agents allow users to quickly get up and running with a prebuilt working agent you can adapt to your use case or use as inspiration.

  1. Navigate to the mAIstro tab.
  2. Click on the Example Agents icon to open the library.
  3. Select the Recommend Clothes Based on the Weather Forecast agent.

The Agent will appear in the Editor:

W_ExAgent

NTL

    {{ post  | url: "https://api.weather.gov/gridpoints/TOP/32,81/forecast" | operation: "GET" | jsonToVars: "true" }}
    {{ LLM  | prompt: "The weather << name: properties.periods[0].name , prompt: false >> is going to be:
    << name: properties.periods[0].detailedForecast  , prompt: false >>
    and becoming << name: properties.periods[1].name , prompt: false >>
    << name: properties.periods[1].detailedForecast ,  prompt: false >>
    Recap the forecast and make some recommendations on what should I wear." }}

You can expand each node by clicking the gear icon in the top corner. Let's walk through each node:

  • We start with a REST node with a prefilled URL to send the POST to, to recieve the current weather data.
  • Next we have a Send to LLM node with a prompt to output various weather variables with detailed forecast data for a concise recap and recommend attire to wear accordingly.
  1. Click Run Agent and view the generated response.

W_runExAgent

This gives a strong starting point. From here, we will explore how we can build the agent to utilized in Seek as a mAIstro-led category.

Weather Recap Agent

We will walk through building a custom mAIstro agent to perform a similar function, but with more flexibility and the ability to scale to real-world use cases. This agent will:

  1. Gather the user’s query.
  2. Pull real-time weather data via a REST call.
  3. Recap the weather forecast in plain language based on the user query.
  4. Make a recommendation on appropriate attire based on the forecast.

Gather User Query

First, we will gather the user's query enhanced with NeuralSeek context keeping to be stored as a variable for later processing.

  1. Add a Seek Input node.
  2. Drag and drop a Set a Variable to chain together. Click the gear icon to set the variable name as query. Directly set the value to a new variable: << name: seekIn.contextQuery, prompt: true >>

W_Chain1

Next, we will add a fallback for multi-turn interactions. The condition here states that if the query variable is blank, then set it to the original user input.

  1. Add a Condition node. Click the gear icon and add this condition to evaluate: '<< name: query, prompt: false >>' == ''
  2. Drag and drop a Set a Variable to chain together. Click the gear icon to set the variable name as query. Directly set the value to a new variable: << name: seekIn.originalQuery, prompt: false >>

W_Chain2

Send a REST Request

Now we need to grab the weather forecast data.

  1. Add a REST. Click the gear icon to set the URL to send the POST to as: https://api.weather.gov/gridpoints/TOP/32,81/forecast. This retrieves a JSON response with detailed weather information for a specific location and set them to flattened variabled for downstream use.

W_Chain3

Generate the Weather Recap and Attire Recommendation

Finally, we will convert the weather data into a user-friendly response as a recap and attire recommendation.

  1. Add a Send to LLM node. Click the gear icon to add this prompt:
    The weather << name: properties.periods[0].name , prompt: false >> is going to be:
    << name: properties.periods[0].detailedForecast  , prompt: false >>
    and becoming << name: properties.periods[1].name , prompt: false >>
    << name: properties.periods[1].detailedForecast ,  prompt: false >>

    Recap the forecast based on the question: << name: query, prompt: false >>. 

    Make some recommendations on what should I wear based on this: << name: properties.periods[0].detailedForecast  , prompt: false >>
  1. Set Cache to false so that fresh responses are generated each time based on the current forecast.

W_Chain35

Test in mAIstro

Now that our agent is fully built, let's test it directly from the mAIstro interface.

W_Chain4

Weather Agent NTL

    {{ seekIn  }}=>{{ variable  | name: "query" | value: "<< name: seekIn.contextQuery, prompt: true >>" }}
    {{ condition  | value: "'<< name: query, prompt: false >>' == ''" }}=>{{ variable  | name: "query" | value: "<< name: seekIn.originalQuery, prompt: false >>" }}
    {{ post  | url: "https://api.weather.gov/gridpoints/TOP/32,81/forecast" | operation: "GET" | jsonToVars: "true" }}
    {{ LLM  | prompt: "The weather << name: properties.periods[0].name , prompt: false >> is going to be:
    << name: properties.periods[0].detailedForecast  , prompt: false >>
    and becoming << name: properties.periods[1].name , prompt: false >>
    << name: properties.periods[1].detailedForecast ,  prompt: false >>

    Recap the forecast based on the question: << name: query, prompt: false >>. 

    Make some recommendations on what should I wear based on this: << name: properties.periods[0].detailedForecast  , prompt: false >>" | cache: "false" }}
  1. Click the Run Agent. An Explore Parameter will populate. Add a query and click evaluate: What is the weather today?
  2. Click the Save icon at the bottom of the screen to save the agent. Provide a unique name and description.

W_addQ

W_customRun

W_customSave

Create a mAIstro-led Category

To integrate the agent into chatbot routing logic, we’ll create a custom category that uses this agent when weather-related queries are detected.

  1. Navigate to the Configure tab. Ensure that Multi-Agent Routing is enabled in the bottom right corner.
  2. Click Add a Category.
  3. Name the new category Weather, add a brief description, set the Action to take on match to mAIstro-led. Click Save Category.
  4. Click on the Default Action and select your newly created mAIstro Agent from the drop-down list. Click save.

W_config

W_addnewCat

W_defaultAction

W_addAgent

Test in Seek

With the mAIstro-led category active, you can now test the entire experience in Seek.

  1. Navigate to the Seek tab.
  2. Type in a question, such as: What is the weather like today?
  3. Review the AI-generated response, which includes a recap of current weather conditions and personalized clothing recommendations.
  4. Type in a follow-up question, such as: Should I bring an umbrella?
  5. Review the AI-generated response and confirm that the system responds contextually.

W_Q1 W_Q2