This is documentation for Rasa & Rasa Pro Documentation v2.x, which is no longer actively maintained.
For up-to-date documentation, see the latest version (3.x).

Version: 2.x

Rasa Playground

Learn the basics of building an assistant with Rasa Open Source with this interactive guide. You will be able to customize the assistant, talk to it and download the project so you can continue to build.

Build your assistant

In this guide, we are creating an assistant that helps users subscribe to a newsletter. Go through each of the steps below to see how a simple assistant is created:

What are the various things people might say to an assistant that can help them subscribe to a newsletter?

For an assistant 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.

Learn more about NLU data and its format

Now that the assistant understands a few messages users might say, it needs responses it can send back to the user.

“Hello, how can I help you?” and “what’s your email address?” are some of the responses our assistant will use. You’ll see how to connect user messages and responses in the next steps.

In the code block below, we have listed some responses and added one or more text options for each of them. If a response has multiple text options, one of these options will be chosen at random whenever that response is predicted.

Learn more about responses

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.

Your first story should show a conversation flow where the assistant helps the user accomplish their goal in a straightforward way. Later, you can add stories for situations where the user doesn't want to provide their information or switches to another topic.

In the code block below, we have added a story where the user and assistant exchange greetings, the user asks to subscribe to the newsletter, and the assistant starts collecting the information it needs through the newsletter_form. You will learn about forms in the next step.

Learn more about stories

There are many situations where an assistant needs to collect information from the user. For example, when a user wants to subscribe to a newsletter, the assistant must ask for their email address.

You can do this in Rasa using a form. In the code block below, we added the newsletter_form and used it to collect an email address from the user.

Learn more about forms here

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.

In the code block below, we have added a rule that triggers the newsletter_form whenever the user expresses the intent “subscribe”. We’ve also added a rule that triggers the utter_subscribed action once all the required information has been provided. The second rule only applies when the newsletter_form is active to begin with; once it is no longer active (active_loop: null), the form is complete.

Learn more about rules and how to write them.

Now that you've gone through all the steps, scroll down to talk to your assistant.

Train and talk to your assistant

Once you have reviewed the steps above, you’re ready to train your assistant. The training process generates a new machine learning model based on the training data you’ve provided.

To train the assistant on the NLU data, stories, forms, rules and responses above, click the Train button:

Looking for a challenge? Customize your assistant

You can use this page to create an assistant that does something other than helping users subscribe to a newsletter.

Try choosing a simple task for your assistant to do, like ordering a pizza or booking an appointment. Adapt the code blocks at each step to fit the new scenario, then train your assistant again to see it in action.

You have built your assistant! What’s next?

You can download this project and continue building to create a more advanced assistant.

Install Rasa open source to keep building.

When you train a model, you always want to check that your assistant still behaves as you expect. You can do that by talking to your assistant and seeing that it works. However, as your assistant becomes more complex, you will want to use test stories to ensure your model makes correct predictions.

Try running rasa test to make sure that your assistant passes your tests:

- story: test for greet and subscribe
- user: |
Hello there
intent: greet
- action: utter_greet
- user: |
I want to subscribe to the newsletter. My email is
intent: subscribe
- action: utter_subscribed

Check out other docs pages to learn more about Rasa’s CLI, Domains, Actions, and your config’s Pipeline and Policies.