Can’t get form to deactivate

Hi Everyone, I’m loving Rasa. Most things have been going well. However, despite two days of trying and searching, I’ve had no luck with this seemingly common issue. The goal is to simply deactivate a form on command. A user activates form by typing “create use case”. But if in the middle the user decides to exit (cancel), I can’t seem to get it to work. I have an intent - stop_form. I’m using stop_form to trigger an utterance that ask if they are sure. If the response is affirmed, then the form should be deactivated. For clarity, I’ve listed all relevant parts of this process from the nlu, domain and stories files. Any help is appreciated. Can’t trigger the intent. I’m using Rasa 2.0


- stop_form:
    use_entities: []

    type: text
    influence_conversation: false
    type: text
    influence_conversation: false
    type: text
    influence_conversation: false

  - text: Do you want to continue? Yes or No...

      - type: from_text
      - type: from_text
      - type: from_text


- intent: stop_form
  examples: |
    - please stop this form
    - stop form
    - I want to stop form
    - I don't want to continue this form
    - please cancel form
- intent: affirm
  examples: |
    - yes
    - y
    - sure
    - absolutely
    - definitely
    - cool
    - indeed
    - of course
    - that sounds good
    - correct
    - ye
    - uh yes
    - let's do it
    - yeah
    - uh yes
    - um yes
    - yes knocking
    - that's correct
    - yes yes
    - right
    - yea
    - yes right
    - yes and i dont care
    - right on
    - i love that

- intent: deny
  examples: |
    - no
    - naaaa
    - never
    - I don't think so
    - don't like that
    - no way
    - not really
    - no new selection
    - no thanks
    - no thank you
    - uh no
    - breath no
    - do you have something else
    - no this does not work for me
    - heck no!
    - hell no


- story: stop use case form + continue #happy path
    - intent: create_use_case
    - action: use_case_form
    - active_loop: use_case_form
    - intent: stop_form
    - action: utter_ask_continue
    - intent: affirm
    - action: use_case_form
    - active_loop: null
    - action: action_submit_use_case
    - action: utter_submit_use_case

- story: stop use case form + stop #unhappy path - stop form
    - intent: create_use_case
    - action: use_case_form
    - active_loop: use_case_form
    - intent: stop_progress
    - action: utter_ask_continue
    - intent: deny
    - action: action_deactivate_loop
    - active_loop: null

@eaofcc Hey! Did you mentioned intent: create_use_case in nlu.yml and action_submit_use_case (which custom action you have created in did you mentioned in domain.yml? under actions such as

- action_submit_use_case

If you are using please see code snippet from rasa doc:

- story: User interrupts the form and doesn't want to continue
  - intent: request_restaurant
  - action: restaurant_form
  - active_loop: restaurant_form
  - intent: stop
  - action: utter_ask_continue
  - intent: stop
  - action: action_deactivate_loop
  - active_loop: null

Hey Thanks for the response. Ok to answer your question, yes and yes. The create_use_case is in the nlu and effectively activates the form and the action_submit_use_case is in the actions section of the domain.yml file. My custom actions for the form are below:

class ValidateUseCaseForm(Action):
    def name(self) -> Text:
        return "use_case_form"

    def run(
        self, slot_value: Any,dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
    ) -> List[EventType]:

        required_slots = ["use_case_name","use_case_description","use_case_note"]

        for slot_name in required_slots:

            if tracker.slots.get(slot_name) is None:

                return [SlotSet("request_slot", slot_name)]

        #All slots are filled.
        return [SlotSet("requested_slot", None)]

class ActionUseCaseSubmit(Action):
    def name(self) -> Text:
        return "action_submit_use_case"

    def run(
        tracker: Tracker,
        domain: "DomainDict",
    ) -> List[Dict[Text, Any]]:

        results = "Name: " + tracker.get_slot("use_case_name") + "\n" + "Description: " + tracker.get_slot("use_case_description") + "\n"  + "Note: " + tracker.get_slot("use_case_note")


        return[SlotSet("use_case_description", None),SlotSet("use_case_name", None),SlotSet("use_case_note", None)]

Funny thing is that I modeled my story after the example you provided. :slight_smile: , where “stop” was replaced by “stop_form”. I’m not too particular, just want to find an effective way to do it. Open to all suggestions. Thanks again

@eaofcc it solved your issue it means?

No it didn’t solve my issue

@eaofcc What the issue then, still the same?

@eaofcc Ok, do one thing, from command prompt run rasa interactive and follow the process, you will able to find the cause of error.

Yes. Form works fine, but the stop_form intent is not triggering the utter_ask_continue response.

Ok. will try that. thanks

Ok thanks. FYI, the interactive isn’t helping because I have form slots. It asks for input and if I type in anything it give an nlu_fallback. And then it attempts to see if i want to map the slot to an intent. This is super confusing because the form actually works when I’m using rasa X or rasa-chat.

Thanks for sharing! I’m having similar issues but for a slightly different use case. There appears to be a bug for deactivating forms for rasa_sdk. Hopefully this thread helps: Rasa 2.0 - How to deactivate a form during validation?

1 Like

Thanks! I’ve actually seen this post. I’ll check again to see if anything can get me unstuck. Deactivating a form in Rasa is proving to be far more complicated than I thought.

I’m still looking for a solution. Wish there was a standard way to deactivate a form, since this is a pretty normal requirement. It seems that the intent is fired if not slot has been filled. So after the form is active but before the first slot is filled, the stop_form intent works if the user types “stop form”. This then triggers everything else, and if the use types no, the form is deactivated. However, if one field is completed and then the user types “stop form” the intent doesn’t work.

@eaofcc Can you please share all the files, if you can? So, that I can dry run the code and check the issue for you. Thanks.

Hey, per your request, please find the following files attached:, nlu.yml, stories.yml, domain.yml, config.yml

Thanks a ton (2.2 KB) config.yml (716 Bytes) domain.yml (1.6 KB) nlu.yml (1.4 KB) stories.yml (617 Bytes)

Oh absolutely. No worries. I appreciate the help. Take your time.


By the way, just a reminder, I’m using Rasa 2.0 and rasa_sdk 2.0

@eaofcc Then I will suggest upgrade to 2.6.2 and 2.6.0 respectively or latest till 2.7.1 and 2.7.0 and try your code then. I will seen your code in evening.

I did try upgrading to 2.7 (Rasa and rasa_sdk). But the issue is that when I do, the rasa-webchat widget stops working, due to socketio incompatibility.

@eaofcc Thats not the issue, share this error please. Share me endpoint and credentials also just screenshot.