Setting Slots outside the Action Class when Using Rasa SDK

Hi everyone,

TL;DR: How do you set a Slot from Python when using the Actions SDK server?

Longer version with context:

I have been following the Rasa documentation to build my bot, but there is one section that I’m finding unclear. In Events the ´Note´ at the start of the page says that if you are running a Custom Action on the SDK you have to use instead of the events from Core. But the two don’t seem interchangable and there is no further information on this. The Event from Core is an instance of a class, and the Event from the SKD is a Dict[Text, Any].

Ultimately, what I’m trying to do is to set a slot from Python, e.g. ‘username’, whilst running all of my actions from an Actions Server. I’m testing this by running:

  1. One script that starts the actions server
  2. Another script sets slot ‘username’ the value ‘Alex’ and then calls a greet intent.
  3. If it worked well, the Actions Server should return: ‘Hello Alex’ instead of the default username value (in this case ‘friend’).

Thank you in advance a lot! I hope you can help!

I solved my issue, for anybody that is interested in the answer, the code goes as follows:

from import UserMessage
from import SlotSet

dst = agent.tracker_store.get_or_create_tracker(UserMessage.DEFAULT_SENDER_ID)
ss = SlotSet('username', 'Alex')

what is the agent? can you elaborate more about it please?