Events

List of all the events the dialogue system is able to handle and supports.

Most of the time, you will set or receive events in their json representation. E.g. if you are modifying a conversation over the HTTP API, or if you are implementing your own action server.

General purpose events

Event Base Class

Short:

Base class for all of Rasa Core’s events. Can not directly be used!

Description:

Contains common functionality for all events. E.g. it ensures, that every event has a timestamp and a event attribute that describes the type of the event (e.g. slot for the slot setting event).

Class:
class rasa_core.events.Event(timestamp=None)[source]

Events describe everything that occurs in a conversation and tell the rasa_core.trackers.DialogueStateTracker how to update its state.

Set a Slot

Short:

Event to set a slot on a tracker

JSON:
{
    'event': 'slot',
    'name': 'departure_airport',
    'value': 'BER',
}
Class:
class rasa_core.events.SlotSet(key, value=None, timestamp=None)[source]

The user has specified their preference for the value of a slot.

Every slot has a name and a value. This event can be used to set a value for a slot on a conversation.

As a side effect the Tracker’s slots will be updated so that tracker.slots[key]=value.

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        tracker._set_slot(self.key, self.value)

Restart a conversation

Short:

Resets anything logged on the tracker.

JSON:
{
    'event': 'restart'
}
Class:
class rasa_core.events.Restarted(timestamp=None)[source]

Conversation should start over & history wiped.

Instead of deleting all events, this event can be used to reset the trackers state (e.g. ignoring any past user messages & resetting all the slots).

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        from rasa_core.actions.action import ACTION_LISTEN_NAME
        tracker._reset()
        tracker.trigger_followup_action(ACTION_LISTEN_NAME)

Reset all Slots

Short:

Resets all the slots of a conversation.

JSON:
{
    'event': 'reset_slots'
}
Class:
class rasa_core.events.AllSlotsReset(timestamp=None)[source]

All Slots are reset to their initial values.

If you want to keep the dialogue history and only want to reset the slots, you can use this event to set all the slots to their initial values.

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        tracker._reset_slots()

Schedule a reminder

Short:

Schedule an action to be executed in the future.

JSON:
{
    'event': 'reminder',
    'action': 'my_action',
    'date_time': '2018-09-03T11:41:10.128172',
    'name': 'my_reminder',
    'kill_on_user_msg': True
}
Class:
class rasa_core.events.ReminderScheduled(action_name, trigger_date_time, name=None, kill_on_user_message=True, timestamp=None)[source]

Allows asynchronous scheduling of action execution.

As a side effect the message processor will schedule an action to be run at the trigger date.

Effect:

When added to a tracker, core will schedule the action to be run in the future.

Pause a conversation

Short:

Stops the bot from responding to messages. Action prediction will be halted until resumed.

JSON:
{
    'event': 'pause',
}
Class:
class rasa_core.events.ConversationPaused(timestamp=None)[source]

Ignore messages from the user to let a human take over.

As a side effect the Tracker’s paused attribute will be set to True.

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        tracker._paused = True

Resume a conversation

Short:

Resumes a previously paused conversation. The bot will start predicting actions again.

JSON:
{
    'event': 'resume',
}
Class:
class rasa_core.events.ConversationResumed(timestamp=None)[source]

Bot takes over conversation.

Inverse of PauseConversation. As a side effect the Tracker’s paused attribute will be set to False.

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        tracker._paused = False

Force a followup action

Short:

Instead of predicting the next action, force the next action to be a fixed one.

JSON:
{
    'event': 'followup',
    'name': 'my_action'
}
Class:
class rasa_core.events.FollowupAction(name, timestamp=None)[source]

Enqueue a followup action.

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        # type: (DialogueStateTracker) -> None
        tracker.trigger_followup_action(self.action_name)

Automatically tracked events

User sent message

Short:

Message a user sent to the bot.

JSON:
{
    'event': 'user',
    'text': 'Hey',
    'parse_data': {
        'intent': {'name': 'greet', 'confidence': 0.9},
        'entities': []
    }
}
Class:
class rasa_core.events.UserUttered(text, intent=None, entities=None, parse_data=None, timestamp=None, input_channel=None)[source]

The user has said something to the bot.

As a side effect a new Turn will be created in the Tracker.

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        # type: (DialogueStateTracker) -> None

        tracker.latest_message = self
        tracker.clear_followup_action()

Bot responded message

Short:

Message a bot sent to the user.

JSON:
{
    'event': 'bot',
    'text': 'Hey there!',
    'data': {}
}
Class:
class rasa_core.events.BotUttered(text=None, data=None, timestamp=None)[source]

The bot has said something to the user.

This class is not used in the story training as it is contained in the

ActionExecuted class. An entry is made in the Tracker.

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        # type: (DialogueStateTracker) -> None

        tracker.latest_bot_utterance = self

Undo a user message

Short:

Undoes all side effects that happened after the last user message (including the user event of the message).

JSON:
{
    'event': 'rewind'
}
Class:
class rasa_core.events.UserUtteranceReverted(timestamp=None)[source]

Bot reverts everything until before the most recent user message.

The bot will revert all events after the latest UserUttered, this also means that the last event on the tracker is usually action_listen and the bot is waiting for a new user message.

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        # type: (DialogueStateTracker) -> None

        tracker._reset()
        tracker.replay_events()

Undo an action

Short:

Undoes all side effects that happened after the last action (including the action event of the action).

JSON:
{
    'event': 'undo',
}
Class:
class rasa_core.events.ActionReverted(timestamp=None)[source]

Bot undoes its last action.

The bot everts everything until before the most recent action. This includes the action itself, as well as any events that action created, like set slot events - the bot will now predict a new action using the state before the most recent action.

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        # type: (DialogueStateTracker) -> None

        tracker._reset()
        tracker.replay_events()

Log an executed action

Short:

Logs an action the bot executed to the conversation. Events that action created are logged separately.

JSON:
{
    'event': 'action',
    'name': 'my_action'
}
Class:
class rasa_core.events.ActionExecuted(action_name, policy=None, confidence=None, timestamp=None)[source]

An operation describes an action taken + its result.

It comprises an action and a list of events. operations will be appended to the latest Turn in the Tracker.turns.

Effect:

When added to a tracker, this is the code used to update the tracker:

    def apply_to(self, tracker):
        # type: (DialogueStateTracker) -> None

        tracker.set_latest_action_name(self.action_name)
        tracker.clear_followup_action()

Have questions or feedback?

We have a very active support community on Rasa Community Forum that is happy to help you with your questions. If you have any feedback for us or a specific suggestion for improving the docs, feel free to share it by creating an issue on Rasa Core GitHub repository.