Events
Conversations in Rasa are represented as a sequence of events. Custom actions can influence the course of a conversation by returning events in the response to the action server request.
Not all events are typically returned by custom actions since they are tracked automatically by Rasa (e.g. user messages). Others events can only be tracked if they are returned by a custom action.
Event Types
slot
Sets a slot on the tracker. It can set a slot to a value,
or reset a slot by setting its value to null
.
Automatic Tracking:
- When a slot is filled by an entity of the same name.
A custom action is needed to set any slot not auto-filled by an entity.
JSON:
Parameters:
name
: Name of the slot to setvalue
: Value to set the slot to. The datatype must match the type of the slot
Rasa Open Source Class: rasa.core.events.SlotSet
reset_slots
Resets all slots on the tracker to null
.
Automatic Tracking: Never
JSON:
Rasa Open Source Class: rasa.core.events.AllSlotsReset
reminder
Schedules an intent to be triggered at a certain time in the future.
Automatic Tracking: Never
JSON:
Parameters:
intent
: Intent which the reminder will triggerentities
: Entities to send with the intentdate_time
: Date at which the execution of the action should be triggered. This should either be in UTC or include a timezone.name
: ID of the reminder. If there are multiple reminders with the same id only the last will be run.kill_on_user_msg
: Whether a user message before the trigger time will abort the reminder
Rasa Open Source Class: rasa.core.events.ReminderScheduled
cancel_reminder
Cancels a scheduled reminder or reminders. All reminders which match the supplied parameters will be cancelled.
Automatic Tracking: Never
JSON:
Parameters:
intent
: Intent which the reminder will triggerentities
: Entities to send with the intentdate_time
: Date at which the execution of the action should be triggered. This should either be in UTC or include a timezone.name
: ID of the reminder.
Rasa Open Source Class: rasa.core.events.ReminderCancelled
pause
Stops the bot from responding to user messages. The conversation will remain paused and no actions will be predicted until the conversation is explicitly resumed.
Automatic Tracking: Never
JSON:
Rasa Open Source Class: rasa.core.events.ConversationPaused
resume
Resume a previously paused conversation. Once this event is added to the tracker the bot will start predicting actions again. It will not predict actions for user messages received while the conversation was paused.
Automatic Tracking: Never
JSON:
Rasa Open Source Class: rasa.core.events.ConversationResumed
followup
Force a follow up action, bypassing action prediction.
Automatic Tracking: Never
JSON:
Parameters:
name
: The name of the follow up action that will be executed.
Rasa Open Source Class: rasa.core.events.FollowupAction
rewind
Reverts all side effects of the last user message and removes the last user
event from the tracker.
Automatic Tracking:
JSON:
Rasa Open Source Class: rasa.core.events.UserUtteranceReverted
undo
Undoes all side effects of the last bot action and removes the last bot action from the tracker.
Automatic Tracking:
JSON:
Rasa Open Source Class: rasa.core.events.ActionReverted
restart
Resets the tracker. After a restart
event, there will be no conversation history and no record of the restart.
Automatic Tracking:
- When the
/restart
default intent is triggered.
JSON:
Rasa Open Source Class: rasa.core.events.Restarted
session_started
Starts a new conversation by resetting the tracker and running the default action ActionSessionStart
. This action will by default carry over existing SlotSet
events to a new conversation session. You can configure this behaviour in your domain file under session_config
.
Automatic Tracking:
- Whenever a user starts a conversation with the bot for the first time.
- Whenever a session expires (after
session_expiration_time
specified in the domain), and the user resumes their conversation
Restarting a conversation with restart
event does not automatically cause a session_started
event.
JSON:
Rasa Open Source Class: rasa.core.events.SessionStarted
user
The user sent a message to the bot.
Automatic Tracking:
- When the user sends a message to the bot.
This event is not usually returned by a custom action.
JSON:
Parameters:
text
: Text of the user messageparse_data
: Parsed data of user message. This is ordinarily filled by NLU.metadata
: Arbitrary metadata that comes with the user message
Rasa Open Source Class: rasa.core.events.UserUttered
bot
The bot sent a message to the user.
Automatic Tracking:
- Whenever
responses
are returned by a custom action - Whenever responses are sent to the user directly without being returned by a custom action (e.g.
utter_
actions)
This event is not usually returned explicitly by a custom action; responses
would be returned instead.
JSON:
Parameters:
text
: The text the bot sends to the userdata
: Any non-text elements of the bot response. The structure ofdata
matches that ofresponses
given in the API spec.
Rasa Open Source Class: rasa.core.events.BotUttered
action
Logs an action called by the bot. Only the action itself is logged; the events that the action creates are logged separately when they are applied.
Automatic Tracking:
- Any action (including custom actions and responses) that is called, even if the action does not execute succesfully.
This event is not usually returned explicitly by a custom action.
JSON:
Parameters:
name
: Name of the action that was called
Rasa Open Source Class: rasa.core.events.ActionExecuted