Skip to main content
A timer store holds session timers. A session timer tracks whether a conversation is still active. Mantle schedules one when a session starts, resets it after each user message, and fires it when the session has had no user message for session_expiration_time minutes. Without a timer_store: section, timers stay in memory. Write your own store when your backend is none of the built-in ones, or subclass the Redis store to change how it behaves.

Before you start

Put your code in a package next to agent.yml: a folder named addons/ with an empty __init__.py file. Start rasa from the project root so the package can be imported.

Subclass SessionTimerStore

Import SessionTimerStore and SessionTimer from rasa.api.timers.v1, and implement every method in the table below.
addons/custom_timer_store.py
This example keeps timers in a dictionary so you can run it as written. Replace the dictionary calls with calls to your backend to share timers between processes. Keep the method signatures. Register the class under timer_store:
integrations.yml
A custom timer store runs with the persistent timer manager. The redis built-in runs with the Redis timer manager instead. poll_interval still sets how often Mantle checks for expired timers.

Subclass the built-in Redis store

To change one behavior of the redis store and keep the rest, subclass RedisSessionTimerStore. This example adds a team field to the metadata of every timer:
addons/custom_redis_timer_store.py
integrations.yml
The Redis keys in timer_store apply to your subclass. Keep type set to the class path, because the built-in name redis selects the built-in class.

Versioning

The import rasa.api.timers.v1 is the version. YAML names only the class. See Custom integrations: Versioning.