Accessing DialogueStateTracker in the channel connector

Is there a way to fetch a tracker via the Rasa python client? We’re trying to access the tracker in our custom channel connector to do some conditional branching on whether a form is active or not.

An option is to query the API directly, but was wondering if there is a way to do it from within the the Rasa python client.

Hi @moaazsidat, do you mean accessing all of the tracker values? Did you try to store it to the database(ex: MongoTrackerStore)? Also can you attach the code for creating the Rasa python client?(how you load the models, nlu interpreter)

Cheers

Yep, we are using a persistent tracker store, regardless of that, there doesn’t seem to be a straightforward way of querying the tracker store in a custom channel connector

We have two apparent choices:

  1. make a request to the rasa core api to fetch the tracker store

    url = f"http://{rasa_host}/conversations/{sender_id}/tracker"
    resp = await requests_async.get(url).json()
    tracker = TrackerState.parse_obj(resp)
    

    This is not ideal because why should the channel connector (running inside the Rasa core python process) make a http request to the Rasa core http api to get access to something inside that process), this can lead to odd raise conditions.

  2. use the Sanic app and rasa’s internal api to query the tracker store inside the blueprint route

    tracker = req.app.agent.tracker_store.retrieve(sender_id)`
    

    This is not ideal because we’re relying on an internal API?

2 Likes

@moaazsidat What did you end up doing? I have same issue.

1 Like