Actions

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

User Guide

NLU

Core

Conversation Design

API Reference

Migrate from (beta)

Reference

Actions

Actions are the things your bot runs in response to user input. There are four kinds of actions in Rasa:

  1. Utterance actions: start with utter_ and send a specific message to the user.
  2. Retrieval actions: start with respond_ and send a message selected by a retrieval model.
  3. Custom actions: run arbitrary code and send any number of messages (or none).
  4. Default actions: e.g. action_listen, action_restart, action_default_fallback.

Utterance Actions

To define an utterance action (ActionUtterTemplate), add a response to the domain file that starts with utter_:

responses:
  utter_my_message:
    - "this is what I want my action to say!"

It is conventional to start the name of an utterance action with utter_. If this prefix is missing, you can still use the response in your custom actions, but the response can not be directly predicted as its own action. See Responses for more details.

Retrieval Actions

Retrieval actions make it easier to work with a large number of similar intents like chitchat and FAQs. See Retrieval Actions to learn more.

Custom Actions

An action can run any code you want. Custom actions can turn on the lights, add an event to a calendar, check a user’s bank balance, or anything else you can imagine.

Rasa will call an endpoint you can specify, when a custom action is predicted. This endpoint should be a webserver that reacts to this call, runs the code and optionally returns information to modify the dialogue state.

To specify, your action server use the endpoints.yml:

action_endpoint:
  url: "http://localhost:5055/webhook"

And pass it to the scripts using --endpoints endpoints.yml.

You can create an action server in node.js, .NET, java, or any other language and define your actions there - but we provide a small python SDK to make development there even easier.

Default Actions

The available default actions are:

action_listen Stop predicting more actions and wait for user input.
action_restart Reset the whole conversation. Can be triggered during a conversation by entering /restart if the Mapping Policy is included in the policy configuration.
action_session_start Start a new conversation session.
action_default_fallback Undo the last user message and utter a message that the bot did not understand.
action_deactivate_form Deactivate the active form and reset the requested slot.
action_revert_fallback_events Revert events that occurred during the TwoStageFallbackPolicy.
action_default_ask_affirmation Ask the user to affirm their intent.
action_default_ask_rephrase Ask the user to rephrase their intent.
action_back Undo the last user message.

All the default actions can be overridden. To do so, add the action name to the list of actions in your domain:

actions:
- action_default_ask_affirmation

Rasa will then call your action endpoint and treat it as every other custom action.