Implementing OnError Loop Handling

This page describes how to implement an OnError loop "circuit breaker" to prevent infinite loops in your system. Infinite loop handling is necessary because it prevents your bot from running indefinitely. An infinite loop in a bot, for example, could lead to Parloa going in circles and never reaching the next State block, forcing the bot to cut off after 50 loops through the same node within a few seconds. Implementing an OnError loop "circuit breaker" can help stop these infinite loops.

How To Implement the OnError Circuit Breaker

Step 1 – Create and Initialize the Variable

  1. In the dialog, click the Variables tab.

  2. Click the + Add New Variable button.

  3. Name the variable, for example OnErrorCounter.

  4. Initialize the variable in the TechSetup subdialog with a value of 0.

Step 2 – Modify the Global Intent On Error Path

  1. Add a Condition block in the global intent On Error path.

  2. Set the condition to OnErrorCounter < 2.

Step 3 – Increment the Error Counter

  1. Add a Storage block in the global intent On Error path.

  2. Increate the value of OnErrorCounter by 1: ++OnErrorCounter.

Step 4 – Handle Exceeding Errors

  1. Add an End Conversation block with a clear and concise message. For example:

    End of the bot flow. Too many errors encountered. Please try again later or contact support.
  2. Alternatively, add a Call Control block to forward the call to a predefined default destination, such as customer support or a fallback handler.

Last updated