in_memory, redis, mongod, sql, and
dynamo stores. Write your own when your database is none of those, or subclass
a built-in to change how it behaves.
Before you start
Put your code in a package next toagent.yml: a folder named addons/ with an
empty __init__.py file. Start rasa from the project root so the package can
be imported.
Subclass BaseTrackerStore
Import BaseTrackerStore and DialogueStateTracker from rasa.api.tracker.v1.
Implement the four methods in the table below. BaseTrackerStore provides the
rest, including creating the tracker for a new conversation and the session
handling around each save.
addons/custom_tracker_store.py
deserialise_tracker reads JSON only.
The conversation id is the same value in both methods. The tracker stores it as
sender_id. retrieve_tracker names that argument conversation_id.
BaseTrackerStore builds retrieve_full_tracker, keys, and exists on top of
the four required methods, so you do not implement them.
Register the class under tracker_store:
integrations.yml
Subclass the built-in Redis store
To change one behavior of theredis store and keep the rest, subclass
RedisTrackerStore. This example skips saving conversations from a test harness,
so they do not fill the database. The sender IDs of those conversations start
with test-.
addons/custom_redis_tracker_store.py
integrations.yml
tracker_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 importrasa.api.tracker.v1 is the version. YAML names only the class. See
Custom integrations: Versioning.