# FollowupAction triggers additional intents and actions

**URL:** <https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785>\
**Category:** Rasa Open Source\
**Created:** [November 2, 2019, 12:14am UTC](https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785 "2019-11-02T00:14:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![EllisonFord](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ellisonford/32/5274_2.png) [@EllisonFord](https://forum.rasa.com/u/EllisonFord)\
**Post date:** [November 2, 2019, 12:14am UTC](https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785/1 "2019-11-02T00:14:38Z")

</div>

Hi,

I’m trying to get an Action from my actions server to run another Action using the return FollowupAction(‘name\_action’) method as seen in [Events](https://rasa.com/docs/rasa/api/events/). Unfortunately it starts executing way more actions than I asked it to.

Basic example: I want ‘action\_utter\_goodbye’ to run ‘action\_utter\_greet’. Yet this is what I’m getting when I try that.

```auto
- Bye bye pal
127.0.0.1 - - [2019-11-02 01:09:42] "POST /webhook HTTP/1.1" 200 234 0.001607
- Hello friend
127.0.0.1 - - [2019-11-02 01:09:42] "POST /webhook HTTP/1.1" 200 169 0.000735
- Bye bye pal
127.0.0.1 - - [2019-11-02 01:09:42] "POST /webhook HTTP/1.1" 200 234 0.000661
- Hello friend
127.0.0.1 - - [2019-11-02 01:09:42] "POST /webhook HTTP/1.1" 200 169 0.000663
- Bye bye pal
127.0.0.1 - - [2019-11-02 01:09:42] "POST /webhook HTTP/1.1" 200 234 0.000656
- Hello friend
127.0.0.1 - - [2019-11-02 01:09:42] "POST /webhook HTTP/1.1" 200 169 0.000661
- Bye bye pal
127.0.0.1 - - [2019-11-02 01:09:42] "POST /webhook HTTP/1.1" 200 234 0.000699
- Hello friend
127.0.0.1 - - [2019-11-02 01:09:42] "POST /webhook HTTP/1.1" 200 169 0.000709
- Bye bye pal
127.0.0.1 - - [2019-11-02 01:09:42] "POST /webhook HTTP/1.1" 200 234 0.001346
- Hello friend

```

This is what my actions look like:

```auto
class UtterGreet(Action):
    def name(self) -> Text:
        return 'action_utter_greet'

    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]):
        username = tracker.get_slot('username')
        print(f'\n- Hello {username}\n')
        print('followup_action:', tracker.followup_action)

class UtterGoodbye(Action):
    def name(self) -> Text:
        return 'action_utter_goodbye'

    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]):
        print('\n- Bye bye pal\n')
        return [FollowupAction('action_utter_greet')]

```

And my training policies:

```auto
policies:
  - epochs: 50
    max_history: 6
    name: KerasPolicy
  - max_history: 6
    name: AugmentedMemoizationPolicy

```

And finally the said stories:

```markdown
## GREETINGS
* greet_intent
  - action_utter_greet

## GOODBYES
* goodbye_intent
  - action_utter_goodbye

```

I would really appreciate some help with this. Is it a Policies issue? A Rasa Core issue? Something else?

Regards

---

<div class="post-metadata">

**Author:** ![btotharye](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/btotharye/32/5321_2.png) [@btotharye](https://forum.rasa.com/u/btotharye)\
**Post date:** [November 6, 2019, 4:58pm UTC](https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785/2 "2019-11-06T16:58:45Z")

</div>

I’m about to test your config but with the initial config you get from `rasa init` I’m seeing what I believe to be right:

Config - also what is your pipeline you are using just to verify?:

```auto
language: en
pipeline: supervised_embeddings
policies:
- name: MemoizationPolicy
- name: KerasPolicy
- name: MappingPolicy

```

Actions:

```auto
class UtterGreet(Action):
    def name(self) -> Text:
        return 'action_utter_greet'

    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]):
        print(f'\n- Hello')
        dispatcher.utter_message("Hello")
        print('followup_action:', tracker.followup_action)

class UtterGoodbye(Action):
    def name(self) -> Text:
        return 'action_utter_goodbye'

    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]):
        print('\n- Bye bye pal\n')
        dispatcher.utter_message("Bye bye pal")
        return [FollowupAction('action_utter_greet')]

```

When I talk to it over Rasa X I’m seeing the bye response then the hello utterance so it seems fine:

![16%20AM](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/a/a81766f3086ffa8ea70bff17ad14c660197e12bc.png)

Is this what you would expect/want to see?

---

<div class="post-metadata">

**Author:** ![btotharye](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/btotharye/32/5321_2.png) [@btotharye](https://forum.rasa.com/u/btotharye)\
**Post date:** [November 6, 2019, 5:03pm UTC](https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785/3 "2019-11-06T17:03:00Z")

</div>

From testing your config @EllisonFord it appears to be the config that is doing it, I’m guessing the `AugmentedMemoizationPolicy` is doing it.

---

<div class="post-metadata">

**Author:** ![gonesbuyo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/gonesbuyo/32/4956_2.png) [@gonesbuyo](https://forum.rasa.com/u/gonesbuyo)\
**Post date:** [November 6, 2019, 5:08pm UTC](https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785/4 "2019-11-06T17:08:08Z")

</div>

And how can this be solved? I’m also using `AugmentedMemoizationPolicy` and have the same problem with `FollowupAction`. And `utter_template` neither works as expected.

---

<div class="post-metadata">

**Author:** ![btotharye](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/btotharye/32/5321_2.png) [@btotharye](https://forum.rasa.com/u/btotharye)\
**Post date:** [November 6, 2019, 5:11pm UTC](https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785/5 "2019-11-06T17:11:37Z")

</div>

For testing try out this configuration and let me know what you see:

```auto
language: en
pipeline: supervised_embeddings
policies:
- name: MemoizationPolicy
- name: KerasPolicy
- name: MappingPolicy

```

We have a PR in to document more about the `AugmentedMemoizationPolicy` but from reading it I believe this to be the issue:

> <https://github.com/RasaHQ/rasa/pull/4708>
>
> \*\*Proposed changes\*\*:
> \- document \`AugmentedMemoizationPolicy\`
> \> Created using …\[rasa source\](https://github.com/RasaHQ/rasa/blob/7fcfdd9eaa8704dc44ecbdb2927eb1a07b10d333/rasa/core/policies/memoization.py#L257) and \[this\](https://forum.rasa.com/t/policies-and-stories-problem/12779/4) thread where @akelad explains the \`AugmentedMemoizationPolicy\`.
> 
> I haven't used .rst files ever, so let me know if there's an issue, but it seemed to be working when I ran \`make livedocs\`.
> 
> \*\*Status (please check what you already did)\*\*:
> \- \[x\] made PR ready for code review
> \- \[x\] updated the documentation
> \- \[x\] updated the changelog

Info about the policy below here leads me to think that is why this is occurring.

The AugmentedMemoizationPolicy remembers examples from training stories for up to max\_history turns.

It has a forgetting mechanism that will forget a certain amount of steps in the conversation history and try to find a match in your stories with the reduced history. It predicts the next action with confidence 1.0 if a match is found, otherwise it predicts None with confidence 0.0.

Note

If it is needed to recall turns from training dialogues where some slots might not be set during prediction time, add relevant stories without such slots to training data, e.g. reminder stories.

Since slots that are set some time in the past are preserved in all future feature vectors until they are set to None, this policy has a capability to recall the turns up to max\_history from training stories during prediction even if additional slots were filled in the past for current dialogue.

---

<div class="post-metadata">

**Author:** ![EllisonFord](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ellisonford/32/5274_2.png) [@EllisonFord](https://forum.rasa.com/u/EllisonFord)\
**Post date:** [November 6, 2019, 5:15pm UTC](https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785/6 "2019-11-06T17:15:26Z")

</div>

Hi Brian, thank you for checking this issue. For me it was the Keras policy that I had to remove for the system not to act up with the FollowupAction return. The AugmentedMemoization I am still using and I get the follow-up action as I expect.

On your question as to which NLU Pipeline I’m using, I’m not using any at the moment. Just the RegexInterpreter being passed to the Agent so that I can directly test intents using: “/greet\_intent” and so on.

As mentioned, I think there might be an issue with the KerasPolicy and the FollowupAction.

Regards

---

<div class="post-metadata">

**Author:** ![btotharye](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/btotharye/32/5321_2.png) [@btotharye](https://forum.rasa.com/u/btotharye)\
**Post date:** [November 6, 2019, 5:18pm UTC](https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785/7 "2019-11-06T17:18:34Z")

</div>

Ok let me look further into the Keras and follow up action stuff

---

<div class="post-metadata">

**Author:** ![btotharye](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/btotharye/32/5321_2.png) [@btotharye](https://forum.rasa.com/u/btotharye)\
**Post date:** [November 6, 2019, 5:19pm UTC](https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785/8 "2019-11-06T17:19:44Z")

</div>

Weird also cause I was using this config and it seemed to work fine for me:

I just had assumed it was the difference in the policy on Augmented. Maybe the pipeline is helping out with it as well.

```auto
language: en
pipeline: supervised_embeddings
policies:
- name: MemoizationPolicy
- name: KerasPolicy
- name: MappingPolicy

```

---

<div class="post-metadata">

**Author:** ![EllisonFord](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ellisonford/32/5274_2.png) [@EllisonFord](https://forum.rasa.com/u/EllisonFord)\
**Post date:** [November 8, 2019, 7:51pm UTC](https://forum.rasa.com/t/followupaction-triggers-additional-intents-and-actions/20785/9 "2019-11-08T19:51:01Z")

</div>

Maybe, I was testing without a pipeline, just pure Rasa Core Intents and Actions. Either way, I removed policies 1 by 1 in my tests, and it was only when the KerasPolicy was gone that the strange behaviour would also stop.

Thanks for your hekp Brian!
