Warning: This document is for an old version of Rasa Core. The latest version is 0.14.5.

Dialogue State Tracker

The tracker stores and maintains the state of the dialogue with a single user. It is stored in a tracker store, retrieved when incoming messages for the conversation are received and updated after actions have been executed

Here we go:

class rasa_core.trackers.DialogueStateTracker(sender_id, slots, max_event_history=None)[source]

Bases: object

Maintains the state of a conversation.

The field max_event_history will only give you these last events, it can be set in the tracker_store

applied_events() → List[rasa_core.events.Event][source]

Returns all actions that should be applied - w/o reverted events.


Return a Dialogue object containing all of the turns.

This can be serialised and later used to recover the state of this tracker exactly.

change_form_to(form_name: str) → None[source]

Activate or deactivate a form


Clears follow up action when it was executed.


Creates a duplicate of this tracker


Return the currently set values of the slots

current_state(event_verbosity: rasa_core.trackers.EventVerbosity = <EventVerbosity.NONE: 1>) → Dict[str, Any][source]

Return the current tracker state as an object.


Return a list of events after the most recent restart.

export_stories(e2e=False) → str[source]

Dump the tracker as a story in the Rasa Core story format.

Returns the dumped tracker as a string.

export_stories_to_file(export_path: str = 'debug.md') → None[source]

Dump the tracker as a story to a file.

classmethod from_dict(sender_id: str, events_as_dict: List[Dict[str, Any]], slots: List[rasa_core.slots.Slot], max_event_history: Optional[int] = None) → rasa_core.trackers.DialogueStateTracker[source]

Create a tracker from dump.

The dump should be an array of dumped events. When restoring the tracker, these events will be replayed to recreate the state.

classmethod from_events(sender_id: str, evts: List[rasa_core.events.Event], slots: List[rasa_core.slots.Slot], max_event_history: Optional[int] = None)[source]

Returns a generator of the previous trackers of this tracker.

The resulting array is representing the trackers before each action.

get_last_event_for(event_type: Type[rasa_core.events.Event], action_names_to_exclude: List[str] = None, skip: int = 0) → Optional[rasa_core.events.Event][source]

Gets the last event of a given type which was actually applied.


event_type: The type of event you want to find. action_names_to_exclude: Events of type ActionExecuted which

should be excluded from the results. Can be used to skip action_listen events.

skip: Skips n possible results before return an event.

event which matched the query or None if no event matched.
get_latest_entity_values(entity_type: str) → Iterator[str][source]

Get entity values found for the passed entity name in latest msg.

If you are only interested in the first entity of a given type use next(tracker.get_latest_entity_values(“my_entity_name”), None). If no entity is found None is the default result.

get_latest_input_channel() → Optional[str][source]

Get the name of the input_channel of the latest UserUttered event

get_slot(key: str) → Optional[Any][source]

Retrieves the value of a slot.


Return the idx of the most recent restart in the list of events.

If the conversation has not been restarted, 0 is returned.


Creates a new state tracker with the same initial values.

is_paused() → bool[source]

State whether the tracker is currently paused.

last_executed_action_has(name: str, skip=0) → bool[source]

Returns whether last ActionExecuted event had a specific name.

name: Name of the event which should be matched. skip: Skips n possible results in between.
True if last executed action had name name, otherwise False.
past_states(domain: Domain) → collections.deque[source]

Generate the past states of this tracker based on the history.

recreate_from_dialogue(dialogue: rasa_core.conversation.Dialogue) → None[source]

Use a serialised Dialogue to update the trackers state.

This uses the state as is persisted in a TrackerStore. If the tracker is blank before calling this method, the final state will be identical to the tracker from which the dialogue was created.

reject_action(action_name: str) → None[source]

Notify active form that it was rejected


Update the tracker based on a list of events.

set_form_validation(validate: bool) → None[source]

Toggle form validation

set_latest_action_name(action_name: str) → None[source]

Set latest action name and reset form validation and rejection parameters

travel_back_in_time(target_time: float) → rasa_core.trackers.DialogueStateTracker[source]

Creates a new tracker with a state at a specific timestamp.

A new tracker will be created and all events previous to the passed time stamp will be replayed. Events that occur exactly at the target time will be included.

trigger_followup_action(action: str) → None[source]

Triggers another action following the execution of the current.

update(event: rasa_core.events.Event) → None[source]

Modify the state of the tracker according to an Event.

class rasa_core.trackers.EventVerbosity[source]

Bases: enum.Enum

Filter on which events to include in tracker dumps.

ALL = 4
NONE = 1