Story Tracker

Hi, I’m trying to find the story tracker (The current tracker state of a story). I mean the current intent or action rasa is firing from which story. Here is a basic story

- story: interactive_story_2
  steps:
  - intent: goodbye
  - action: utter_ask_for_review
  - intent: affirm
  - action: utter_show_C-sat_rating
  - intent: inform
    entities:
    - rating: '3'
  - slot_was_set:
    - rating: '3'
  - action: action_thanks

Suppose, after getting goodbye from the user, rasa will fire the utter_ask_for_review action (or it could be a form), and hence I want to know this, using the tracker in the action.py file as well as the story name too, in this situation it is interactive_story_2. Is it possible? and want to know How does Rasa converts a story into the current tracker state?

Thanks

I’m not sure I understand your question but I think you want to know how to look back at tracker events to determine something like what the last bot utterance was. The tracker consists of a series of events described here. If you want a custom action to look back in the past events for something specific, like the last bot utterance, your custom action would do something like this:

        for e in reversed(tracker.events):
            if e.get("event") == 'bot':
                utter_action = e.get('metadata', {}).get('utter_action')
                logger.debug(f"utter_action: {utter_action}")
                break
1 Like