# Rasa is matching intent in active loop

**URL:** <https://forum.rasa.com/t/rasa-is-matching-intent-in-active-loop/60818>\
**Category:** Rasa Open Source\
**Created:** [January 19, 2024, 11:09pm UTC](https://forum.rasa.com/t/rasa-is-matching-intent-in-active-loop/60818 "2024-01-19T23:09:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guervyl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/guervyl/32/23632_2.png) [@Guervyl](https://forum.rasa.com/u/Guervyl)\
**Post date:** [January 19, 2024, 11:09pm UTC](https://forum.rasa.com/t/rasa-is-matching-intent-in-active-loop/60818/1 "2024-01-19T23:09:57Z")

</div>

Hi, I have a form that has two `required_slots` . The problem is in the `active_loop` when I insert a value for the `requested_slot` rasa is matching the inserted value to an intent and it get out of the form to go to that intent. This is wrong in my case because I just want the users to fill the form and keep following the story path. It should not to try to match an intent when the user is filling a slot.

```auto
slots:
  date:
    type: text
    mappings:
    - type: custom

  forms:
    date_from:
      required_slots:
        - date
        - time

```

The story path

```auto
- intent: cirujia
  - action: utter_cirujano
  - action: date_from      
  - active_loop: date_from 
  - active_loop: null
  - action: action_confirmation

```

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [January 20, 2024, 6:57am UTC](https://forum.rasa.com/t/rasa-is-matching-intent-in-active-loop/60818/2 "2024-01-20T06:57:25Z")

</div>

You’re story doesn’t look right. Follow the examples in the [forms docs](https://rasa.com/docs/rasa/forms/#activating-a-form) and create two rules, one to activate the form and another to exit.

---

<div class="post-metadata">

**Author:** ![Guervyl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/guervyl/32/23632_2.png) [@Guervyl](https://forum.rasa.com/u/Guervyl)\
**Post date:** [January 21, 2024, 3:03am UTC](https://forum.rasa.com/t/rasa-is-matching-intent-in-active-loop/60818/3 "2024-01-21T03:03:59Z")

</div>

I don’t understand why the story doesn’t look right. I’m in the story. Why redirecting to a rule to then go back to the story? Even if it would be cool to have the form defined once because the form follow one path. And the rasa documentation is confusing because it doesn’t show the complete examples.

This a story I have:

```auto
- story: happy path
  steps:
  - intent: want_to_reserve # I want to reserve
  - action: utter_want_to_reserve # What do you want to reserve?
  - action: service_form # form to fill the service
  - active_loop: service_form 
  - slot_was_set:
    - requested_slot: null
  - active_loop: null # Form is filled
  - action: action_describe_item # description of the service and ask for the date
  - action: date_from # form to fill date and time
  - active_loop: date_from 
  - slot_was_set:
    - requested_slot: null
  - active_loop: null # Form is filled
  - action: action_confirmation # ask to confirm.
  - intent: confirmation
  - action: action_check_user
  - slot_was_set:
    - user_exists: true
  - action: action_make_appointment

```

So, how can I have the rules for the forms and make sure that Rasa will know it should go back to the story after?

Another problem I have is splitting the story so that I do not have to repeat the same parts again and again and to be able to change the stories easily in case of new changes. But I always have Unexpected intent trigger to find the next story to execute and sometimes it pick the wrong story to continue instead of following the right path. **I just don’t want that to happen again if I split into rules. I think about creating a new post about this problem.**

---

<div class="post-metadata">

**Author:** ![Guervyl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/guervyl/32/23632_2.png) [@Guervyl](https://forum.rasa.com/u/Guervyl)\
**Post date:** [January 21, 2024, 3:17am UTC](https://forum.rasa.com/t/rasa-is-matching-intent-in-active-loop/60818/4 "2024-01-21T03:17:12Z")

</div>

I also check out this example [rasa/examples/formbot/data at main · RasaHQ/rasa · GitHub](https://github.com/RasaHQ/rasa/tree/main/examples/formbot/data).

I just don’t understand it. They defined the rules to active and deactivate the forms. But in the stories the repeat the same form creation in the stories.

Rule activate:

```auto
- rule: activate restaurant form
    steps:
      - intent: request_restaurant
      - action: restaurant_form
      - active_loop: restaurant_form

```

A story:

```auto
- story: stop form + continue
    steps:
      - intent: request_restaurant
      - action: restaurant_form
      - active_loop: restaurant_form
      - intent: stop
      - action: utter_ask_continue
      - intent: affirm
      - action: restaurant_form
      - active_loop: null
      - action: utter_submit
      - action: utter_slots_values

```

What is the point having a rule defined the form and repeat the same form code in the story?

---

<div class="post-metadata">

**Author:** ![Guervyl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/guervyl/32/23632_2.png) [@Guervyl](https://forum.rasa.com/u/Guervyl)\
**Post date:** [January 24, 2024, 8:33am UTC](https://forum.rasa.com/t/rasa-is-matching-intent-in-active-loop/60818/5 "2024-01-24T08:33:28Z")

</div>

Any help?

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [January 26, 2024, 5:23am UTC](https://forum.rasa.com/t/rasa-is-matching-intent-in-active-loop/60818/6 "2024-01-26T05:23:28Z")

</div>

Delete all the stories and use only rules to enter and complete the form.

---

<div class="post-metadata">

**Author:** ![Guervyl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/guervyl/32/23632_2.png) [@Guervyl](https://forum.rasa.com/u/Guervyl)\
**Post date:** [January 30, 2024, 6:28pm UTC](https://forum.rasa.com/t/rasa-is-matching-intent-in-active-loop/60818/7 "2024-01-30T18:28:00Z")

</div>

Thanks, But I would like more explanation on why.
