Have problem Triggering rasa intents and custom actions in a independent program


I am working on a rasa related project. My Rasa version is 1.5.3. Rasa agent is loaded in a python program:

from rasa.core.agent import Agent … agent = Agent.load(‘models/’,action_endpoint=action_endpoint)


In the project, there are needs to trigger intents (with entities) and trigger custom actions in my program, which means those shall be done outside rasa actions.

I suppose to achieve these by using trigger_intent() in the class Agent:


Yet I got this error message: AttributeError: ‘Agent’ object has no attribute ‘trigger_intent’

Don’t know what goes wrong.

As to directly trigger an action, I am not sure what method should I use.

Agent.execute_action(), or DialogueStateTracker.trigger_followup_action() ?

As to the latter, I am not sure how to initialize a DialogueStateTracker object properly with a already loaded agent object?

I saw from_dict() and from_event(), searched on google but not yet have clue:


Can anyone help me? Thank you!

You can use the UserUttered event and pass the intent in the text parameter as “/my_intent”.

Thanks for your reply!

The major issue is how create a tracker instance “outside” the rasa action server and corresponds to the currently running conversation. I need to access the slots or entities in an independent program (not in action server), which is not viable without creating (or accessing) a tracker instance. For now I have no clue to figure it how to do or whether it is viable.

If this is not viable, the approach should be what you said, dispatch a UserUttered in an custom action.

It sounds like you may want to write a custom policy but it’s hard for me to tell without understanding your system architecture.

Blockquote[quote=“stephens, post:4, topic:38381, full:true”] It sounds like you may want to write a custom policy but it’s hard for me to tell without understanding your system architecture. [/quote]

Yes, what I am working on is a application based on two_stages_fallback policy (My rasa is 1.5.3 therefore this policy is still there).

This system is handling human speak,therefore the default button confirmation of the rasa two_stages_fallback. The system have to extract the information from rasa (the intent .etc.) outside, then trigger a correspondent intent or custom action; all these have to be done outside action server.

Therefore I try to find whether it is possible to attract the information such as entities,slots (stored in a tracker) outside rasa action server, as well as trigger intents and custom actions.

You can trigger a External Event outside of Rasa and include the intent and include entity values. Here’s an example from the link above:

curl -H "Content-Type: application/json" -X POST \
  -d '{"name": "EXTERNAL_dry_plant", "entities": {"plant": "Orchid"}}' \

Thanks for your reply!

So, the RESTFUL API provided by rasa action server is the only way to access rasa data/actions outside, is it correct?

To do so, the key is to get the conversion_id of the ongoing conversion outside rasa, such as “http://localhost:5005/conversations/{conversion_id }/…”

Would you please teach me how to do this? Thank you!

The example REST call above is not a call to the action server. This is part of the Rasa HTTP API.

You are correct, that the key information you need is the conversation id. You would either need a means of saving the id’s (a custom action, action_session_start or grab it from the Rasa channel). You can also specify the conversation ID from a custom channel or your code that is calling the channel REST endpoint