Detecting that a story has ended

I am quite new to Rasa, and am currently writing a chat bot based on it with a backend in node.js and using rasa as a docker container (1.x). It’s working pretty nice after I understood how the actions and predicitions need to be handled using the API, but now I have this issue: How do I detect that a story has ended, using the HTTP API?

I currently just see that the next best action seems to always be action_listen, but how do I know that I have reached the end of the conversation and that I should restart the conversation?

Hi @DonMartin76, There isn’t really a way to detect whether a story has finished. Conversations aren’t required to strictly follow what’s been defined in stories. You could do so by just training with the MemoizationPolicy (not Keras). You could set a slot at the end of your stories, request the tracker from the http api, and check whether the slot has been set. To do this, please check out the docs on Slots.

I hope that helps!

1 Like

OK, that certainly helps. It’s not what I expected, but that should be feasible. As an alternative, I could also create a custom action which in my service would create a new conversation ID; does that sound like a good idea, or is that a stupid one?

1 Like

I also found the following possibility, which seems to work pretty well: I simply add action_restart to the end of the story, and that does what I want. At least for now.

1 Like

Great, I’m glad this solution works for you!

all the conversation that is stored in the database will be deleted by action_restart.

@talhashaikh5 can you clarify what you mean? An action_restart does not delete the tracker history.

@ricwo after action_restart i was unable to get all the messages from http://localhost:5005/conversations/ali/tracker but messages are present in the database

By default, that endpoint only returns messages after the last restart. You can request all messages by changing your query URL to


See the docs on that endpoint here: HTTP API

1 Like

@ricwo Thanks a lot, Your reply solved many of my problems.