Restarting an Active Flow
A looping flow in Rasa lets users repeat actions in a conversation. You can use this for things like adding items to a list, making repeated requests, or providing iterative input.
To restart an active flow, add a unique identifier to the top of your flow.
This id
step is used as a reference point to loop back to the beginning of the flow when you want to restart it.
It is important to note that you cannot use a link to restart the flow. This is because
links are reserved for connecting an active flow to other flows. You cannot connect a flow to itself.
It's also important to clear any relevant slots before restarting the flow. This prevents Rasa from skipping required
collect steps. You can do this by adding a set_slots
step or by setting the ask_before_filling parameter to True
in your
collection steps.
Here's an example of a looping flow that lets users add multiple contacts:
- Start the flow with
id: "start"
. - Collect contact information.
- Add the contact.
- If successful, ask if the user wants to add another.
- If yes, reset slots and restart the flow (using
set_slots
and jumping back toid: "start"
).
Another way to loop without resetting slots is to set ask_before_filling
to True
in all collect steps.
This makes Rasa always ask for input, even if the slot was already filled.