Action class is the base class for any custom action. To
define a custom action, create a subclass of the
and overwrite the two required methods,
action server will call an action according to the return value
name method when it receives a request to run an action.
A skeleton custom action looks like this:
Defines the action's name. The name returned by this method is the one used in your bot's domain.
Name of action
run method executes the side effects of the action.
dispatcher – the dispatcher which is used to send messages back to the user. Use
dispatcher.utter_message()or any other
rasa_sdk.executor.CollectingDispatchermethod. See the documentation for the dispatcher
tracker – the state tracker for the current user. You can access slot values using
tracker.get_slot(slot_name), the most recent user message is
tracker.latest_message.textand any other
rasa_sdk.Trackerproperty. See the documentation for the tracker.
domain – the bot's domain
A list of
rasa_sdk.events.Event instances. See the documentation for events.
In a restaurant bot, if the user says “show me a Mexican restaurant”,
your bot could execute the action
which might look like this:
This action queries a database to find restaurants matching
the requested cuisine, and uses the list of restaurants found
to set the value of the