Implement OnError Loop Handling
Last updated
Last updated
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.
In the dialog, click the Variables tab.
Click the + Add New Variable button.
Name the variable, for example OnErrorCounter
.
Initialize the variable in the TechSetup subdialog with a value of 0
.
Add a Condition block in the global intent On Error path.
Set the condition to OnErrorCounter < 2
.
Add a Storage block in the global intent On Error path.
Increate the value of OnErrorCounter
by 1: ++OnErrorCounter
.
Add an End Conversation block with a clear and concise message. For example:
Alternatively, add a Call Control block to forward the call to a predefined default destination, such as customer support or a fallback handler.