Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/execute endpoint doesn't perform follow-up actions of executed action #4876

Closed
erohmensing opened this issue Nov 29, 2019 · 12 comments
Closed
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@erohmensing
Copy link
Contributor

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.

@erohmensing erohmensing added type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. area:rasa-oss 🎡 Anything related to the open source Rasa framework labels Nov 29, 2019
@amn41
Copy link
Contributor

amn41 commented Nov 29, 2019

I agree this is unexpected behaviour, but not sure we should fix it this way.

Following #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

@erohmensing
Copy link
Contributor Author

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)?

@amn41
Copy link
Contributor

amn41 commented Nov 29, 2019

I've never worked with the 'forgetting itself' mechanism, but isn't it just a matter of returning a ActionReverted event?

@erohmensing
Copy link
Contributor Author

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.

@amn41
Copy link
Contributor

amn41 commented Nov 29, 2019

why is without stories a requirement?

@JEM-Mosig
Copy link
Contributor

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.

@nbeuchat
Copy link
Contributor

nbeuchat commented Dec 6, 2019

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.

@JEM-Mosig
Copy link
Contributor

JEM-Mosig commented Dec 12, 2019

Hi @nbeuchat
Yes, this is exactly what we're working on right now (see #4464). Introducing the ExternalEvents class was an implementation detail we were considering, but in any case it'll solve exactly the problem you describe.

@nbeuchat
Copy link
Contributor

@JEM-Mosig That's great! Looking forward to it!

@wochinge
Copy link
Contributor

fixed by #4964

@JEM-Mosig
Copy link
Contributor

@nbeuchat Intent-triggering external events (and reminders) are released now! See https://github.com/RasaHQ/rasa/releases

@oudayo
Copy link

oudayo commented May 30, 2023

Hi guys , can Anyone help me to trigger multiple custom actions for an intent ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

6 participants