Create and customize an agent

Moshood Abiola
Nov 19 · 7 min read

In Dialogflow, a newly created agent comes with two default intents, the Default Welcome Intent and the Default Fallback Intent.

The first steps of building an agent, in addition to creating new intents, involve customizing these intents to match the purpose and persona of your agent.

Create an agent

The steps in this guide make assumptions about your agent, so it’s best to start with a new agent. You should delete any existing agent for your project before creating a new one. To delete an existing agent:

  1. Go to the Dialogflow Console.
  2. If requested, sign in to the Dialogflow Console. See the Dialogflow console overview for more information.
  3. Select the agent you wish to delete.
  4. Click the settings button next to the agent’s name.
  5. Scroll down to the bottom of the General settings tab.
  6. Click Delete this agent.
  7. Enter DELETE in the text field.
  8. Click Delete.

To create an agent:

  1. Go to the Dialogflow Console.
  2. If requested, sign in to the Dialogflow Console. See the Dialogflow console overview for more information.
  3. Click Create Agent on the left sidebar menu. (If you already have other agents, click the agent name, scroll to the bottom and click Create new agent.)
  4. Enter your agent’s name, default language, and default time zone.
  5. If you have already created a project, enter that project. If you want to allow the Dialogflow Console to create the project, select Create a new Google project.
  6. Click the Create button.

Customize the Default Welcome Intent

Let’s start by customizing the response of the Default Welcome Intent according to the Google conversation design best practices. The best practice suggests that you accomplish three main goals with your greeting: welcome the user, set expectations, and let the user take control.

Based on this best practice, we can compose our agent’s greeting:

Welcome. I can tell you about the shop hours, or I can set up an appointment. Which would you like?

Best Practice
Three main goals you want to accomplish with your greeting:

  • Welcome the user
  • Set expectations
  • Let the user take control

To update the Default Welcome Intent response, follow these steps:

  1. Click on the Default Welcome Intent.
  2. Navigate to the Responses section.
  3. In the Text response table, delete all the default responses.
  4. In the Text response table, copy and paste the following response:

5. Click SAVE.

6. Test the update using the simulator in the Dialogflow console.

Note: The flowchart is used to facilitate the understanding of the tutorial’s content; it is not part of Dialogflow’s features.

Create response variants

Best Practice
Come up with a number of variations in responses. Just as you would avoid repeating the same phrase in conversation, adding small variations in phrases make the agent sound more natural.

After composing a new greeting phrase, we need to create other variations. Include the following variations as responses in the Default Welcome Intent:

  • Welcome. I can tell you the shop hours, or I can make an appointment. What can I do for you?
  • Hello there. I can tell you the shop hours, or I can schedule an appointment. How may I help you today?

When we supply multiple responses for an intent, Dialogflow randomly selects a response variant from the list. However, keep in mind that there are more sophisticated ways to handle variations in responses once we start writing code for fulfillment, which enables an intent to employ complex logic. Dialogflow’s fulfillment component is covered in later sections.

In our response variants, the greeting phrases end with a question, such as “Which would you like?” and “What can I do for you?” At this point, the agent expects an utterance from the user, and the utterance should reveal what the user wants from the agent. In the next section, we create the agent’s first custom intent that can identify and resolve a user’s request.

Build better voice apps. Get more articles & interviews from voice technology experts at voicetechpodcast.com

Create a custom intent

We want a bike shop agent to perform two tasks:

  • Inform customers about the hours of operation
  • Schedule appointments for customers

Let’s first create an intent that can inform users about the hours of operation for the bike shop. We can start by writing a sample dialog for this intent:

User: When are you open?

Agent: We’re open from 9 AM to 6 PM every day. Is there anything else I can do for you?

Best Practice
One of the most effective ways to get the user to continue the conversation is to ask a question. When the call to action isn’t clear, the user won’t know when, or how, to respond.

To create an intent that can handle this dialog, follow these steps:

  1. Create a new intent named Hours.
  2. In the Training phrases section of the Hours intent, enter the following training phrase: When are you open?

3. In the Responses section, enter the following response in the Text response table: We're open from 9 AM to 6 PM every day. Is there anything else I can do for you?

4. Click SAVE.

Note: The diamond shape in the flowchart represents a point in the conversation where the agent waits for a user utterance. The flowchart shows that the flow of conversation returns to decision point A at the top after the Hour's intent is invoked.

Add more training phrases

Since the Hours intent currently has only one training phrase, “When are you open?”, the intent has insufficient knowledge to identify other similar utterances that have the same meaning. We need to provide more training phrases so the agent can match a variety of user utterances that express the same intention.

Best Practice
The more training phrases you provide for intent, the more likely that user utterances are correctly matched with the intent.

In natural language, we almost always have different ways of forming phrases that mean the same thing. We recommend that every intent begins with at least 10 training phrases. As you start testing the agent, continue to add more training phrases using Dialogflow’s training tool.

With the phrase “When are you open?”, we can come up with these 10 variations that users may say instead:

  • Are you open today?
  • How late are you open on weekends?
  • When do you close?
  • What time do you open tomorrow morning?
  • Are you open now?
  • Business hours.
  • How early can I drop in?
  • Tell me your opening hours.
  • What are your hours?
  • How late can I come in?

To add these variations as training phrases, follow these steps:

  1. Click on the Hours intent.
  2. In the Training phrases section, copy and paste each phrase above.

3. Click SAVE.

4. Test the intent with various user utterances using the simulator in the Dialogflow console.

So far, we have an agent that can greet and welcome users and identify and resolve a specific request from the users. However, what happens when users say something that can’t be understood by the agent?

In the next section, we’ll explore a special intent that is designed to handle unmatched utterances: a fallback intent.

Customize the fallback intent

A fallback intent is a special intent that is matched when a user utterance is not matched with any other intents. Like the Default Welcome Intent, a generic fallback intent named Default Fallback Intent is included in every agent.

A fallback intent can prompt users to form utterances in a format that the agent can understand. To update the Default Fallback Intent response, follow these steps:

  1. Click on the Default Fallback Intent.
  2. Navigate to the Responses section.
  3. In the Text response table, delete all the default responses.
  4. In the Text response table, copy and paste the following response: Sorry, did you want to hear our hours, or set up an appointment?

Best Practice
“Sorry” is most helpful in no-match prompts to make it clear to the users that your agent couldn’t understand or interpret their utterance. However, avoid overuse.

5. Click SAVE.

The prompt question in the fallback response — “did you want to hear our hours, or set up an appointment?”–guides users to provide a recognizable utterance. The agent should expect one of the following utterances from the user: “I want to know the hours” or “I want to set up an appointment”.

Best Practice
In case of a No-Match error, provide a prompt that typically combines an apology with a condensed reiteration of the original question.

At this point, our agent doesn’t have an intent that can handle the utterance “I’d like to set up an appointment.” In the following section, we’ll create an advanced intent that can resolve the request to set up an appointment.

Something just for you

Voice Tech Podcast

Voice technology interviews & articles. Learn from the experts.

Moshood Abiola

Written by

Voice Tech Podcast

Voice technology interviews & articles. Learn from the experts.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade