How to Handle Unexpected User Input With AI Studio Fallbacks
最終更新日 November 6, 2024

Endless loops in conversational AI agents can lead to a frustrating and disempowering user experience, trapping them in a cycle of repeated questions with no way out. This often leaves users feeling stuck and helpless, much like navigating a bureaucratic maze that never reaches a resolution. It’s no wonder they end up shouting, “TRANSFER ME TO A HUMAN!”

The root of this issue frequently stems from overlooked edge cases where the agent is not designed to handle the user’s input. Fortunately, Vonage’s AI Studio offers a powerful solution: fallbacks. However, without a well-designed fallback strategy, you risk creating even more endless loops.

In this post, you will learn how to effectively use fallbacks, counters, and human transfers to break these loops and create a smoother user experience in Vonage AI Studio.

What are AI Studio Fallbacks?

In Vonage AI Studio there are two scenarios where users might give problematic data:

  1. User input is somehow unexpected:

    • In SMS agents, a Collect Input node may result in a single type of fallback: Missed. Missed means the user’s answer didn’t match the expected entity type.

    • In Voice agents, a Collect Input node may result in two kinds of fallbacks. In addition to Missed, it can result in No Input. No Input means the user didn’t type or say an answer.

    • In WhatsApp agents, a Collect Input node may also result in two kinds of fallbacks: Missed or Unexpected Input Type. Missed is the same as SMS & Voice agents. However, Unexpected Input Type means that the user responded with a different media type. For instance, if your agent is expecting text but your user responds with an image.

  2. User input that a Classification node can’t classify:

  • This happens when the agent is able to figure out how to match the user’s input to one of the Intents you’ve defined.

For each of these scenarios, AI Studio automatically creates exit points in the nodes. This allows us to define what should happen when those scenarios occur in your agent.

AI Studio Built-In Retry Mechanism

Collect Input nodes include a Retry feature, allowing you to set the “Number of Retries” for valid input attempts and provide a “Retry Prompt” to inform users when they need to re-enter their input.

Built-in Retry Feature in a WhatsApp Collect Input NodeBuilt-in Retry Feature in a WhatsApp Collect Input Node

So why do we need to create fallback flows if we have built-in retries? Retries are great, but they cover all errors, it can be either a Missed input or No/Unexpected Input. So we’re a bit limited in explaining to our user how to correct their answer. No matter how many retries we allow, the user may continue to give faulty input repeatedly. What a nightmare user experience! 

Secondly, we still have the case of missed intent classification for Classification nodes. Luckily, AI Studio gives exit points to create a more friendly user experience to guide our users.

How to Create a Fallback Flow

How to Create a Unexpected Input Type or No Input Fallback

Whether you are collecting input for Voice, SMS, or WhatsApp agents, this is a great way to handle those pesky input issues. I’ll use a WhatsApp flow, but you can adapt to your needs. Step 1: Add a Counter Node

I’ll add a counter and increase the Number of Retries to 2. Then click Save & Exit.

increase_number_of_retriesincrease_number_of_retries

Now you can see that my counter has 2 exit points: 1 and 2. With multiple exit points, I can create multiple scenarios depending on whether this is the user’s first instance of bad input or the second.

Create Different Flows Based on Different Iterations of the CounterCreate Different Flows Based on Different Iterations of the Counter

For my first exit point, I will connect it back to the Collect Input node so that the user can try again. However, the user might be quite confused if they are asked, “How can I help you?” then they enter an answer, and again they are asked, “How can I help you?”. To alleviate this, I will add a Send Message node to explain the problem.

Example of a Fallback ExplanationExample of a Fallback ExplanationNow, I can connect the Explanation node back to the original Collect Input node.

The final step is to handle the case when the counter is 2, or the second time a user enters unexpected input. In this case, I will connect the user to a support team via the Live Agent Routing node. You can integrate Slack and WhatsApp via the Live Agent Routing node. The full build-out is beyond the scope of this article. You could also use the Send Email node here so that the user could leave their details and questions and your team would respond over email.

Collect Input Node Fallback Flow ExampleCollect Input Node Fallback Flow Example

How to Create a Missed Classification Fallback

Now let’s handle the scenario when the user enters an expected input type. So I will add a Classification node and give it a few Intents. Just as we had the Unexpected Input Type exit point before, we now have the Missed exit point.

Classification of Collect Input ExampleClassification of Collect Input Example

Now I will repeat my steps from before:

  1. Create a counter node with exit points for 1 and 2 retries.

  2. Create an explanation message to help the user understand why their input was problematic. For example, “Sorry, we had trouble understanding your question. Please ask again in more detail.”

  3. Connect to the Collect Input and Live Agent Routing nodes, respectively.

The full flow looks like this:

Classification Node Fallback Flow ExampleClassification Node Fallback Flow Example

Conclusion

Fallback flows are fairly simple but very powerful. They can differentiate between a user finding automated agents helpful and frustrating. How are you using fallback flows in your agents? Where are your users getting stuck? I want to hear about it! Join me on the Vonage Community Slack. We even have a channel just for AI Studio. You can also follow VonageDev on X for all the latest Vonage news, events, and updates.

Benjamin AronovDeveloper Advocate

Benjamin Aronov is a developer advocate at Vonage. He is a proven community builder with a background in Ruby on Rails. Benjamin enjoys the beaches of Tel Aviv which he calls home. His Tel Aviv base allows him to meet and learn from some of the world's best startup founders. Outside of tech, Benjamin loves traveling the world in search of the perfect pain au chocolat.

Ready to start building?

Experience seamless connectivity, real-time messaging, and crystal-clear voice and video calls-all at your fingertips.

Subscribe to Our Developer Newsletter

Subscribe to our monthly newsletter to receive our latest updates on tutorials, releases, and events. No spam.