Events

These docs are for version 1.x of Rasa Open Source.

Events

Conversations in Rasa are represented as a sequence of events. This page lists the event types defined in Rasa Core.

Note
If you are using the Rasa SDK to write custom actions in python, you need to import the events from rasa_sdk.events, not from rasa.core.events. If you are writing actions in another language, your events should be formatted like the JSON objects on this page.

General Purpose Events

Set a Slot

Short
Event to set a slot on a tracker

JSON

{
    "event": "slot",
    "name": "departure_airport",
    "value": "BER"
}

Class: rasa.core.events.SlotSet
The user has specified their preference for the value of a slot.

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

def apply_to(self, tracker: "DialogueStateTracker") -> None:
    tracker._set_slot(self.key, self.value)

Restart a conversation

Short
Resets anything logged on the tracker.

JSON

{
    "event": "restart"
}

Class: rasa.core.events.Restarted
Conversation should start over & history wiped.

Effect

def apply_to(self, tracker: "DialogueStateTracker") -> None:
    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: rasa.core.events.AllSlotsReset
All Slots are reset to their initial values.

Effect

def apply_to(self, tracker) -> None:
    tracker._reset_slots()

Schedule a reminder

Short
Schedule an intent to be triggered in the future.

JSON

{
    "event": "reminder",
    "intent": "my_intent",
    "entities": {"entity1": "value1", "entity2": "value2"},
    "date_time": "2018-09-03T11:41:10.128172",
    "name": "my_reminder",
    "kill_on_user_msg": true
}

Class: rasa.core.events.ReminderScheduled
Schedules the asynchronous triggering of a user intent.

Effect

def apply_to(self, tracker: "DialogueStateTracker") -> None:
    # Code to schedule the intent

Cancel a reminder

Short
Cancel one or more reminders.

JSON

{
    "event": "cancel_reminder",
    "name": "my_reminder",
    "intent": "my_intent",
    "entities": [{"entity": "entity1", "value": "value1"},{"entity": "entity2", "value": "value2"}],
    "date_time": "2018-09-03T11:41:10.128172"
}

Class: rasa.core.events.ReminderCancelled
Cancel certain jobs.

Effect

def apply_to(self, tracker) -> None:
    # Code to cancel reminders

Pause a conversation

Short
Stops the bot from responding to messages.

JSON

{
    "event": "pause"
}

Class: rasa.core.events.ConversationPaused
Ignore messages from the user to let a human take over.

Effect

def apply_to(self, tracker) -> None:
    tracker._paused = true

Resume a conversation

Short
Resumes a previously paused conversation.

JSON

{
    "event": "resume"
}

Class: rasa.core.events.ConversationResumed
Bot takes over conversation.

Effect

def apply_to(self, tracker) -> None:
    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: rasa.core.events.FollowupAction
Enqueue a followup action.

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": []
    },
    "metadata": {}
}

Class: rasa.core.events.UserUttered
The user has said something to the bot.

Effect

def apply_to(self, tracker: "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: rasa.core.events.BotUttered
The bot has said something to the user.

Effect

def apply_to(self, tracker: "DialogueStateTracker") -> None:
    tracker.latest_bot_utterance = self

Undo a user message

Short
Undoes all side effects that happened after the last user message.

JSON

{
    "event": "rewind"
}

Class: rasa.core.events.UserUtteranceReverted
Bot reverts everything until before the most recent user message.

Effect

def apply_to(self, tracker: "DialogueStateTracker") -> None:
    tracker._reset()
    tracker.replay_events()

Undo an action

Short
Undoes all side effects that happened after the last action.

JSON

{
    "event": "undo"
}

Class: rasa.core.events.ActionReverted
Bot undoes its last action.

Effect

def apply_to(self, tracker: "DialogueStateTracker") -> None:
    tracker._reset()
    tracker.replay_events()

Log an executed action

Short
Logs an action the bot executed to the conversation.

JSON

{
    "event": "action",
    "name": "my_action"
}

Class: rasa.core.events.ActionExecuted
An operation describes an action taken + its result.

Effect

def apply_to(self, tracker: "DialogueStateTracker") -> None:
    tracker.set_latest_action_name(self.action_name)
    tracker.clear_followup_action()

Start a new conversation session

Short
Marks the beginning of a new conversation session.

JSON

{
    "event": "session_started"
}

Class: rasa.core.events.SessionStarted
Mark the beginning of a new conversation session.

Effect

def apply_to(self, tracker: "DialogueStateTracker") -> None:
    tracker._reset()