Replay actions from tracker

Hi everybody,

I have a question, maybe somebody already has done something similar and knows if it is possible.

For example, i have a conversation, which is a dialogue between user and bot, maybe including some actions, and i extract part of this dialogue from the tracker as list of events.

Now I want to restart the current conversation and simulate it from this list of events, kind of replay all these events, is it possible?

Until now i managed to change the tracker, save events but i don’t see how to push these events to the frontend.

Any help would be appreciated!

Are you using custom actions or the HTTP API?

In case of the HTTPI API: Add a restart event as first item to your event list, and then append all the old events of you trackers and send this of events to HTTP API

In case of custom actions: return [Restarted()] +

1 Like

Thank you, Tobias! I will try it!

The offered solution is working fine. But still I have some issues. If I return some action which should trigger another action (according to the mapping policy), it doesn’t work - the returned action doesn’t trigger anything. Is there an issue with the mapping policy in such a case?

Thank you for the help!

The mappingpolicy makes that certain intents trigger certain actions. It doesn’t let you trigger actions with actions. You could use a FollowUp event for that (Events). Note that you should import the events from the and not from rasa.core

Sorry, i was not clear enough in my previous post. Let me make an example:

in my domain.yml I have

- ask_if_bot:
    triggers: action_bot_answer
- hello
- bye

so if in some run function from i return

return [Restarted(), UserUttered(“are you a bot?”)]

the action “action_bot_answer” doesn’t get triggered, as if it does when i write the same in the chat. So in this case the mapping policy doesn’t jump in.

Mhm, I think the idea is to use FollowupActions here. Also if you return an event UserUttered(“are you a bot?”) this does not trigger another NLU prediction since the event is basically the result of an NLU prediction. But what should work would be

UserUttered(“are you a bot?”, {"intent": {"name": "ask_if_bot"}})

1 Like