5 steps to bring DevX automation to your company
Get the guide

Developing a Rasa chatbot in Okteto

Rasa is a Python framework for training and building an AI-powered chatbot integrated into various platforms.

Training and building AI-powered applications such as chatbots can be expensive. It requires high computational power and supported firmware. Okteto provides you with a development environment where you can train, build and deploy your models remotely on the Cloud.

In this article, we’ll show you how you can build a simple rasa chatbot, Oktebot, remotely in Okteto.

Want to see this built live? Watch the recorded live-stream on our Youtube channel!


To follow this tutorial, you should have:

  • An Okteto Cloud account (It’s free! )
  • Okteto CLI installed
  • Basic knowledge of Python

Setting up

We’ll start by creating a project directory to house our application:

$ mkdir oktebot
$ cd oktebot

Building Oktebot in Okteto’s development environment

Now that we have created the project directory, the next step is to sign in to our Okteto account via Okteto CLI from our local terminal:

$ okteto context use https://cloud.okteto.com

In the project directory, we’ll create an Okteto manifest as the first step in creating our development container:

$ okteto init

The first prompt asks us to select the language we'll be working with:

Select a language

This is to enable Okteto provide the necessary tooling for our remote development session.

In the next prompt from the command above, select Use default values:

Select the resource you want to develop:
  ▸ Use default values

In the newly created manifest file, okteto.yml, modify the image name:

image: rasa/rasa

We have successfully created the manifest file. The next step is to start our development container and select Python as the default language in the prompt:

$ okteto up

The okteto up command creates a new development container in your dashboard from the parameters included in the okteto.yml manifest file and then starts a remote development session:

i  Using youngestdev @ cloud.okteto.com as context
 ✓  Persistent volume successfully attached
 ✓  Images successfully pulled
 ✓  Files synchronized
    Context:   cloud.okteto.com
    Namespace: youngestdev
    Name:      oktebot
    Forward:   8080 -> 8080
    Reverse:   9000 <- 9000


In the remote development container, we’ll create a new rasa bot in the project directory:

root@oktebot-okteto-7bbddd5c59-d7bmx:~# rasa init

In the prompt in the remote terminal, select the current directory and train the initial model:

? Please enter a path where the project will be created [default: current direct
? Directory’/app’ is not empty. Continue? (Y/n) Y
? Do you want to train an initial model? Y

Once the training is complete, the rasa tool prompts us to ask if we’d like to speak to the trained assistant:

Do you want to speak to the trained assistant on the command line? Y

Let’s speak with the trained assistant:

Default assistant

Training Oktebot

The data folder contains our bot's training data and responses in our project folder. There are three files currently present:

  1. nlu.yml: This file contains the sample data for Natural Language Understanding.
  2. stories.yml: This file includes example conversations with the bot to train the assistant to respond correctly depending on the preceding text.
  3. domain.yml: This file defines the scenario in which the bot acts. This file defines intents from our NLU files and accompanying responses.

Now that we have successfully created our chatbot, let’s train the bot with our data. In the data folder, create two new files from your remote development container terminal:

root@oktebot-okteto-7bbddd5c59-d7bmx:~# touch {chat,faq}.yml

The newly created files will contain the intent and examples for training our bot similar to nlu.yml. The chat.yml file will house the intent for when a user starts a conversation with the bot, and faq.yml will contain the training data for when a user asks a question.

In the chat.yml file, add the following:

version: "3.0"

  - intent: chat/hello
    examples: |
      - How can we help
      - we're glad we can help
      - please hold on while I get you an engineer
      - glad you love okteto

  - intent: chat/bye
    examples: |
      - do come back next time

  - intent: chat/sales
    examples: |
      - the sales rep will respond in a moment
      - you can pay using your credit card too
      - schedule a meeting with our sales team

In the code block above, we have defined three conversation intents in our chatbot. The examples listed are used to train the bot to respond appropriatelys to a similar message.

In faq.yml, add the following:

version: "3.0"

  - intent: faq/more_resources
    examples: |
      - how much does the developer pro plan cost
      - I'll like to increase my bandwidth
      - What plans can give more benefit than the free plan
      - I'm hitting my limits easily. What can I do

  - intent: faq/plan_expires
    examples: |
      - what happens after my plan expires
      - can i renew my subscription

  - intent: faq/application_status
    examples: |
      - what happens to my applications after 24 hours
      - how can i check my deployment

  - intent: faq/restart_application
    examples: |
      - how can i restart my application
      - my application is asleep

In the code block above, we have defined three frequently asked questions ( FAQ ) intents in our chatbot. The examples listed are used to train the bot to respond to a similar message properly.

With the natural learning understanding files populated, let’s update the rules.yml guiding the chatbot. In rules.yml, add the following:

version: "3.0"


- rule: Say goodbye anytime the user says goodbye
  - intent: goodbye
  - action: utter_goodbye

- rule: faq
    - intent: faq
    - action: utter_faq

- rule: chat
    - intent: chat
    - action: utter_chat

Lastly, let’s update the stories in stories.yml:

version: "3.0"


- story: faq
    - intent: greet
    - action: utter_greet
    - intent: faq
    - action: utter_faq

- story: chat
    - intent: greet
    - action: utter_greet
    - intent: chat
    - action: utter_chat

To wrap up the training data, let’s update the domain.yml file in the project directory:

version: "3.0"

  - greet
  - chat
  - goodbye
  - affirm
  - deny
  - faq

  - text: "Hi! How can I help you today?"

  - text: "Hi, welcome to Oktebot. How may I be of help?"

  - text: "Thanks for stopping by!"

  - text: "The sales rep will respond in a moment"

  - text: "We hope you enjoy the Okteto platform!"

  - text: "Did that help you?"

  - text: "Great, carry on!"

  - text: "Bye. See you soon!"

  - text: "You can request for more resources by either changing your plan or contacting the team at support@okteto.com"

  - text: "Your account automatically reverts to the free developer plan once the previous plan expires. You can renew to avoid that"

  - text: "Your application automatically goes to sleep after 24 hours of inactivity on the free plan only"

    - text: "You can restart your application from the dashboard or wake them by visiting the endpoint"

  session_expiration_time: 60
  carry_over_slots_to_new_session: true

By updating the domain.yml, we have updated the intent and responses our bot returns.

Retraining our bot

After populating our sample training data, the next step is to train the bot. Run the command in your development environment shell:

root@oktebot-okteto-7bbddd5c59-d7bmx:~# rasa train

Your Rasa model is trained and saved at 'models/20220113-053154-formal-sequence.tar.gz'.

Now that we have retrained our bot, we can test it from the shell:

root@oktebot-okteto-7bbddd5c59-d7bmx:~# rasa shell

Oktebot in action.

We have interacted with the bot in the screenshot above, and it works according to the trained data. We can now exit the development container and start it whenever we introduce a model before deploying it.

The chatbot files created in our development environment are now available locally. This is as a result of the synchronization feature.


This article taught you how to train, build, and test a Rasa chatbot remotely using Okteto’s development environment. You also learned how Okteto synchronizes from the development environment to your local environment and vice versa.

Now that you have learned how to train and develop a rasa chatbot in Okteto, create a personal virtual assistant using rasa in Okteto and share it with us on our slack channel. You can find the code used for this article on GitHub.

Abdulazeez Abdulazeez AdeshinaDeveloper Advocate / The ProfessorView all posts

How Developers Can Seamlessly Collaborate When Building Microservice Apps

Building microservices based applications is inherently challenging. Given the multitude of components involved, it is unrealistic to expect any individual...

October 10, 2023
Avatar of Arsh SharmaAvatar of Arsh SharmaArsh Sharma

Slash Your Kubernetes Costs During Development

Using Kubernetes can be quite costly, to be frank. Regardless of the cloud provider you choose for your cluster, there are expenses associated with the...

September 26, 2023
Avatar of Arsh SharmaAvatar of Arsh SharmaArsh Sharma