How to build an AI tutor chatbot

For educators: create your own AI bot that answers student questions and suggests learning resources.

Tags Streamline Icon: https://streamlinehq.com
Wrench Streamline Icon: https://streamlinehq.com
Uses
People Man Graduate Streamline Icon: https://streamlinehq.com
Beginner

This tutorial guides educators through creating an AI tutor chatbot using Dialogflow. The chatbot will be able to answer students' questions, provide detailed explanations on complex topics, and direct users to additional learning resources. Designed for beginner or intermediate users, this tutorial requires no coding skills.

You’ll need:

  • A Google account for accessing Dialogflow
  • An understanding of the subject matter you want to cover with your chatbot

Step 1: Create a Dialogflow agent

First, go to the Dialogflow Console and sign in with your Google account. Click on "Create new agent" in the sidebar menu. Name your agent based on your subject or course, then click "Create".

We’re calling ours EcoTutorBot, designed for high school or early college students studying environmental science. The bot will aim to deepen their understanding of ecological concepts, current environmental issues, and sustainability practices.

Step 2: Understand intents and entities

Before we head into the next step, let’s take a quick moment to cover what intents and entities are. In the world of chatbots, intents and entities play crucial roles in interpreting and responding to user queries.

Intents: Think of intents as the purpose behind a user's message. When someone interacts with your chatbot, they have a goal in mind, whether it's to ask a question, get information on a topic, or perform an action. Each intent represents a specific action your chatbot can recognise and respond to. For example, if a student asks, "What is photosynthesis?" the intent might be "Understand Photosynthesis". By defining various intents, you teach your chatbot how to identify and react to the different requests users might have.

Entities: Entities are the specific details in a user's message that provide context to an intent. They help your chatbot understand the nuances of what's being asked. Continuing with our previous example, in the question "What is photosynthesis?" the entity would be "photosynthesis," signalling the specific topic the user wants to learn about. Entities allow your chatbot to tailor its responses more precisely, offering a more personalised interaction experience.

Together, intents and entities enable your chatbot to understand and fulfil user requests accurately.

Now we’ve got that cleared up, we can move on to the next step in building our bot.

Step 3: Create basic intents

Welcome intent:

Click "Intents" on the left-hand menu and select "Default Welcome Intent". This intent is triggered when a user initiates a conversation with your chatbot. You’ll notice that it comes pre-filled with training phrases like "Hi" or "Hello". Dialogflow uses these phrases to recognise when to trigger the welcome message.

Now let’s customise the responses to greet users engagingly.

Scroll down to the "Responses" section. Here, you will see default responses like "Hi! How can I assist?" You can edit these responses to make them more specific to your chatbot's personality or function. For example, if your chatbot is EcoTutorBot, a response might be, "Hello! I'm EcoTutorBot, ready to explore the wonders of environmental science with you. What topic are you curious about today?”.

Multiple response variations will make your chatbot's greetings seem more natural and less repetitive. Simply click "Add Response" within the same response type to input additional greetings.

To delete a response, click on the trash can icon next to it.

If you want to make your welcome message more interactive, you can use rich responses. For example, you can include suggestion chips that offer topic options like "Tell me about biodiversity", "Explain the greenhouse effect", or "What are renewable resources?" This encourages users to continue the conversation.

Once you’re happy with your customisations, click “Save”.

Use the test console on the right side of the Dialogflow interface to send a greeting to your chatbot and see how it responds with the customised welcome messages.

Fallback intent:

The fallback intent will guide users on how to ask questions if their initial attempt is not understood, helping to guide users back on track smoothly.

Go back to "Intents" on the left-hand menu and select "Default Fallback Intent".

The Fallback intent doesn't have training phrases because it's the catch-all for unmatched queries. Instead, focus on the responses section where you'll define how your chatbot reacts when it doesn't understand something.

Scroll down to the default responses. You can customise these or leave them as is. For instance, EcoTutorBot might say, "Oops! I'm still learning about environmental science and didn't catch that. Could you rephrase your question or ask about a specific topic like 'climate change' or 'conservation'?”.

When you’re done customising, click “Save”.

Step 4: Create subject-specific intents

Write out topics/questions

To prep for this step, you’ll need to write (or type) out a list of common questions or topics your students ask about. Examples for our environmental science students include:

  • “What is the greenhouse effect?”
  • "How do renewable resources differ from non-renewable resources?"
  • "Can you explain the importance of biodiversity?"
  • "What are the major causes of deforestation?"
  • "How does plastic pollution affect ocean life?"
  • "What actions can individuals take to reduce their carbon footprint?"

Create intents

Now, for each question or topic, create a new intent. Name it clearly, e.g., "Deforestation Causes Question."

Set training phrases

Click “Add training phrases” to start adding several ways someone might ask the question. This teaches Dialogflow how to recognise similar questions. You don’t need to write an exhaustive list - the AI just needs a few to learn when to respond.

💡 Tip: If you’re drawing a blank on ways to phrase your questions, use ChatGPT or another gen AI chatbot to help you brainstorm. Here’s how we did it:

You’ll see an Action and parameters field within the Intent editor, but we’re going to skip that for this bot. Actions and parameters apply more to bots than need to take action where the parameters are crucial e.g. booking an appointment for a specific date.

Responses

Jumping ahead to the Responses field, here you’ll want to provide a clear, concise explanation as the response. Include links to external resources for further learning.

Click “Save” when you’re done.

Continue in this way for all topics you listed out in the prep step above.

Step 5: Implement follow-up intents

For complex topics, create follow-up intents to break down the explanation into smaller parts. For example, after explaining photosynthesis, a follow-up intent could ask if the student wants to learn about the light-dependent reactions specifically.

To do this, in the intent for the main topic, click "Add follow-up intent" and select the type of follow-up. Customise responses to guide the conversation smoothly.

Step 6: Test your chatbot

Use the built-in test console on the right side of the Dialogflow interface to try out your chatbot's responses. Make sure you test with various phrasings of questions to ensure the chatbot understands and responds accurately.

Based on testing, refine your intents and responses. The goal is to cover as many variations of student queries as possible.

Step 7: Integration

After ensuring your chatbot functions correctly, it's time to make it accessible to students.

Dialogflow offers various integration options, such as embedding the chatbot on a course webpage or integrating with messaging platforms like Slack. Here’s a guide on getting started.

Once you’re comfortable with how integrations work, follow the relevant integration guide in Dialogflow for your chosen platform and click on “Integrations” in the left-hand menu in Dialogflow to get going.

Step 8: Monitoring and feedback

It goes without saying really, but getting feedback from your students will likely make or break how much they use and interact with your chatbot.

Two ways to go about this:

  • Performance Tracking: Regularly review chatbot interaction logs in Dialogflow to understand common questions and any areas of confusion.
  • Feedback Loop: Encourage students to provide feedback on the chatbot's effectiveness directly within the chat interface or through a linked form.

Use these two methods of feedback to refine your chatbot's responses and add new intents as needed.

Wrapping it up

You've now created a functional AI tutor chatbot tailored to your educational content. By regularly updating the chatbot based on student interactions and feedback, you'll enhance its ability to assist and provide a valuable resource for after-hours support.

Remember, the key to a successful chatbot is continuous improvement based on real-world use. Happy teaching!

Products Give Gift 1 Streamline Icon: https://streamlinehq.com

Try before you bite?
This one's on us.

Sign up for a free account to view our free courses

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Loading Bar Streamline Icon: https://streamlinehq.com

Yikes, a paywall!

70+ tutorials and courses wait behind it. No subscription, $150 paid once.

✅ Full course & tutorial access
Case studies on companies using AI
✅ Private community access
✅ No subscription, $150 paid once
Expense it using this template. Or get a team account.
Join 2,641 learners from companies like...
Or start with a free course:

More tutorials like this

View all

If you scrolled this far, you must be a little interested...

Start learning ->

Join 2,641 professionals already learning