How to loop over actions

I want to repeatedly perform an action until a condition is met. How can this be done in Rasa? I want something like:

* greet
 - utter_greet
 - action_ask_question
 - action_do_stuff
  ] ( repeat until condition is met )
 - utter_done

To give some background our bot makes a suggestion and asks the user “do you like this?”. The user can reply yes or no. We keep making suggestions until the user has said yes to N suggestions. We’ve built an action that does this based on slots but we can’t work out how to use stories to drive this flow (repeatedly invoke an action until the condition is met)


Hi @thobson

This is something you can do with a form and its validation function. The form will keep asking until its slots are filled, so you just have the validation function be the action_do_stuff and let it set the form’s slot to none if the condition is not met. See Forms (or Handling Business Logic | Rasa Open Source Documentation if you work with Rasa 2.0 rc1)

Hi @j.mosig I am really interested in repeating parts of a story/rule using Forms (How to practically design chatbot with repeated parts of a story - #4 by mattvan83).

Could you help me get through?


Melinda just replied on your thread. :slight_smile:

Thanks @j.mosig :slight_smile:

I know that forms keep on asking questions until the slots are filled, is it possible to perform actions in between this process. eg: suppose i am using forms to fill in details for for hotel booking, then the form ask questions to get the hotel name, room type, etc. After that only i can check if the room is available and if that hotel is not available i have to ask the question again. Instead of this process i want to run an action to fetch the available hotels and utter it before asking the question, “Which hotel do you prefer?”

I found solution to this problem, Use action (utter ) to ask for next slot value , refer Forms