cool-doctor-14149
09/30/2025, 2:01 PMtall-airline-16756
09/30/2025, 2:01 PMtall-airline-16756
09/30/2025, 2:02 PMcool-doctor-14149
10/01/2025, 5:05 AMtall-airline-16756
10/01/2025, 5:07 AMfrom livekit.plugins import gladia
stt = gladia.STT(
translation_enabled=True,
languages=["en", "es"], # Original spoken languages
translation_target_languages=["es", "en"] # Target languages for translation
)
2. Integrate STT with Agent Session: Next, use the STT instance within the AgentSession to process audio, translate it, and generate the output audio in the target language.
3. Generate Translated Audio: For turning the translated text back into speech, you can use a Text-to-Speech (TTS) service like ElevenLabs or Google TTS.
4. Publish Translated Audio: The system will publish the translated audio as a new track named in the format {input_track_id}-{target_language_code}. This helps ensure that participants receive the correct audio stream.
5. Client-Side Handling: Make sure participants subscribe only to audio tracks that match their preferred language. This can be managed by filtering tracks based on their metadata.
6. Language Configuration: It's important to specify each participant's language in their access token attributes. The agent uses this information to know which translations to provide.
7. Bidirectional Translation Logic: The agent dynamically handles input tracks and creates translations for each language pair needed, so participants hear only the translated speech.
To see this in action, you might find the multi-user-translator.py example really helpful. It demonstrates bidirectional real-time translation and can be adapted to fit your specific needs.
If you'd like, I'm here to help you further with configuring the agent or setting up the telephony integration—just let me know!
Sources: Gladia integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-gladia/livekit/plugins/gladia/stt.py