Voice reply mirrors inbound Voice Notes (Speech-to-Text), but it is off by default. Set
voice.mode: match_inbound for the intuitive βspeak in / speak outβ symmetry.Quick Start
1
Level 1 β Bool shorthand
voice: true turns replies into voice notes for every message (mode: always).2
Level 2 β Mode shorthand
A bare
mode implies enabled: true. Use match_inbound to speak back only when the user sent a voice memo.3
Level 3 β Dict
Tune the voice, model, speed, format, and length cap.
4
Level 4 β TtsConfigSchema
Build the channel config in Python with the validated schema.
How It Works
The gateway synthesises the reply after the text is already sent, so voice is always a bonus β never a blocker.Graceful degradation
Voice reply is best-effort β the text reply is always delivered first.- Empty / whitespace text β skipped silently.
- Reply longer than
max_charsβ skipped,INFOlog entry. - TTS tool import fails (missing
openai/litellmdeps) β skipped,WARNINGlog entry. - Synthesis error β skipped,
ERRORlog entry. - Adapter
send_voicefails β logged; the text reply already went out.
Configuration Options
Fields fromTtsConfig / TtsConfigSchema.
Bool shorthand
Resolution order
The effective policy is resolved from, in order:config.metadata["voice"](operator override),config.metadata["tts"](alias),- a direct
config.voiceattribute (schema-backed configs), - a direct
config.ttsattribute, then - the off-by-default
TtsConfig().
Choosing a Mode
Pick the mode that matches how chatty your users want the bot to be.Per-Platform YAML
Telegram is wired today; other adapters share the same_tts helper and can adopt it without further core changes.
Platform Support
The
[[audio_as_voice]] manual escape hatch continues to work for pre-rendered audio on Telegram.
User Interaction Flow
A voice-in / voice-out conversation on Telegram withmode: match_inbound.
- The user taps ποΈ and records a voice note on Telegram.
- Inbound STT transcribes it β the agent processes the text β produces a plain-text reply.
- The gateway sees
voice.mode: match_inboundand that the inbound was a voice memo β synthesises the reply withopenai/tts-1. - The user receives both: the text reply and a native voice note they can play right in the chat.
- If the user next sends a text message, they get only a text reply β no unnecessary audio.
Best Practices
Prefer match_inbound over always
Prefer match_inbound over always
match_inbound speaks back only when the user spoke first β the symmetry users expect. Reserve always for voice-first or accessibility bots.Cap length for chatty agents
Cap length for chatty agents
Set
max_chars low so long analytical replies donβt become multi-minute audio clips. The text reply still carries the full answer.Ship your TTS provider's API key
Ship your TTS provider's API key
openai/tts-1 is the default, so set OPENAI_API_KEY. Any LiteLLM-supported TTS model works via the model: field.Trust the graceful-degradation contract
Trust the graceful-degradation contract
Voice reply is best-effort β the plain-text reply is always delivered first, so users never lose a message even when synthesis fails.
Keep the manual escape hatch for pre-rendered audio
Keep the manual escape hatch for pre-rendered audio
The
[[audio_as_voice]] marker still works on Telegram for audio youβve already produced β e.g. a recording pulled from a knowledge base.Related
Voice Notes (Speech-to-Text)
The inbound counterpart β transcribe voice notes into text for the agent.
Audio Tools
tts_tool, stt_tool, and AudioAgent.speech.Voice Notes
The inbound voice-notes doc for gateway bots.
Gateway
The overall gateway pattern β voice reply is one of several channel features.

