What is a Counter in Controlled Flow?
A counter is a control mechanism that prevents Controlled Flow from getting stuck in an infinite loop when requesting the same information from the user repeatedly.
Why Is a Counter Necessary?
Let's analyze an example:
Imagine Controlled Flow needs the user's email address to verify if they are already a customer in your internal database.
-
Controlled Flow asks for the email.
-
The user provides an invalid email.
-
Controlled Flow asks again.
-
The user provides another invalid email.
-
This continues indefinitely.
Without a counter, Controlled Flow would keep asking forever, creating an infinite loop.
A counter prevents this situation.
How to Set Up a Counter in Controlled Flow

Flow Description
The AI asks the user to enter a number between 1 and 10.
-
If the user provides a valid number β the flow continues normally.
-
If the user provides a number outside this range β the same question is repeated.
Without a limit, this situation can also lead to an infinite loop.

Let's fix this.
Proper Structure for Counters

Logic Behind Counters
A counter is simply a variable that starts at 0.
Each time the user:
-
Does not meet the requirements,
-
Cannot be found in the database,
-
Or for any other reason we might have,
We add +1 to the counter and ask the question again.
In the βInvalid Numberβ session of the flow, there is a filter that checks the counter value (which represents how many times the question has been asked).
If the counter exceeds the defined limit (for example, 3 attempts), the bot stops asking the question and directs the conversation to a human response or another fallback action.
This prevents infinite loops and ensures a better experience for the user.