Create a Dialogflow ES agent
Use the Dialogflow ES console to build and test an agent.
Before you begin
Before you begin, complete the following steps:
- Read Dialogflow basics .
- Complete the setup steps .
Create an agent
- Go to the Dialogflow ES console .
- Sign in to the Dialogflow console if prompted. For more information, see Dialogflow console overview .
- In the sidebar menu, click Agents .
- Select the Your deployed agents tab.
- Click Create agent .
- Enter the agent name, default language, and default time zone.
- Enter an existing project. To let the Dialogflow console create a project, select Create a new Google project .
- Click Create .
Intents
Intents categorize an end-user's intention for one conversation turn. For each agent, you define many intents that together handle a complete conversation.
Default intents
When you create an agent, Dialogflow creates two default intents for you:
- Default Welcome Intent:This intent matches when the end-user begins a conversation with your agent. It returns 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 matches 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:
- Go to the Dialogflow ES console .
- Select the agent you created.
- Click Intentsin the sidebar menu.
The middle of the Dialogflow console shows the list of intents for the agent.

Test the Default Fallback Intent

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 nowfield.
- Type
What is your name?. - Press Enter.
The agent's response appears in the Default Responsesection. Since your input didn't match any intent, the Default Fallback Intent was matched, and you received one of the default replies.
Create an intent
The steps in this section create an intent that answers the question "What is your name?" 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. Define training phrases that help Dialogflow match expressions to an intent.
Create an intent:
- Click the add intent button next to Intentsin the sidebar menu.
- Enter
get-agent-namein the Intent namefield. - In the Training Phrasessection, click Add training phrases.
-
Enter the following training phrases:
-
What is your name? -
Do you have a name? -
Tell me your name

-
-
In the Responsessection, enter the following in the Text Responsesection:
-
My name is Dialogflow!

-
-
Click the Save button and wait until the Agent Training dialog indicates that training is complete.
Test your intent

In the simulator, type What's your name?
and press Enter.
The agent responds to the expression correctly, even though the expression differs slightly from the training phrases provided.
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, assigns a score to each intent, and matches the highest scoring intent. 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.To control how data is extracted when building an agent, annotate parts of your training phrases and configure the associated parameters.
Create parameters
Create intent parameters:
- Click the plus button next to Intentsin the sidebar menu.
- Name the intent
set-languageat the top of the intent form. - Add the following training phrases:
-
I know English -
I speak French -
I know how to write in German
-
-
Click the Save button and wait until the Agent Training dialog indicates that training is complete.

Dialogflow automatically detects parameters in training phrases that are recognized as system entities . These are entities provided by Dialogflow for many common data types, such as location, color, and date.
After you add training phrases, Dialogflow creates a row in the Action & parameterstable:

- Required:Not checked; this parameter is optional.
- Parameter Name:Automatically named
languagebecause it is recognized as a language. - Entity:Recognized as a
@sys.languagesystem entity. - Value:The identifier used when referencing the value of this parameter.
- Is List:Not checked; this parameter is not a list.
Use parameter data in a response
You can use the value of a parameter in your responses. For example, you can
use the $language
parameter reference in your responses when building an
agent. At runtime, the agent replaces it with the language specified in the
end-user expression.
Add a response that uses a parameter:
- Go to the Responsessection.
- In the Text Responsesection, add the following:
Wow! I didn't know you knew $language. - Click the Save button and wait until the Agent Training dialog indicates that training is complete.
Test your parameter

In the simulator, type 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 need to gather specific data from users that is not provided by system entities. You can create custom entities to handle this.
Create a custom entity:
- Click the add entity button next to Entitiesin the sidebar menu.
- Enter
language-programmingfor the name of the entity. -
Add the following entity entries (rows):
Reference Value Synonyms JavaScript JavaScript, js, ECMAScript Java Java Python Python, py -
Click the Save button and wait until the Agent Training dialog indicates that training is complete.

Dialogflow can handle simple cases like plurality and capitalization. Add all possible synonyms for your entries. The more synonyms you add, the better your agent can identify your entities.
Use your new entity
Add training phrases to the set-language
intent that use the new entity:
- Click Intentsin the sidebar menu.
- Click the
set-languageintent. - Add the following training phrases:
-
I know javascript -
I know how to code in Java
-
- Observe that the programming languages in these training phrases are automatically annotated and added to parameters in the Action and Parameterssection.
- In the Responsessection, add the following second text response:
$language-programming is an excellent programming language. - Click the Save button and wait until the Agent Training dialog indicates that training is complete.
Test your new entity

In the simulator, enter I know how to code in py
. Dialogflow
correctly extracts py
for the language-programming
parameter, identifies it
as the Python
entity, and inserts the value into the response.
Contexts
To control the flow of the conversation, you can use contexts .
Add a follow-up intent
Follow-up intents let you control a conversation without manually creating and managing contexts.
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 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 set-language
intent:
- Select the
set-languageintent you created in previous steps. - In the Responsesection, update the text response:
-
Wow! I didn't know you knew $language. How long have you known $language?
-
- Click the Save button and wait until the Agent Training dialog indicates that training is complete.
- Click Intentsin the sidebar menu.
- Point the cursor at the
set-languageintent and click Add follow-up intent. - Click Customin the list.
- Click the Save button and wait until the Agent Training dialog indicates that training is complete.
Dialogflow automatically names the follow-up intent set-language - custom
.

Intent matching with follow-up intents
Follow-up intents are matched only after the parent intent is matched. Because
the set-language - custom
intent is matched only after the set-language
intent, the user has just been asked the question, "How long have you known
$language?" Add training phrases for likely user answers to that question:
- Click Intentsin the sidebar menu.
- Click the
set-language - customintent. - Add the following training phrases:
-
3 years -
about 4 days -
for 5 years
-
- Click the Save button and wait until the Agent Training dialog indicates that training is complete.
Test your follow-up intent
Enter I know French
in the simulator, and then answer the question How long have you known French
with about 2 weeks
.
Despite there being no response for the second expression ( about 2 weeks
),
you see the expression is matched to the correct intent
( set-language - custom
), and the duration parameter is correctly parsed
( 2 weeks
).
Intents and contexts
Inspect the set-language
intent to see that set-language-followup
is listed
as an output context prefaced by the number 2. This number is called the lifespan
.

After the set-language
intent is matched, the set-language-followup
context
is active and attached to the conversation for two turns (lifespan of 2).
Therefore when you respond to a question like How long have you known $language?
, the set-language-followup
context is
active.
Inspect the set-language - custom
intent to see that set-language-followup
is listed as an input context, which is the same as the output context for the set-language
intent.
Any intents with an input context that matches an active context are prioritized when Dialogflow matches intents .
Contexts and parameters
Contexts store parameter values, and you can access the values of parameters
defined in the set-language
intent when its output context is active. In the set-language - custom
intent, you only asked for the duration the user has
known the language, and not the referenced language itself.
To reference the language in the response:
- Update the
set-language - customintent text response toI can't believe you've known #set-language-followup.language for $duration! - Click the Save button and wait until the Agent Training dialog indicates that training is complete.
The #set-language-followup.language
reference is 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 week
. Notice that the language
parameter value is retrieved from the
context.
Production
Before running your agent in production, implement the production best practices .
What's next
Try the Fulfillment quickstart .

