Quickstart: Build an agent

This quickstart shows you how to use the Dialogflow Console to build and test a simple agent.

Before you begin

You should do the following before reading this guide:

  1. Read Dialogflow basics.
  2. Perform setup steps.

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 Dialogflow console overview for more information.
  3. Select the agent you wish to delete.
  4. Click the settings 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 Dialogflow console overview for more information.
  3. Click Create Agent in 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.


Intents categorize an end-user's intention for one conversation turn. For each agent, you define many intents, where your combined intents can handle a complete conversation.

Default intents

When you create an agent, two default intents are created for you:

  • Default Welcome Intent: This intent is matched when the end-user begins a conversation with your agent. This intent should return a response that lets the end-user know what your agent does or what they can say to begin a conversation.
  • Default Fallback Intent: This intent is matched when the agent cannot match the end-user expression to any other intent.

To see these intents, go to the intent list for your agent:

  1. Go to the Dialogflow Console.
  2. Select the agent you just created.
  3. Click Intents in the left sidebar menu.

The middle of the console shows the list of intents for the agent.

Agent intent list screenshot

Test the Default Fallback Intent

Simulator screenshot

The Dialogflow simulator is on the right side of the console. With the simulator, you can test your agent by speaking or typing messages.

Try the agent now:

  • Click the Try it now field
  • Type something
  • Press enter

The agent's response appears in the Default Response section. Since your input didn't match any intent, the Default Fallback Intent was matched, and you received one of the default replies.

Create and train a new intent

For each intent, you define many training phrases. A training phrase is an example of what an end-user might type or say to your agent, also known as an end-user expression. For example, an end-user might ask "what is your name?", "do you have a name?", or just "name?". Each of these end-user expressions are unique but have the same intention: to get the name of your agent.

Create an intent to handle this scenario:

  1. Click the add intent add button next to Intents in the left sidebar menu.
  2. Enter name in the Intent name field.
  3. In the Training Phrases section, click the empty text field. Enter the following training phrases, pressing enter after each entry:

    • What is your name?
    • Do you have a name?
    • name
  4. In the Responses section, click the text field and enter:

    • My name is Dialogflow!
  5. Click the Save button and wait until the Agent Training pop-up indicates that training is complete.

Test your intent

Simulator screenshot

In the simulator, type What's your name? and press enter.

Your agent responds to the expression correctly, even though the expression was a little different from the training phrases you supplied.

Dialogflow uses training phrases as examples for a machine learning model to match end-user expressions to intents. The model checks the expression against every intent in the agent, gives every intent a score, and the highest scoring intent is matched. If the highest scoring intent has a very low score, the fallback intent is matched.

Parameters and entities

When an intent is matched at runtime, Dialogflow provides the extracted values from the end-user expression as parameters. Each parameter has a type, called the entity type, which dictates exactly how the data is extracted. Unlike raw end-user input, parameters are structured data that can easily be used to perform some logic or generate responses.

When building an agent, you control how data is extracted by annotating parts of your training phrases and configuring the associated parameters.

Add parameters to a new intent

Create a new intent with parameters:

  1. Click the plus add button next to Intents in the left sidebar menu.
  2. Name the intent Languages at the top of the intent form.
  3. Add the following training phrases:
    • I know English
    • I speak French
    • I know how to write in German
  4. Click Save.

    Annotated training phrase screenshot

Dialogflow automatically detects parameters in training phrases that are recognized as system entities. These are entities provided by Dialogflow for many common data types like location, color, and date.

Below the Training phrases section, Dialogflow creates a row in the Actions & parameters table:

  • Required: The checkbox is not checked, so this parameter is optional.
  • Parameter Name: This parameter is automatically named "language", because the parameter is recognized as a language.
  • Entity: This is the entity type. It is recognized as a @sys.language system entity.
  • Value: This is the identifier you use when referencing the value of this parameter.
  • Is List: The checkbox is not checked, so the parameter is not a list.

Use parameter data in a response

The value of a parameter can be used in your responses. For example, you can use the $language parameter reference in your responses when building an agent. At runtime, it will be replaced with the language specified in the end-user expression.

In the Responses section, add the following response and click the Save button:

  • Wow! I didn't know you knew $language

Test your parameter

Simulator screenshot

In the simulator, enter I know Russian.

You can see that Dialogflow correctly extracts the language parameter with the value "Russian", and "Russian" was correctly inserted where the parameter reference was used in the response.

Create your own entities

In most cases, you have specific data you need to gather from users that isn't provided by system entities. You can create custom entities to handle this.

Create a custom entity:

  1. Click the add entity add button next to Entities in the left sidebar menu.
  2. Enter ProgrammingLanguage for the name of the entity.
  3. Add the following entity entries (rows):

    Reference Value Synonyms
    JavaScript JavaScript, js, ECMAScript
    Java Java
    Python Python, py
  4. Click Save.

Each entity must have the following:

  • A name
  • One or more entity entries (rows)
  • A reference value and one or more synonyms for each entity entry

Dialogflow can handle simple things like plurality and capitalization, but you should add all possible synonyms for your entries. The more you add, the better your agent can determine your entities.

Use your new entity

Add training phrases to the "Languages" intent that make use of the new entity:

  1. Click Intents in the left sidebar menu.
  2. Click the Languages intent.
  3. Add the following training phrases:
    • I know javascript
    • I know how to code in Java
  4. Notice that the programming languages in these training phrases are automatically annotated and added to the list of parameters.

    Entity use screenshot

  5. In the Responses section, add $ProgrammingLanguage is cool.

  6. Click Save.

Test your new entity

Simulator screenshot

In the simulator, enter I know how to code in py.

You can see that Dialogflow correctly extracted py for the ProgrammingLanguage parameter, identified it as the Python entity, and inserted the value in the response.


To control the flow of the conversation, you can use context.

Add a follow-up intent

Follow-up intents provide a simple way to control a conversation without having to create and manage contexts manually.

When you create a follow-up intent, an output context is added to the parent intent and an input context of the same name is added to the child intent. This means that the follow-up intent is matched only when the parent intent is matched in the previous conversational turn.

Add a custom follow-up intent to the Languages intent:

  1. Select the Languages intent you created in previous steps.
  2. In the Response section, update the text response:
    • Wow! I didn't know you knew $language. How long have you known $language?
  3. Click Save.
  4. Click Intents in the left sidebar menu.
  5. Hover over the Languages intent and click Add follow-up intent.

    Add follow-up intent screenshot

  6. Click custom in the revealed list.

    Add follow-up custom intent screenshot

Dialogflow automatically names the follow-up intent Languages - custom.

Intent matching with follow-up intents

Follow-up intents are only matched after the parent intent has been matched. Since the Languages - custom intent is only matched after the Languages intent, you can assume that the user has just been asked the question "How long have you known $language?". Now you can add training phrases for likely user answers to that question:

  1. Click Intents in the left sidebar menu
  2. Click the Languages - custom intent.
  3. Add the following training phrases:
    • 3 years
    • about 4 days
    • for 5 years

Test your follow-up intent

Enter I know French in the simulator, then answer the question "How long have you known French" with about 2 weeks.

Simulator screenshot

Despite there being no response for the second expression ("about 2 weeks"), you can see the expression is matched to the correct intent (Languages - custom), and the duration parameter is correctly parsed ("2 weeks").

Intents and contexts

Inspect the Languages intent to see that Languages-followup is listed as an output context and is prefaced by the number 2. This number is called the lifespan.

Output context screenshot

After the Languages intent is matched, the Languages-followup context is active and attached to the conversation for two turns (lifespan of 2). Therefore, when the user responds to the question, "How long have you known $language?", the Languages-followup context is active.

Inspect the Languages - custom intent to see that Languages-followup is listed as an input context, which is the same as the output context for the Languages intent.

Intent input screenshot

Any intents with an input context that matches an active context are heavily favored when Dialogflow matches intents.

Contexts and parameters

Contexts store parameter values, and you can access the values of parameters defined in the Languages intent when its output context is active.

In the Languages - custom intent, you only asked for the duration the user has known the language, and not the referenced language itself. Add the following response to the Languages - custom intent and click the Save button:

  • I can't believe you've known #languages-followup.language for $duration!

The #languages-followup.language reference is known as a parameter reference for an active context.

Test the context parameter

Enter I know French in the simulator, and then respond to the question with 1 month. Notice that the language parameter value is retrieved from the context.

Simulator screenshot