Multilingual agents can handle conversations in multiple languages. This page covers how to maintain language-specific content, voices, and configurations as your agent evolves.
Quick reference
| I need to… | Action | Time estimate |
|---|
| Add a new language | Add a voice in the target language from the Voice Library | 10 min |
| Update language-specific knowledge | Edit topics with language variants | 5-10 min |
| Change voice for a language | Channels > Voice > Agent Voice → Change | 5 min |
| Fix translation issues | Edit language-specific responses | 5 min |
| Test language switching | Agent Chat → Switch language mid-call | 3 min |
| Add language-specific functions | Functions → Add language parameter | 10 min |
Understanding multilingual agents
How multilingual agents work
Multilingual agents can:
- Detect the caller’s language automatically
- Switch languages mid-conversation if the caller changes
- Maintain language-specific knowledge for each language
- Use appropriate voices per language
- Handle mixed-language queries (code-switching)
Supported languages
PolyAI supports 30+ languages including:
- English (en)
- Spanish (es)
- French (fr)
- German (de)
- Italian (it)
- Portuguese (pt)
- Dutch (nl)
- Polish (pl)
- Russian (ru)
- Japanese (ja)
- Korean (ko)
- Chinese Mandarin (zh)
- Arabic (ar)
- Hindi (hi)
- And many more
Check the multilingual settings documentation for the complete list.
Adding or removing languages
Adding a new language
- Go to Channels > Voice > Agent Voice
- Click Change to open the Voice Library
- Use the Language filter to find voices in your target language
- Select and apply a voice for the new language
- Add language-specific knowledge (see below)
- Update Agent Behaviour rules to handle the new language
- Test in Agent Chat
- Publish when ready
Use a multilingual_v2 voice model to ensure proper pronunciation across all languages.
Removing a language
- Go to Channels > Voice > Agent Voice
- Remove the voice associated with the language you want to drop
- Update any language-specific knowledge and functions
- Publish the change
Removing a language will cause the agent to fall back to the default language for callers speaking that language.
Managing language-specific knowledge
Managed Topics with language variants
To provide different content per language:
- Go to Build > Knowledge > Managed Topics tab
- Create or edit a topic
- Add language variants for each supported language
- Provide translations or culturally-appropriate content
- Save and test
Example:
English (en):
- Question: “What are your hours?”
- Answer: “We’re open Monday through Friday, 9 AM to 5 PM.”
Spanish (es):
- Question: “¿Cuál es su horario?”
- Answer: “Estamos abiertos de lunes a viernes, de 9 AM a 5 PM.”
French (fr):
- Question: “Quelles sont vos heures d’ouverture?”
- Answer: “Nous sommes ouverts du lundi au vendredi, de 9h à 17h.”
Connected knowledge per language
For Connected knowledge sources:
- URL sources - Add separate URLs for each language version of your website
- File sources - Upload language-specific PDFs or documents
- Integration sources - Configure APIs to return language-specific data
Example setup:
- English:
https://example.com/en/faq
- Spanish:
https://example.com/es/preguntas-frecuentes
- French:
https://example.com/fr/faq
When to use shared vs. language-specific knowledge
| Use shared knowledge when… | Use language-specific knowledge when… |
|---|
| Information is universal (phone numbers, addresses) | Content needs translation |
| Data is language-agnostic (product IDs, prices) | Cultural context matters (holidays, customs) |
| You want consistency across languages | Local regulations differ by region |
| Maintaining multiple versions is impractical | User expectations vary by language |
Updating voices for each language
Selecting language-appropriate voices
- Go to Channels > Voice > Agent Voice
- Click Change to open the Voice Library
- Filter by Language and Region to find native voices for each language
- Preview each voice with custom text in the target language
- Select and apply
Voice quality considerations
- Use native voices - Don’t use an English voice for Spanish
- Match regional accents - Use Mexican Spanish for Mexico, Castilian for Spain
- Test pronunciation - Ensure the voice handles language-specific characters
- Consider gender and tone - Match your brand across languages
Multilingual voice models
Some TTS providers offer multilingual models that can speak multiple languages:
from polyai.voice import ElevenLabsVoice
conv.set_voice(
ElevenLabsVoice(
provider_voice_id="multilingual_voice_id",
model_id="eleven_multilingual_v2" # Supports 30+ languages
)
)
Multilingual models are convenient but may have slightly lower quality than language-specific models.
Handling language detection
Automatic language detection
By default, agents detect the caller’s language automatically:
- The caller speaks
- ASR (Automatic Speech Recognition) identifies the language
- The agent responds in the detected language
Tuning detection behavior
If the agent is switching languages too aggressively or not enough, adjust via Agent Behaviour rules. For example, you can instruct the agent to only switch languages when the caller has spoken consistently in a different language for multiple turns.
Test with mixed-language scenarios to find the right balance.
Explicit language selection
Allow callers to choose their language explicitly:
- Create a Managed Topic for language selection
- Add options like “Press 1 for English, 2 for Spanish”
- Use a function to set the language:
def set_language(language_code):
conv.set_language(language_code)
return {"utterance": f"Switching to {language_code}."}
Handling code-switching
Code-switching is when callers mix languages in a single conversation:
- Example: “I need to hacer una reservación for mañana.”
To handle this:
- Use multilingual voice models that support multiple languages
- Test with realistic mixed-language scenarios
- Consider your target audience’s code-switching patterns
- Adjust Agent Behaviour rules to accommodate mixed-language input
Fixing translation issues
Common translation problems
| Issue | Likely cause | Solution |
|---|
| Awkward phrasing | Direct translation, not localization | Rewrite for natural language |
| Cultural mismatches | Literal translation of idioms | Use culturally-appropriate equivalents |
| Incorrect terminology | Generic translation | Use domain-specific terms |
| Formatting issues | Date/time/number formats differ | Localize formats per language |
| Missing context | Translation without understanding | Provide context to translators |
Updating translations
To fix a translation issue:
- Identify the problematic response in Conversation Review
- Find the corresponding Managed Topic or function
- Edit the language-specific variant
- Test in Agent Chat with native speakers
- Publish when satisfied
Using professional translators
For high-quality translations:
- Export knowledge - Download Managed Topics as CSV
- Send to translators - Provide context and domain glossary
- Import translations - Upload the translated CSV
- Review and test - Verify quality before publishing
Language-specific functions
Adding language parameters to functions
Functions can behave differently per language:
def get_store_hours(location, language="en"):
# Fetch hours from API
hours = api.get_hours(location)
# Format response based on language
if language == "es":
return {"utterance": f"Estamos abiertos de {hours['open']} a {hours['close']}."}
elif language == "fr":
return {"utterance": f"Nous sommes ouverts de {hours['open']} à {hours['close']}."}
else:
return {"utterance": f"We're open from {hours['open']} to {hours['close']}."}
Accessing the current language
Get the caller’s language in functions:
def dynamic_response():
current_language = conv.language
conv.log.info(f"Caller language: {current_language}")
# Use language-specific logic
if current_language == "es":
return {"utterance": "Respuesta en español"}
else:
return {"utterance": "Response in English"}
Language-specific API calls
Some APIs require language parameters:
def search_products(query):
language = conv.language
# Call API with language parameter
results = requests.get(
"https://api.example.com/search",
params={"q": query, "lang": language}
)
return {"utterance": format_results(results, language)}
Testing multilingual agents
Test in Agent Chat
- Open Agent Chat
- Select a language from the dropdown
- Speak or type in that language
- Verify the agent responds correctly
- Try switching languages mid-conversation
Test language detection
- Start a conversation in one language
- Switch to another language mid-call
- Verify the agent detects and switches
- Check for false positives (switching when it shouldn’t)
Test with native speakers
- Recruit testers - Find native speakers of each language
- Provide scenarios - Give realistic test cases
- Gather feedback - Ask about naturalness, accuracy, and cultural appropriateness
- Iterate - Refine based on feedback
Common test scenarios
- Language switching - Start in English, switch to Spanish
- Mixed queries - Ask questions with code-switching
- Accents and dialects - Test regional variations
- Background noise - Verify ASR works in noisy environments
- Edge cases - Test with uncommon words or phrases
Troubleshooting multilingual issues
Common issues and solutions
| Issue | Likely cause | Solution |
|---|
| Agent doesn’t detect language | No voice configured for that language | Add a voice for the language from the Voice Library |
| Agent switches languages incorrectly | Detection too aggressive | Adjust language-switching behavior in Agent Behaviour rules |
| Voice sounds unnatural | Wrong voice model for language | Use language-native voice |
| Translations are awkward | Direct translation | Rewrite for natural language |
| Knowledge not available in language | Missing language variants | Add language-specific content |
| Function responses in wrong language | Function doesn’t check language | Add language parameter to function |
| ASR accuracy is low | Accent or dialect not supported | Test with different voice models |
Debugging language issues
- Check Conversation Review - See which language was detected
- Review Diagnosis logs - Look for language-related errors
- Test in Agent Chat - Reproduce the issue
- Verify settings - Ensure language is properly configured
- Check knowledge coverage - Confirm content exists for that language
Best practices
Content management
- Maintain parity - Ensure all languages have equivalent content
- Localize, don’t just translate - Adapt for cultural context
- Use consistent terminology - Create a glossary for domain terms
- Update all languages together - Don’t let translations lag behind
Voice and audio
- Use native voices - Never use a non-native voice for a language
- Match regional preferences - Consider accent and dialect
- Test pronunciation - Verify proper handling of special characters
- Adjust speech rate - Some languages sound better at different speeds
Testing and quality
- Test with native speakers - Don’t rely on non-native testers
- Monitor language distribution - Track which languages are used most
- Review low-confidence calls - Identify language detection issues
- A/B test translations - Try different phrasings to find what works best
Maintenance routine
- Monthly language audit - Review content parity across languages
- Quarterly voice review - Ensure voices still sound natural
- Regular translation updates - Keep content current in all languages
- Monitor language-specific metrics - Track performance per language
Common workflows
Adding a new language to an existing agent
- Add a voice for the language from the Voice Library at Channels > Voice > Agent Voice
- Update Agent Behaviour rules to handle the new language
- Export existing Managed Topics
- Translate content (use professional translators)
- Import translated content
- Add language-specific Connected knowledge sources
- Update functions to handle the new language
- Test thoroughly with native speakers
- Publish to Sandbox
- Run Test Sets for the new language
- Promote to Pre-release for UAT
- Promote to Live
Updating translations across all languages
- Identify the content to update (e.g., new business hours)
- Update the default language version
- Export Managed Topics
- Send to translators with context
- Import translated updates
- Test each language in Agent Chat
- Publish and promote
Fixing a language detection issue
- Review calls where language switching was incorrect
- Check Diagnosis logs for language detection events
- Adjust language-switching behavior in Agent Behaviour rules
- Test with the problematic scenario
- If needed, add explicit language selection option
- Publish and monitor
Optimizing for a specific language
- Review analytics for that language
- Identify common queries and issues
- Add language-specific knowledge
- Adjust voice settings (rate, pitch)
- Test with native speakers
- Iterate based on feedback
Related pages