Configuring language detection for AI agents

<body>
<p id="docs-hc-snippet" style="display: none;">Language detection is the task of automatically identifying the language the customer is using during a conversation with an AI agent so that the AI agent can respond in the same language.</p>
<div class="article-banners">
<div id="docs-wmp-link">
<a href="https://support.zendesk.com/hc/en-us/articles/5411234991258-plan" rel="noopener" target="_blank">What's my plan?</a>
</div>

<div class="article-banner" id="suite_all">
<table>
<tbody>
<tr>
<td>
<strong>All Suites</strong>
</td>
<td>Team, Growth, Professional, Enterprise, or Enterprise Plus</td>
</tr>
</tbody>
</table>
</div>

<div class="article-banner" id="support_all">
<table>
<tbody>
<tr>
<td>
<strong>Support</strong>
</td>
<td>Team, Professional, or Enterprise</td>
</tr>
</tbody>
</table>
</div>

</div>

<div class="body">

<p class="p">Language detection is the task of automatically identifying the language the customer is
using during a conversation with an AI agent so that the AI agent can respond in the
same language. </p>
<p class="p">This article contains the following topics:</p>
<ul class="ul" id="language_detection__ul_s3h_xxx_jgc">
<li class="li"><a class="xref" href="#topic_urt_nxx_jgc">About language detection in AI agents</a></li>
<li class="li"><a class="xref" href="#topic_wwm_4xx_jgc">Detecting the customer’s language</a></li>
<li class="li"><a class="xref" href="#topic_nzh_pxx_jgc">Resetting the detected language</a></li>
<li class="li"><a class="xref" href="#topic_axl_qxx_jgc">Preventing the unsupported language reply from triggering</a></li>
</ul>
<p class="p">Related articles: </p>
<ul class="ul" id="language_detection__ul_ydn_wxx_jgc">
<li class="li">
<a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749663130" target="_blank">Languages supported by AI agents</a>
</li>
<li class="li">
<a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749666714" target="_blank">Managing languages for AI agents</a>
</li>
<li class="li"><a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357756745882" target="_blank">Translating and building replies for AI
agents</a></li>
</ul>
</div>
<div aria-labelledby="ariaid-title2" class="topic nested1" id="topic_urt_nxx_jgc">
<h2 class="title topictitle2" id="ariaid-title2">About language detection in AI agents</h2>
<div class="body">
<p class="p">For an AI agent to reply in a customer’s preferred language, it must first be able to
detect the language. For dialogue-based responses, there must also be an <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/9624068102682#topic_jyw_4zx_jgc" target="_blank">active reply</a> created in that language. For
both dialogue-based and generative AI responses, the detected language must be <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749666714#topic_etz_kzx_jgc" target="_blank">activated</a> and be one of the <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749663130#h_01JJZBMRA1W2EH2K4JQHR5FQ0S" target="_blank">supported languages</a>. </p>
<p class="p">The following <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/9522180655386#topic_lf5_pzp_xfc" target="_blank">session parameters</a> capture information
related to languages used by an AI agent during a conversation:</p>
<ul class="ul" id="topic_urt_nxx_jgc__ul_tf1_w2s_hjc">
<li class="li">
<strong class="ph b">active_language</strong>: The language the AI agent is currently using in the
conversation. This parameter doesn’t change—meaning the AI agent will not switch
languages—after it's set, <em class="ph i">unless</em> it's manually changed through an
action.</li>
<li class="li">
<strong class="ph b">lastDetectedLanguage</strong>: The last language that was detected in the
conversation. This parameter isn't used <em class="ph i">unless</em> you specifically design a
conversation flow that depends on it, including being used inside an
action.</li>
<li class="li">
<strong class="ph b">usedLanguage</strong>: The languages that the AI agent has used in the
conversation. This parameter might not reflect the most recent value if
<em class="ph i">active_language</em> was manually updated through an action.</li>
</ul>
<p class="p">The customer’s language is set and stored in <em class="ph i">active_language</em>. Language
detection is triggered every time the <em class="ph i">active_language</em> parameter is empty.
This happens in the following scenarios: </p>
<ul class="ul" id="topic_urt_nxx_jgc__ul_vpl_xzx_jgc">
<li class="li">On the first message </li>
<li class="li">If the language hasn’t been saved </li>
<li class="li">If the language has been reset </li>
</ul>
<p class="p">The AI agent can determine the customer’s language based on one of the following
methods: </p>
<ul class="ul" id="topic_urt_nxx_jgc__ul_kbn_ldy_jgc">
<li class="li">The content of the customer’s first message (default)</li>
<li class="li">An integration with your CRM </li>
<li class="li">The customer’s language selection in the welcome message (if configured) </li>
</ul>
<p class="p">The following table outlines how the AI agent responds based on the active or
inactive status of the detected language and the reply associated with the predicted
use case. The language status always takes precedence over the reply status.</p>
<div class="p">
<div class="tablenoborder">
<table border="1" cellpadding="4" cellspacing="0" class="table" frame="border" id="topic_urt_nxx_jgc__table_qty_4dy_jgc" rules="all" summary="">
<colgroup>
<col>
<col>
<col>
</colgroup>
<tbody class="tbody">
<tr class="row">
<td class="entry nocellnorowborder" dir="ltr" style="vertical-align:top;"><strong class="ph b">Language active or inactive?</strong></td>
<td class="entry nocellnorowborder" dir="ltr" style="vertical-align:top;"><strong class="ph b">Reply active or inactive?</strong></td>
<td class="entry cell-norowborder" dir="ltr" style="vertical-align:top;"><strong class="ph b">AI agent responds with the…</strong></td>
</tr>
<tr class="row">
<td class="entry nocellnorowborder" dir="ltr" style="vertical-align:top;">Active</td>
<td class="entry nocellnorowborder" dir="ltr" style="vertical-align:top;">Active</td>
<td class="entry cell-norowborder" dir="ltr" style="vertical-align:top;">Dialogue associated with the reply for the detected
language</td>
</tr>
<tr class="row">
<td class="entry nocellnorowborder" dir="ltr" style="vertical-align:top;">Active</td>
<td class="entry nocellnorowborder" dir="ltr" style="vertical-align:top;">Inactive</td>
<td class="entry cell-norowborder" dir="ltr" style="vertical-align:top;">“Default reply” <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749481882#topic_edj_gnp_xfc" target="_blank">system reply</a>
</td>
</tr>
<tr class="row">
<td class="entry nocellnorowborder" dir="ltr" style="vertical-align:top;">Inactive</td>
<td class="entry nocellnorowborder" dir="ltr" style="vertical-align:top;">Active</td>
<td class="entry cell-norowborder" dir="ltr" style="vertical-align:top;">“Unsupported language reply” system reply</td>
</tr>
<tr class="row">
<td class="entry row-nocellborder" dir="ltr" style="vertical-align:top;">Inactive</td>
<td class="entry row-nocellborder" dir="ltr" style="vertical-align:top;">Inactive</td>
<td class="entry cellrowborder" dir="ltr" style="vertical-align:top;">“Unsupported language reply” system reply</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div aria-labelledby="ariaid-title3" class="topic nested1" id="topic_wwm_4xx_jgc">
<h2 class="title topictitle2" id="ariaid-title3">Detecting the customer’s language</h2>
<div class="body">
<p class="p">There are three different methods you can use to detect a customer’s language during
a conversation with an AI agent: </p>
<ul class="ul" id="topic_wwm_4xx_jgc__ul_mwl_5dy_jgc">
<li class="li"><a class="xref" href="#topic_n1b_ydy_jgc">Detecting language based on the customer’s first message</a></li>
<li class="li"><a class="xref" href="#topic_qxk_xdy_jgc">Detecting language based on a CRM integration</a></li>
<li class="li"><a class="xref" href="#topic_vcv_12y_jgc">Detecting language based on selection in welcome message</a></li>
</ul>
<p class="p">Based on this information, you can then <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357733406234" target="_blank">use a conditional block</a> to divert users to the correct
reply.</p>
</div>
<div aria-labelledby="ariaid-title4" class="topic nested2" id="topic_n1b_ydy_jgc">
<h3 class="title topictitle3" id="ariaid-title4">Detecting language based on the customer’s first message</h3>
<div class="body">
<p class="p">Detecting the language based on the customer’s first message leverages natural
language processing (NLP) technology. This type of language detection works by
default and is used if the language isn’t set manually. Additionally, this works
best on messages longer than five words. Using this method, the AI agent can
produce a: </p>
<ul class="ul" id="topic_n1b_ydy_jgc__ul_brg_kfy_jgc">
<li class="li">
<strong class="ph b">High-confidence identification of an active language.</strong> In this case,
the AI agent responds to the customer in this language. </li>
<li class="li">
<strong class="ph b">High-confidence prediction of an inactive or unsupported language.</strong> In
this case, the AI agent sends the “Unsupported language reply” system reply. </li>
<li class="li">
<strong class="ph b">Low-confidence prediction of any language.</strong> In this case, the AI agent
falls back to its <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749666714#topic_fhd_mzx_jgc" target="_blank">default language</a> instead. </li>
</ul>
<p class="p">It’s important to note that using the customer’s first message to detect their
language may not be the right method in the following types of scenarios: </p>
<ul class="ul" id="topic_n1b_ydy_jgc__ul_jqm_pfy_jgc">
<li class="li">
<strong class="ph b">Your customers are likely to begin with short messages or use multiple
languages in the same message.</strong> For this, it’s worth <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749580186" target="_blank">reviewing your AI agent’s conversation
logs</a> to see what first messages customers typically send. Are
they shorter than five words? Do they mix languages? </li>
<li class="li">
<strong class="ph b">Your customer base speaks multiple closely related languages.</strong> Another
consideration is that closely related languages—such as Spanish and Catalan,
or Serbian and Croatian—may have more overlap, making some sentences hard to
predict with a high confidence. </li>
</ul>
<p class="p">In cases like these, it’s not recommended to use the customer’s first message to
detect their language, as there’s a higher chance of the AI agent setting an
incorrect language or sending the “Unsupported language reply” system reply.
</p>
</div>
</div>
<div aria-labelledby="ariaid-title5" class="topic nested2" id="topic_qxk_xdy_jgc">
<h3 class="title topictitle3" id="ariaid-title5">Detecting language based on a CRM integration</h3>
<div class="body">
<p class="p">To detect a customer’s language based on your CRM integration, you must perform
the following tasks:</p>
<ul class="ul" id="topic_qxk_xdy_jgc__ul_bcw_xfy_jgc">
<li class="li">
<a class="xref" href="#topic_zwr_sfy_jgc">Setting the locale ID in the language</a>
</li>
<li class="li"><a class="xref" href="#topic_gvj_5fy_jgc">Creating a configured action to obtain user locale</a></li>
<li class="li"><a class="xref" href="#topic_vcv_12y_jgc">Detecting language based on selection in welcome message</a></li>
</ul>
</div>
<div aria-labelledby="ariaid-title6" class="topic nested3" id="topic_zwr_sfy_jgc">
<h4 class="title topictitle4" id="ariaid-title6">Setting the locale ID in the language</h4>
<div class="body">
<p class="p">First, make sure the locale ID is configured in the appropriate language. If
you didn’t already configure this when you <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749666714#topic_rmc_kzx_jgc" target="_blank">added the language</a>, you can <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749666714#topic_x5t_mzx_jgc" target="_blank">edit the language</a> to update the
locale ID.</p>
<div class="p">
<div class="note" id="topic_zwr_sfy_jgc__note_bbf_jtd_h3c">
<span class="notetitle">Note:</span> Locale ID values are case sensitive.</div>
</div>
<p class="p"><img class="image" id="topic_zwr_sfy_jgc__image_acx_3gy_jgc" src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/aiaa_language_set_locale_ID.png" width="350"></p>
</div>
</div>
<div aria-labelledby="ariaid-title7" class="topic nested3" id="topic_gvj_5fy_jgc">
<h4 class="title topictitle4" id="ariaid-title7">Creating a configured action to obtain user locale</h4>
<div class="body">
<p class="p">Next, you must create a configured action to obtain the customer’s locale. </p>
<p class="p"><strong class="ph b">To create a configured action to obtain user locale</strong></p>
<div class="p">
<ol class="ol" id="topic_gvj_5fy_jgc__ol_ryt_jgy_jgc">
<li class="li"><span class="ph">In the AI agents workspace, <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357756913178#topic_t25_qvj_tdc" target="_blank">select the AI agent</a> you want to work
with.</span></li>
<li class="li"><span class="ph">Click <img class="image" id="topic_gvj_5fy_jgc__image_clr_cmz_fjc" src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/ai_agents_api_integrations_icon.png">
<strong class="ph b">Actions</strong> in the sidebar, then select <strong class="ph b">Configured actions</strong>.</span></li>
<li class="li">Click <strong class="ph b">Create action</strong>. </li>
<li class="li">In <strong class="ph b">Name</strong>, give the action a descriptive name. </li>
<li class="li">In <strong class="ph b">Target</strong>, select your CRM. </li>
<li class="li">In <strong class="ph b">Task</strong>, select the following option associated with your
CRM: <ul class="ul" id="topic_gvj_5fy_jgc__ol_oss_lgy_jgc">
<li class="li">
<strong class="ph b">Sunshine Conversations</strong>: <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357734565402" target="_blank">Get user</a>
</li>
<li class="li">
<strong class="ph b">Zendesk Chat</strong>: <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357750804250" target="_blank">Get tag</a>
</li>
</ul>
</li>
<li class="li">In <strong class="ph b">Field to retrieve</strong>, select <strong class="ph b">locale</strong>.</li>
<li class="li">In <strong class="ph b">Save as parameter</strong>, enter <strong class="ph b">active_language</strong>. </li>
<li class="li">Click <strong class="ph b">Create</strong>. </li>
</ol>
</div>
</div>
</div>
<div aria-labelledby="ariaid-title8" class="topic nested3" id="topic_bhd_vfy_jgc">
<h4 class="title topictitle4" id="ariaid-title8">Adding the configured action at the AI agent level</h4>
<div class="body">
<p class="p">Finally, you must add the configured action at the AI agent level. As part of
this, you’ll configure it to run at the beginning of every conversation. </p>
<p class="p"><strong class="ph b">To add the configured action at the AI agent level</strong></p>
<ol class="ol" id="topic_bhd_vfy_jgc__ol_vhh_sgy_jgc">
<li class="li"><span class="ph">In the AI agents workspace, <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357756913178#topic_t25_qvj_tdc" target="_blank">select the AI agent</a> you want to work
with.</span></li>
<li class="li"><span class="ph">Click <img class="image" id="topic_bhd_vfy_jgc__image_wfv_rxf_y3c" src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/ai_agents_settings_icon.png">
<strong class="ph b">Settings</strong> in the sidebar, then select <strong class="ph b">Events and actions</strong>.</span></li>
<li class="li">Click <strong class="ph b">Add action</strong>. </li>
<li class="li">Select <strong class="ph b">Conversation started</strong>. </li>
<li class="li">Select the configured action you created above.</li>
</ol>
</div>
</div>
</div>
<div aria-labelledby="ariaid-title9" class="topic nested2" id="topic_vcv_12y_jgc">
<h3 class="title topictitle3" id="ariaid-title9">Detecting language based on selection in welcome message</h3>
<div class="body">
<p class="p">At the beginning of the conversation, you can configure your conversation flow to
ask the user their language preference. To do this, <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357733406234" target="_blank">use a conditional block</a> that includes
a fallback option with selectable supported languages. When a customer selects a
language, they’re directed to the rest of the conversation flow in that
language. See the image below for an example.</p>
<p class="p"><img class="image" id="topic_vcv_12y_jgc__image_dvd_ygy_jgc" src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_7293772757650.png" width="800"></p>
</div>
</div>
</div>
<div aria-labelledby="ariaid-title10" class="topic nested1" id="topic_nzh_pxx_jgc">
<h2 class="title topictitle2" id="ariaid-title10">Resetting the detected language</h2>
<div class="body">
<p class="p">Because many people work and travel in locations that aren’t aligned with the
language they’re most comfortable with, it’s a good idea to allow customers to reset
their language so they can communicate with you in their preferred language. </p>
<p class="p">You can ask the customer to reset their language by creating a “Change language” use
case. Or, you could even repurpose the “Unsupported language reply” system reply. In
either case, you can then build a dialogue capable of resetting the
<em class="ph i">active_language</em> parameter. </p>
<p class="p"><strong class="ph b">To reset the detected language</strong></p>
<div class="p">
<ol class="ol" id="topic_nzh_pxx_jgc__ol_ej1_1hy_jgc">
<li class="li">
<a class="xref" href="https://support.zendesk.com/hc/en-us/articles/9041901679130" target="_blank">Create a new use case</a> called
<strong class="ph b">Change language</strong> or <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749481882#topic_jhb_k4p_xfc" target="_blank">open the Unsupported language reply
system reply</a> for editing. </li>
<li class="li">
<a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357749494810" target="_blank">Create a dialogue</a> for the use case
in which you: <ol class="ol" id="topic_nzh_pxx_jgc__ol_avt_1hy_jgc" type="a">
<li class="li">
<a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357733406234" target="_blank">Add a conditional block</a> to
check the <em class="ph i">active_language</em> parameter to give options for
languages. </li>
<li class="li">Add buttons that correspond to the languages the AI agent supports. </li>
<li class="li">
<a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357756623770" target="_blank">Add configured actions</a> to
set the language based on the conversation data. <p class="p">See the image
below for an example.</p>
<p class="p"><img class="image" id="topic_nzh_pxx_jgc__image_sw3_fhy_jgc" src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/bots_8751022282642.png" width="800"></p>
</li>
</ol>
</li>
</ol>
</div>
</div>
</div>
<div aria-labelledby="ariaid-title11" class="topic nested1" id="topic_axl_qxx_jgc">
<h2 class="title topictitle2" id="ariaid-title11">Preventing the unsupported language reply from triggering</h2>
<div class="body">
<p class="p">The “Unsupported language reply” system reply checks the <em class="ph i">active_language</em>
session parameter to determine whether the customer’s language is detected and, if
so, supported. This system reply is automatically triggered during a conversation in
the following scenarios: </p>
<ul class="ul" id="topic_axl_qxx_jgc__ul_npf_khy_jgc">
<li class="li">The <em class="ph i">active_language</em> parameter is not set, and language detection
identifies an unsupported language. </li>
<li class="li">The <em class="ph i">active_language</em> parameter is set, but the customer breaks away from a
dialogue and begins using an unsupported language. </li>
</ul>
<p class="p">If you support a limited number of languages but still want to allow customers to
communicate in any language, you can prevent the system reply from triggering when
the <em class="ph i">active_language</em> parameter is already set (the second bullet point above). </p>
<p class="p">In this scenario, the <em class="ph i">active_language</em> value isn’t changed and the “Unsupported
language reply” system reply isn’t triggered. Instead, the AI agent sends its next
reply based on the following priority: relevant use case &gt; “Generative replies”
system reply &gt; default reply. </p>
<p class="p"><strong class="ph b">To prevent the unsupported language reply from triggering</strong></p>
<div class="p">
<ol class="ol" id="topic_axl_qxx_jgc__ol_usk_lhy_jgc">
<li class="li"><span class="ph">In the AI agents workspace, <a class="xref" href="https://support.zendesk.com/hc/en-us/articles/8357756913178#topic_t25_qvj_tdc" target="_blank">select the AI agent</a> you want to work
with.</span></li>
<li class="li"><span class="ph">Click <img class="image" id="topic_axl_qxx_jgc__image_tkt_4xf_y3c" src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/ai_agents_content_icon.png">
<strong class="ph b">Content</strong> in the sidebar, then select <strong class="ph b">Use cases</strong>.</span></li>
<li class="li">Select <strong class="ph b">Unsupported language reply</strong>. </li>
<li class="li">Select the <strong class="ph b">Settings</strong> tab. </li>
<li class="li">Select <strong class="ph b">Prevent triggering the 'Unsupported language reply' when
<em class="ph i">active_language</em> is set</strong>.<p class="p"><img class="image" id="topic_axl_qxx_jgc__image_dsm_qhy_jgc" src="https://zen-marketing-documentation.s3.amazonaws.com/docs/en/aiaa_unsupported_language_prevent_setting.png" width="600"></p>
</li>
<li class="li">Click <strong class="ph b">Save</strong>.</li>
</ol>
</div>
</div>
</div>
<script id="docs-schema-markup" type="application/ld+json">{
"@context": "https://schema.org",
"@type": "TechArticle",
"@id": "https://support.zendesk.com/hc/en-us/articles/8357756692890",
"url": "https://support.zendesk.com/hc/en-us/articles/8357756692890",
"headline": "Configuring language detection for AI agents",
"description": "You learn how to configure language detection for AI agents, reset the detected language, and prevent the unsupported language reply from triggering when active_language is already set.",
"articleSection": "Managing languages for AI agents",
"datePublished": "2024-11-11T22:25:00+00:00",
"dateModified": "2026-08-31T16:40:45.697885+00:00",
"inLanguage": "en",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://support.zendesk.com/hc/en-us/articles/8357756692890"
},
"author": {
"@type": "Organization",
"name": "Zendesk",
"@id": "https://www.zendesk.com"
},
"publisher": {
"@type": "Organization",
"name": "Zendesk",
"@id": "https://www.zendesk.com"
},
"isPartOf": {
"@type": "WebSite",
"name": "Zendesk Help",
"@id": "https://support.zendesk.com/hc/"
},
"about": {
"@type": "SoftwareApplication",
"name": "Zendesk",
"@id": "https://www.zendesk.com",
"softwareAddOn": {
"@type": "SoftwareApplication",
"name": "AI agents",
"@id": "https://support.zendesk.com/hc/en-us/sections/8988994355994"
}
}
}</script>
</body>