Reference documentation and code samples for the Google Cloud Dialogflow V2 Client class Agent.
A Dialogflow agent is a virtual agent that handles conversations with your
end-users. It is a natural language understanding module that understands the
nuances of human language. Dialogflow translates end-user text or audio
during a conversation to structured data that your apps and services can
understand. You design and build a Dialogflow agent to handle the types of
conversations required for your system.
For more information about agents, see theAgent guide.
Generated from protobuf messagegoogle.cloud.dialogflow.v2.Agent
Namespace
Google \ Cloud \ Dialogflow \ V2
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ parent
string
Required. The project of this agent. Format:projects/<Project ID>.
↳ display_name
string
Required. The name of this agent.
↳ default_language_code
string
Required. The default language of the agent as a language tag. SeeLanguage Supportfor a list of the currently supported language codes. This field cannot be set by theUpdatemethod.
↳ supported_language_codes
array
Optional. The list of all languages supported by this agent (except for thedefault_language_code).
↳ time_zone
string
Required. The time zone of this agent from thetime zone database, e.g., America/New_York, Europe/Paris.
↳ description
string
Optional. The description of this agent. The maximum length is 500 characters. If exceeded, the request is rejected.
↳ avatar_uri
string
Optional. The URI of the agent's avatar. Avatars are used throughout the Dialogflow console and in the self-hostedWeb Demointegration.
↳ enable_logging
bool
Optional. Determines whether this agent should log conversation queries.
↳ match_mode
int
Optional. Determines how intents are detected from user queries.
↳ classification_threshold
float
Optional. To filter out false positive results and still get variety in matched natural language inputs for your agent, you can tune the machine learning classification threshold. If the returned score value is less than the threshold value, then a fallback intent will be triggered or, if there are no fallback intents defined, no intent will be triggered. The score values range from 0.0 (completely uncertain) to 1.0 (completely certain). If set to 0.0, the default of 0.3 is used.
↳ api_version
int
Optional. API version displayed in Dialogflow console. If not specified, V2 API is assumed. Clients are free to query different service endpoints for different API versions. However, bots connectors and webhook calls will follow the specified API version.
↳ tier
int
Optional. The agent tier. If not specified, TIER_STANDARD is assumed.
getParent
Required. The project of this agent.
Format:projects/<Project ID>.
Returns
Type
Description
string
setParent
Required. The project of this agent.
Format:projects/<Project ID>.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDisplayName
Required. The name of this agent.
Returns
Type
Description
string
setDisplayName
Required. The name of this agent.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDefaultLanguageCode
Required. The default language of the agent as a language tag. SeeLanguage
Supportfor a list of the currently supported language codes. This field cannot be
set by theUpdatemethod.
Returns
Type
Description
string
setDefaultLanguageCode
Required. The default language of the agent as a language tag. SeeLanguage
Supportfor a list of the currently supported language codes. This field cannot be
set by theUpdatemethod.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getSupportedLanguageCodes
Optional. The list of all languages supported by this agent (except for thedefault_language_code).
Optional. The list of all languages supported by this agent (except for thedefault_language_code).
Parameter
Name
Description
var
string[]
Returns
Type
Description
$this
getTimeZone
Required. The time zone of this agent from thetime zone database, e.g.,
America/New_York, Europe/Paris.
Returns
Type
Description
string
setTimeZone
Required. The time zone of this agent from thetime zone database, e.g.,
America/New_York, Europe/Paris.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getDescription
Optional. The description of this agent.
The maximum length is 500 characters. If exceeded, the request is rejected.
Returns
Type
Description
string
setDescription
Optional. The description of this agent.
The maximum length is 500 characters. If exceeded, the request is rejected.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getAvatarUri
Optional. The URI of the agent's avatar.
Avatars are used throughout the Dialogflow console and in the self-hostedWeb
Demointegration.
Returns
Type
Description
string
setAvatarUri
Optional. The URI of the agent's avatar.
Avatars are used throughout the Dialogflow console and in the self-hostedWeb
Demointegration.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getEnableLogging
Optional. Determines whether this agent should log conversation queries.
Returns
Type
Description
bool
setEnableLogging
Optional. Determines whether this agent should log conversation queries.
Parameter
Name
Description
var
bool
Returns
Type
Description
$this
getMatchMode
Optional. Determines how intents are detected from user queries.
Returns
Type
Description
int
setMatchMode
Optional. Determines how intents are detected from user queries.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getClassificationThreshold
Optional. To filter out false positive results and still get variety in
matched natural language inputs for your agent, you can tune the machine
learning classification threshold. If the returned score value is less than
the threshold value, then a fallback intent will be triggered or, if there
are no fallback intents defined, no intent will be triggered. The score
values range from 0.0 (completely uncertain) to 1.0 (completely certain).
If set to 0.0, the default of 0.3 is used.
Returns
Type
Description
float
setClassificationThreshold
Optional. To filter out false positive results and still get variety in
matched natural language inputs for your agent, you can tune the machine
learning classification threshold. If the returned score value is less than
the threshold value, then a fallback intent will be triggered or, if there
are no fallback intents defined, no intent will be triggered. The score
values range from 0.0 (completely uncertain) to 1.0 (completely certain).
If set to 0.0, the default of 0.3 is used.
Parameter
Name
Description
var
float
Returns
Type
Description
$this
getApiVersion
Optional. API version displayed in Dialogflow console. If not specified,
V2 API is assumed. Clients are free to query different service endpoints
for different API versions. However, bots connectors and webhook calls will
follow the specified API version.
Returns
Type
Description
int
setApiVersion
Optional. API version displayed in Dialogflow console. If not specified,
V2 API is assumed. Clients are free to query different service endpoints
for different API versions. However, bots connectors and webhook calls will
follow the specified API version.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getTier
Optional. The agent tier. If not specified, TIER_STANDARD is assumed.
Returns
Type
Description
int
setTier
Optional. The agent tier. If not specified, TIER_STANDARD is assumed.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Dialogflow V2 Client - Class Agent (2.1.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.1.2 (latest)](/php/docs/reference/cloud-dialogflow/latest/V2.Agent)\n- [2.1.1](/php/docs/reference/cloud-dialogflow/2.1.1/V2.Agent)\n- [2.0.1](/php/docs/reference/cloud-dialogflow/2.0.1/V2.Agent)\n- [1.17.2](/php/docs/reference/cloud-dialogflow/1.17.2/V2.Agent)\n- [1.16.0](/php/docs/reference/cloud-dialogflow/1.16.0/V2.Agent)\n- [1.15.1](/php/docs/reference/cloud-dialogflow/1.15.1/V2.Agent)\n- [1.14.0](/php/docs/reference/cloud-dialogflow/1.14.0/V2.Agent)\n- [1.13.0](/php/docs/reference/cloud-dialogflow/1.13.0/V2.Agent)\n- [1.12.3](/php/docs/reference/cloud-dialogflow/1.12.3/V2.Agent)\n- [1.11.0](/php/docs/reference/cloud-dialogflow/1.11.0/V2.Agent)\n- [1.10.2](/php/docs/reference/cloud-dialogflow/1.10.2/V2.Agent)\n- [1.9.0](/php/docs/reference/cloud-dialogflow/1.9.0/V2.Agent)\n- [1.8.0](/php/docs/reference/cloud-dialogflow/1.8.0/V2.Agent)\n- [1.7.2](/php/docs/reference/cloud-dialogflow/1.7.2/V2.Agent)\n- [1.6.0](/php/docs/reference/cloud-dialogflow/1.6.0/V2.Agent)\n- [1.5.0](/php/docs/reference/cloud-dialogflow/1.5.0/V2.Agent)\n- [1.4.0](/php/docs/reference/cloud-dialogflow/1.4.0/V2.Agent)\n- [1.3.2](/php/docs/reference/cloud-dialogflow/1.3.2/V2.Agent)\n- [1.2.0](/php/docs/reference/cloud-dialogflow/1.2.0/V2.Agent)\n- [1.1.1](/php/docs/reference/cloud-dialogflow/1.1.1/V2.Agent)\n- [1.0.1](/php/docs/reference/cloud-dialogflow/1.0.1/V2.Agent) \nReference documentation and code samples for the Google Cloud Dialogflow V2 Client class Agent.\n\nA Dialogflow agent is a virtual agent that handles conversations with your\nend-users. It is a natural language understanding module that understands the\nnuances of human language. Dialogflow translates end-user text or audio\nduring a conversation to structured data that your apps and services can\nunderstand. You design and build a Dialogflow agent to handle the types of\nconversations required for your system.\n\nFor more information about agents, see the\n[Agent guide](https://cloud.google.com/dialogflow/docs/agents-overview).\n\nGenerated from protobuf message `google.cloud.dialogflow.v2.Agent`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Dialogflow \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getParent\n\nRequired. The project of this agent.\n\nFormat: `projects/\u003cProject ID\u003e`.\n\n### setParent\n\nRequired. The project of this agent.\n\nFormat: `projects/\u003cProject ID\u003e`.\n\n### getDisplayName\n\nRequired. The name of this agent.\n\n### setDisplayName\n\nRequired. The name of this agent.\n\n### getDefaultLanguageCode\n\nRequired. The default language of the agent as a language tag. See\n[Language\nSupport](https://cloud.google.com/dialogflow/docs/reference/language)\nfor a list of the currently supported language codes. This field cannot be\nset by the `Update` method.\n\n### setDefaultLanguageCode\n\nRequired. The default language of the agent as a language tag. See\n[Language\nSupport](https://cloud.google.com/dialogflow/docs/reference/language)\nfor a list of the currently supported language codes. This field cannot be\nset by the `Update` method.\n\n### getSupportedLanguageCodes\n\nOptional. The list of all languages supported by this agent (except for the\n`default_language_code`).\n\n### setSupportedLanguageCodes\n\nOptional. The list of all languages supported by this agent (except for the\n`default_language_code`).\n\n### getTimeZone\n\nRequired. The time zone of this agent from the\n[time zone database](https://www.iana.org/time-zones), e.g.,\nAmerica/New_York, Europe/Paris.\n\n### setTimeZone\n\nRequired. The time zone of this agent from the\n[time zone database](https://www.iana.org/time-zones), e.g.,\nAmerica/New_York, Europe/Paris.\n\n### getDescription\n\nOptional. The description of this agent.\n\nThe maximum length is 500 characters. If exceeded, the request is rejected.\n\n### setDescription\n\nOptional. The description of this agent.\n\nThe maximum length is 500 characters. If exceeded, the request is rejected.\n\n### getAvatarUri\n\nOptional. The URI of the agent's avatar.\n\nAvatars are used throughout the Dialogflow console and in the self-hosted\n[Web\nDemo](https://cloud.google.com/dialogflow/docs/integrations/web-demo)\nintegration.\n\n### setAvatarUri\n\nOptional. The URI of the agent's avatar.\n\nAvatars are used throughout the Dialogflow console and in the self-hosted\n[Web\nDemo](https://cloud.google.com/dialogflow/docs/integrations/web-demo)\nintegration.\n\n### getEnableLogging\n\nOptional. Determines whether this agent should log conversation queries.\n\n### setEnableLogging\n\nOptional. Determines whether this agent should log conversation queries.\n\n### getMatchMode\n\nOptional. Determines how intents are detected from user queries.\n\n### setMatchMode\n\nOptional. Determines how intents are detected from user queries.\n\n### getClassificationThreshold\n\nOptional. To filter out false positive results and still get variety in\nmatched natural language inputs for your agent, you can tune the machine\nlearning classification threshold. If the returned score value is less than\nthe threshold value, then a fallback intent will be triggered or, if there\nare no fallback intents defined, no intent will be triggered. The score\nvalues range from 0.0 (completely uncertain) to 1.0 (completely certain).\n\nIf set to 0.0, the default of 0.3 is used.\n\n### setClassificationThreshold\n\nOptional. To filter out false positive results and still get variety in\nmatched natural language inputs for your agent, you can tune the machine\nlearning classification threshold. If the returned score value is less than\nthe threshold value, then a fallback intent will be triggered or, if there\nare no fallback intents defined, no intent will be triggered. The score\nvalues range from 0.0 (completely uncertain) to 1.0 (completely certain).\n\nIf set to 0.0, the default of 0.3 is used.\n\n### getApiVersion\n\nOptional. API version displayed in Dialogflow console. If not specified,\nV2 API is assumed. Clients are free to query different service endpoints\nfor different API versions. However, bots connectors and webhook calls will\nfollow the specified API version.\n\n### setApiVersion\n\nOptional. API version displayed in Dialogflow console. If not specified,\nV2 API is assumed. Clients are free to query different service endpoints\nfor different API versions. However, bots connectors and webhook calls will\nfollow the specified API version.\n\n### getTier\n\nOptional. The agent tier. If not specified, TIER_STANDARD is assumed.\n\n### setTier\n\nOptional. The agent tier. If not specified, TIER_STANDARD is assumed."]]