In this blog you will learn,
1. How to create the custom actions on Rasa X
2. How to deploy action server with Rasa X on the Live Server
3. How to add the services on the server that can run simultaneously
In our previous blog, you must have learnt how you can link your rasa project on git repository to Rasa X. Also, you must have noticed that after the successful linking of your git repository to Rasa X you must not be getting any output from the bot side every time your bot have to take a custom action to reply back. That is because to get a reply from the custom action you have to first setup the action server on the GCP VM instance to accept the dynamic actions.
Now, let’s create and understand how to create and setup the custom actions on to deploy action server with Rasa X. You can use our project for reference to deploy action server with rasa x.
create the custom actions on Rasa X
To setup the action server with Rasa X you must setup the action server on the VM instance you are working on. For that first open the terminal and remotely access the GCP instance like we have done before.
As you can see in the above image you have to go to the project directory where we have already setup the Rasa X. Here, you have to create a new directory with the name actions and inside that create the actions.py script. Also, write the program in this script to use the custom actions with the given commands.
Now it will open the editor for you, here add the code you are using with your rasa project to make your actions work. Like we have done here:
from typing import Any, Text, Dict, List from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher class ActionHelloWorld(Action): def name(self) -> Text: return "action_tell_name" def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(template='utter_name') return 
Now save it and now create a new docker-compose override file and add the services to it like given below.
version: "3.4" services: app: image: "rasa/rasa-sdk:latest" volumes: - './actions:/app/actions' expose: - '5055' depends_on: - rasa-production
Once you have added everything now save it and exit. Now when you have done everything successfully it’s time to run all the services with the given command.
docker-compose up -d
and if you already have all the services up and running then you should first stop all the services and run it with the given commands.
docker-compose down docker-compose up -d
Now, it will run all the services including the one which is needed to deploy action server with rasa x. For more clarification and demonstration check our video here:
Now when you will talk to your chatbot on the VM instance of your GCP account you will see that you chatbot is now capable to take the custom actions and to reply you back with respect to that.
Now you can see that your bot is working as per the project that you have on your git repository which we just linked to Rasa x on Google Cloud Platform along with the deployment of action server with rasa x up and running which will allow your chatbot to perform custom actions(like booking a cab, ordering a pizza, check the live status of your train, etc.) for you.
For any doubts or queries related to the DEPLOYMENT OF ACTION SERVER WITH RASA X ON GOOGLE CLOUD PLATFORM feel free to leave a comment below in the comment section. Also, do comment your valuable feedback to appreciate us. For any further information or queries, you can also WhatsApp me at +91 8209829808.
Stay tuned and happy learning. 😉