<commit_before>:desc: Use events in open source library Rasa Core to support functionalities
       like resetting slots, scheduling reminder or pausing a conversation.

.. _events:

Events
======

.. edit-link::

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.



.. contents::
   :local:

General Purpose Events
----------------------

Set a Slot
~~~~~~~~~~

:Short: Event to set a slot on a tracker
:JSON:
    .. literalinclude:: ../../tests/core/test_events.py
      :start-after: # DOCS MARKER SetSlot
      :dedent: 4
      :end-before: # DOCS END
:Class:
    .. autoclass:: rasa.core.events.SlotSet

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

    .. literalinclude:: ../../rasa/core/events/__init__.py
      :dedent: 4
      :pyobject: SlotSet.apply_to


Restart a conversation
~~~~~~~~~~~~~~~~~~~~~~

:Short: Resets anything logged on the tracker.
:JSON:
    .. literalinclude:: ../../tests/core/test_events.py
      :start-after: # DOCS MARKER Restarted
      :dedent: 4
      :end-before: # DOCS END
:Class:
    .. autoclass:: rasa.core.events.Restarted

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

    .. literalinclude:: ../../rasa/core/events/__init__.py
      :dedent: 4
      :pyobject: Restarted.apply_to


Reset all Slots
~~~~~~~~~~~~~~~

:Short: Resets all the slots of a conversation.
:JSON:
    .. literalinclude:: ../../tests/core/test_events.py
      :start-after: # DOCS MARKER AllSlotsReset
      :dedent: 4
      :end-before: # DOCS END
:Class:
    .. autoclass:: rasa.core.events.AllSlotsReset

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

    .. literalinclude:: ../../rasa/core/events/__init__.py
      :dedent: 4
      :pyobject: AllSlotsReset.apply_to


Schedule a reminder
~~~~~~~~~~~~~~~~~~~

:Short: Schedule an intent to be triggered in the future.
:JSON:
    .. literalinclude:: ../../tests/core/test_events.py
      :lines: 1-
      :start-after: # DOCS MARKER ReminderScheduled
      :dedent: 4
      :end-before: # DOCS END
:Class:
    .. autoclass:: rasa.core.events.ReminderScheduled

:Effect:
    When added to a tracker, Rasa Core will schedule the intent to be
    triggered in the future, in place of a user input. You can link
    this intent to an action of your choice using the :ref:`mapping-policy`.

Pause a conversation
~~~~~~~~~~~~~~~~~~~~

:Short: Stops the bot from responding to messages. Action prediction
        will be halted until resumed.
:JSON:
    .. literalinclude:: ../../tests/core/test_events.py
      :start-after: # DOCS MARKER ConversationPaused
      :dedent: 4
      :end-before: # DOCS END
:Class:
    .. autoclass:: rasa.core.events.ConversationPaused

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

    .. literalinclude:: ../../rasa/core/events/__init__.py<commit_msg>Add 'and entities' to ReminderScheduled explanation<commit_after>:desc: Use events in open source library Rasa Core to support functionalities
       like resetting slots, scheduling reminder or pausing a conversation.

.. _events:

Events
======

.. edit-link::

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.



.. contents::
   :local:

General Purpose Events
----------------------

Set a Slot
~~~~~~~~~~

:Short: Event to set a slot on a tracker
:JSON:
    .. literalinclude:: ../../tests/core/test_events.py
      :start-after: # DOCS MARKER SetSlot
      :dedent: 4
      :end-before: # DOCS END
:Class:
    .. autoclass:: rasa.core.events.SlotSet

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

    .. literalinclude:: ../../rasa/core/events/__init__.py
      :dedent: 4
      :pyobject: SlotSet.apply_to


Restart a conversation
~~~~~~~~~~~~~~~~~~~~~~

:Short: Resets anything logged on the tracker.
:JSON:
    .. literalinclude:: ../../tests/core/test_events.py
      :start-after: # DOCS MARKER Restarted
      :dedent: 4
      :end-before: # DOCS END
:Class:
    .. autoclass:: rasa.core.events.Restarted

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

    .. literalinclude:: ../../rasa/core/events/__init__.py
      :dedent: 4
      :pyobject: Restarted.apply_to


Reset all Slots
~~~~~~~~~~~~~~~

:Short: Resets all the slots of a conversation.
:JSON:
    .. literalinclude:: ../../tests/core/test_events.py
      :start-after: # DOCS MARKER AllSlotsReset
      :dedent: 4
      :end-before: # DOCS END
:Class:
    .. autoclass:: rasa.core.events.AllSlotsReset

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

    .. literalinclude:: ../../rasa/core/events/__init__.py
      :dedent: 4
      :pyobject: AllSlotsReset.apply_to


Schedule a reminder
~~~~~~~~~~~~~~~~~~~

:Short: Schedule an intent to be triggered in the future.
:JSON:
    .. literalinclude:: ../../tests/core/test_events.py
      :lines: 1-
      :start-after: # DOCS MARKER ReminderScheduled
      :dedent: 4
      :end-before: # DOCS END
:Class:
    .. autoclass:: rasa.core.events.ReminderScheduled

:Effect:
    When added to a tracker, Rasa Core will schedule the intent (and entities) to be
    triggered in the future, in place of a user input. You can link
    this intent to an action of your choice using the :ref:`mapping-policy`.

Pause a conversation
~~~~~~~~~~~~~~~~~~~~

:Short: Stops the bot from responding to messages. Action prediction
        will be halted until resumed.
:JSON:
    .. literalinclude:: ../../tests/core/test_events.py
      :start-after: # DOCS MARKER ConversationPaused
      :dedent: 4
      :end-before: # DOCS END
:Class:
    .. autoclass:: rasa.core.events.ConversationPaused

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

    .. literalinclude:: ../../rasa/core/events/__init__.py
{'fraction_non_alphanumeric': 0.13519671882120612, 'fraction_numerical': 0.0027343156615524835, 'mean_word_length': 2.823461091753775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3174899', 'n_tokens_mistral': 2065, 'n_tokens_neox': 1942, 'n_words': 712}