An Intro to Chatbot Development using RASA

Reading Time: 4 minutes

What is RASA?

RASA is an open-source chatbot framework based on machine learning. With the help of it, we can easily create highly accurate and sophisticated chatbots and can easily integrate these chatbots with our website, Telegram, Facebook, etc.

Before we get into it, let’s look into some simple concepts that we should know while creating a chatbot.


A query is the user message for the chatbot in order to get details of something.


Action is the response from a chatbot based on the query.

How does Rasa work ?

Rasa is an open-source tool that lets you create a whole range of Bots for different purposes. The best feature of Rasa is that it provides different frameworks to handle different tasks. This makes the process elegant and efficient. Let’s divide the tasks of Chatbot into two main groups :

  1. Understand the question of the user, what answer he is expecting .
  2. Maintain the conversation flow, i.e reply to him based on the question/query and converse further.

Rasa provides two amazing frameworks to handle these tasks separately, Rasa NLU and Rasa Core. In simple terms, Rasa NLU and Rasa Core are the two pillars of our ChatBot. For our case, I will be using both NLU and Core, though it is not compulsory. Let’s first understand and develop the NLU part and then proceed to the Core part.

  • Intent : Identifying the intent/purpose of the user’s meassage. For example, consider “Can I order food now ?” is the input message. The intent of this message is to place order. NLU will have to rightly identify this. This is termed as Intent classification.
  • Entity : Input messages may contain information like name ,place etc.. These are details which need to be extracted. For example, consider “I want to book a table on the name of Sinduja”. You need extract the name “Sinduja” which is an entity.
Architecture Of RASA

Installing RASA on Linux

Create a new virtual environment by choosing a Python interpreter and making a ./venv directory to hold it:

python3 -m venv ./venv

Activate the virtual environment:

source ./venv/bin/activate

Install Rasa Open Source using pip (requires Python 3.7, or 3.8).

pip3 install -U --user pip && pip3 install rasa

Next is to initialize our project:

rasa init

Several new files will be created after the initialization of the project. The file structure will be:

Let’s Examine the file structure and get ideas for different files. RASA fills these files with standard text. The important files are as follows:


For a bot to recognize what a user is saying no matter how the user phrases their message, we need to provide example messages the assistant can learn from. We group these examples according to the idea or the goal the message is expressing, which is also called the intent. In the code block on the right, we have added an intent called greet, which contains example messages like “Hi”, “Hey”, and “good morning”. Intents and their examples are used as training data for the assistant’s Natural Language Understanding (NLU) model.


This file contains different bot responses, lists all the intents and entities used while creating the nlu.yml file.


Stories are example conversations that train an assistant to respond correctly depending on what the user has said previously in the conversation. The story format shows the intent of the user message followed by the assistant’s action or response.

This is the python file to run the custom actions. This file can be used for an API call or database querying


Rules describe parts of conversations that should always follow the same path no matter what has been said previously in the conversation.

We want our assistant to always respond to a certain intent with a specific action, so we use a rule to map that action to the intent

Training the Model

We can train our model based on the data we provided in the above files.

rasa train

When you run the above code in the terminal, rasa will start training both the nlu model and the core model and save the trained model in the model folder. Now let’s check the function of the bot. You can interact with your bot in the command shell

rasa shell

This command allows Rasa to load the trained model and interact with the bot in the shell. We can stop this rasa shell either by ctrl+c or by typing “/stop”.


This blog was all about creating a simple and basic chatbot. We hope you understand how the RASA chatbot works. The development of end-to-end chatbots will be discussed in the next article.