If the action you predict with the /conversations/<conversation_id>/execute endpoint returns a FollowupAction, this action does not get executed.
When executing an action externally, one would expect the effect of that action to be the same as the effect if that action were called by the bot in the conversation.
I suspect that this is due to the action called only getting "executed", instead of being called through the "predict_and_execute_next_action" loop which predicts actions until the next action_listen.
I agree this is unexpected behaviour, but not sure we should fix it this way.
Following https://github.com/RasaHQ/rasa/issues/4464 , the mechanism for triggering actions should be to send an external event. In this case the action gets executed normally.
Also, followupactions are fragile and should be discouraged, it's the policy's job to predict the next action. We should consider deprecating / removing them, or if there is a real need articulating a very specific use case in the docs
I agree, that sounds like the cleaner option in most cases. How would you handle this if you wanted an external event to trigger an action, which calls a follow up if necessary, and then forgets itself? (I.e. I want it to forget itself because I don't want it in the stories or influencing prediction). I'm not sure the external event + mapping policy handles this without stories, but I could be overlooking something. Call the other Action.run from within the run method directly (I never really understood followup actions to be honest)?
I've never worked with the 'forgetting itself' mechanism, but isn't it just a matter of returning a ActionReverted event?
Yeah, but i'm wondering how the second action can get called without stories for the it's the policy's job to predict the next action.
why is without stories a requirement?
The point of the ExternalEvent is that it behaves like a user input, which can then trigger an action via the MappingPolicy. If the external event and the following action appear at random places in the stories, that should be fine, because the policies can learn to ignore those parts.
Shouldn't external events be intents rather than actions (or both)? We actually have this issue right now that I asked about in the forum: https://forum.rasa.com/t/is-there-a-way-to-trigger-a-user-intent-not-an-action-from-the-code-or-from-the-api/22155
The problem we are facing with external events is that they are often triggered at very random places in the conversation, often after our own action (because the user didn't respond for example). Therefore, stories looked like that:
## a story
* some_intent
- action_last_bot_action
- action_external_event
- action_some_other_actions_after_the_event
This story is problematic for training the bot as the bot could learn to trigger action_external_event after action_last_bot_action. What we ended up doing was writing stories like this:
## a story
* some_intent
- action_last_bot_action
* external_event_intent
- action_external_event
- action_some_other_actions_after_the_event
Where we insert external_event_intent into the tracker history before executing the action action_external_event. This is working through our own endpoint that pretty much does the same as the execute endpoint but first insert the intent we need.
The second issue we are facing is that action_some_other_actions_after_the_event is not triggered after action_external_event after action_external_event is executed.
Hi @nbeuchat
Yes, this is exactly what we're working on right now (see https://github.com/RasaHQ/rasa/issues/4464). Introducing the ExternalEvents class was an implementation detail we were considering, but in any case it'll solve exactly the problem you describe.
@JEM-Mosig That's great! Looking forward to it!
@nbeuchat Intent-triggering external events (and reminders) are released now! See https://github.com/RasaHQ/rasa/releases