Default Actions | Rasa Documentation

Each of these actions have a default behavior

In order to overwrite this default behavior, write a custom action whose name() method returns the same name as the default action:

class ActionRestart(Action):

def name(self) -> Text:
      return "action_restart"

async def run(
      self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
  ) -> List[Dict[Text, Any]]:

# custom behavior

return [...]

Add this action to the actions section of your domain file so your assistant knows to use the custom definition instead of the default one:

actions:
  - action_restart

Action Definitions

action_listen

This action is predicted to signal that the assistant should do nothing and wait for the next user input.

action_restart

This action resets the whole conversation history, including any slots that were set during it. It can be triggered by the user in a conversation by sending a "/restart" message, if the RulePolicy is included in the model configuration. If you define an utter_restart response in your domain, this will be sent to the user as well.

action_session_start

This action starts a new conversation session, and is executed in the following situations:

The action will reset the conversation tracker, but by default will not clear any slots that were set.

Customization

The default behavior of the session start action is to take all existing slots and to carry them over into the next session. To demonstrate how to override this:

from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.events import SlotSet, SessionStarted, ActionExecuted, EventType

class ActionSessionStart(Action):
    def name(self) -> Text:
        return "action_session_start"

@staticmethod
    def fetch_slots(tracker: Tracker) -> List[EventType]:
        slots = []
        for key in ("name", "phone_number"):
            value = tracker.get_slot(key)
            if value is not None:
                slots.append(SlotSet(key=key, value=value))
        return slots

async def run(
      self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
    ) -> List[Dict[Text, Any]]:
        events = [SessionStarted()]
        events.extend(self.fetch_slots(tracker))
        events.append(ActionExecuted("action_listen"))
        return events

action_default_fallback

This action undoes the last user-bot interaction and sends the utter_default response if it is defined. It is triggered by low action prediction confidence, if you have this fallback mechanism enabled.

action_run_slot_rejections

This action runs slot validation rules written directly in the flows yaml file.

action_trigger_search

This action can be used to trigger the Enterprise Search Policy from any flow, rule or story. It works by manipulating the dialogue stack frame.

action_reset_routing

This action is needed for Coexistence of NLU-based and CALM systems. It acts as a softer version of the default action action_restart:

action_clean_stack

This action plays a crucial role in maintaining stack integrity following a bot update.

action_cancel_flow

This action is designed to gracefully terminate an ongoing conversation flow, ensuring a clean and controlled interruption of the current flow.

action_hangup

This action is meant to be used in Voice Conversations to hang up a call.

action_repeat_bot_messages

Verbatim repeat the last bot message. It is currently used for conversation repair in two patterns.

action_default_capabilities

This action generates a user-facing reply that lists the flows currently startable for the active conversation.