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


class rasa.core.trackers.DialogueStateTracker(sender_id, slots, max_event_history=None)

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


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

Return type:List[Event]

Return a Dialogue object containing all of the turns.

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

Return type:Dialogue

Activate or deactivate a form

Return type:None

Clears follow up action when it was executed.

Return type:None

Creates a duplicate of this tracker

Return type:DialogueStateTracker

Return the currently set values of the slots

Return type:Dict[str, Any]
current_state(event_verbosity=<EventVerbosity.NONE: 1>)

Return the current tracker state as an object.

Return type:Dict[str, Any]

Return a list of events after the most recent restart.

Return type:List[Event]

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

Returns the dumped tracker as a string.

Return type:str

Dump the tracker as a story to a file.

Return type:None
classmethod from_dict(sender_id, events_as_dict, slots=None, max_event_history=None)

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.

Return type:DialogueStateTracker

Returns a generator of the previous trackers of this tracker.

The resulting array is representing the trackers before each action.

Return type:Generator[DialogueStateTracker, None, None]
get_last_event_for(event_type, action_names_to_exclude=None, skip=0)

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.

Return type:



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.

Return type:Iterator[str]

Get the name of the input_channel of the latest UserUttered event

Return type:Optional[str]

Retrieves the value of a slot.

Return type:Optional[Any]

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

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

Return type:int

Creates a new state tracker with the same initial values.

Return type:DialogueStateTracker

State whether the tracker is currently paused.

Return type:bool
last_executed_action_has(name, skip=0)

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.

Return type:



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

Return type:deque

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.

Return type:None

Notify active form that it was rejected

Return type:None

Update the tracker based on a list of events.

Return type:None

Toggle form validation

Return type:None

Set latest action name and reset form validation and rejection parameters

Return type:None

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.

Return type:DialogueStateTracker

Triggers another action following the execution of the current.

Return type:None
update(event, domain=None)

Modify the state of the tracker according to an Event.

Return type:None