Skip to main content
Back to how-to guides Use this pattern when a fixed reply must sound different from its text. Examples: a pause, a code read one character at a time, a slower rate, or a different voice.

Concept

A VOICE: block sits under a RESPOND. It changes how that one reply is spoken. The reply text and the transcript stay the same. You can write a VOICE: block under:
  • A RESPOND in a FLOW step.
  • A RESPOND in ON_START.
  • A RESPOND in a COMPLETE condition.
  • A named template.
A reasoning agent writes its replies with the model, so those replies have no VOICE: block. For them, set voice defaults for the whole call. See Set voice defaults for the whole call.

Which engine reads which key

The result depends on your voice mode and your text-to-speech provider. Pipeline voice means speech-to-text, agent, then text-to-speech. Realtime voice means speech-to-speech. Microsoft Speech is the only provider that plays SSML in pipeline voice. The older Azure option uses the same engine and also plays SSML. Google, Amazon Polly, and ElevenLabs get the plain version. Decide by what you need:

SSML rules

  • The value must start with a <speak> tag. A value that starts with other text is spoken as plain text. The compiler gives no message.
  • Always add plain_text. Every provider except Microsoft Speech speaks it.
  • A {{variable}} in ssml is escaped, so a name such as Tom & Jerry cannot break the markup. A {{variable}} in plain_text is not escaped.
  • A reply that plays SSML is sent as one message, not streamed. Audio starts after the whole reply is ready.
  • The platform does not check SSML structure. Test every SSML reply on a call.
  • Tags such as mstts:express-as need a Microsoft voice that supports them.

Minimal working example

A booking agent collects a reference and a date. It then confirms both. The reference is read one character at a time. agents/booking-confirmation.agent.abl
Variable sources:
  • booking_ref and check_in are GATHER fields. The caller supplies both.
  • check_in is a date field, so it holds an ISO date such as 2026-12-15. The date format in say-as expects this shape.
On Microsoft Speech, the caller hears the reference letter by letter and the date as a date. On any other provider, the caller hears plain_text. The platform turns the ISO date in plain_text into “15 December 2026”.

How it works

  1. The platform fills in the {{variables}}. Values in ssml are escaped for XML.
  2. The platform checks that ssml starts with <speak. If it does not, the reply is spoken as plain text.
  3. On Microsoft Speech, the SSML is played as one buffered message. Otherwise the platform speaks plain_text, or the reply text with markup removed.
  4. If the reply sets provider, voice_id, speed, or temperature, the platform checks them against the call’s text-to-speech setup. It applies what it can. It skips the rest.

Per-reply voice settings

A reply can switch provider only when that provider is already part of the call. That means the channel’s text-to-speech provider, or a provider in the channel’s language voice setup. If the check fails, the platform ignores provider, voice_id, speed, and temperature for that reply. The call continues with its normal voice. The trace records the reason, such as unsupported_provider, unsupported_speed, or unsupported_temperature. A reply with any applied voice setting is sent as one buffered message. Audio starts later than with a streamed reply. pace is another name for speed. If a reply sets both, speed wins. If you set neither, the channel’s voice settings apply.

Realistic example

A delivery agent targets Microsoft Speech and ElevenLabs channels with one file. Each provider reads the keys it supports and ignores the others. agents/delivery-update.agent.abl
Variable sources:
  • tracking_code and delivery_date are GATHER fields. The caller supplies both.
  • The call-level speed: 0.95 applies to every reply that sets no speed of its own.
What each channel does:

Common variations

Set voice defaults for the whole call

EXECUTION.voice sets the voice for the whole call. It works for generated replies too. It takes priority over the channel’s voice settings.
This snippet goes in an agent file. elevenlabs and your-voice-id are project-local values. Use a provider and voice that are set up in your project’s voice settings. The platform reads these settings when the call connects. A speed or temperature that the provider does not support is ignored.

Change the voice for one reply

Set the keys next to the reply. The provider must already be part of the call.
your-slow-voice-id is a project-local voice. access_code must be a collected field or another session value. Use lowercase or uppercase keys. Both work.

Switch voices by behavior profile

A behavior profile can carry the same keys. The platform applies them when the call connects and the profile WHEN matches the channel. behavior_profiles/voice_slow.behavior_profile.abl
To change the voice later in the call, set the keys on a FLOW step or on a profile attached to that step. The agent must attach the profile. See Use behavior profiles by context.

Reuse one spoken version in a template

Put the VOICE: block in a template. Every reply that uses the template speaks the same way.
A TEMPLATE(name) value in SSML or PLAIN_TEXT must name a template that exists. The compiler rejects an unknown name.

Match the voice to the caller’s language

auto_tts_language_switch: true switches the voice to match the language of the reply. Set up voices for each language on the voice channel first. See Configure speaking style, tone, and pace.

Verification

  1. Call a Microsoft Speech channel. Listen for the pause, the slow code, and the date read as a date.
  2. Call an ElevenLabs channel with the same agent. The reply must speak plain_text. It must not read any tag aloud.
  3. In the call transcript, check that the text matches plain_text or the reply text. It must show no markup.
  4. For provider, voice_id, speed, or temperature, open the trace. Find the voice_config_resolved event. Check supported, appliedVoice, appliedSpeed, and unsupportedReasons.
  5. Break one ssml value on purpose. Remove the <speak> tag. The reply must now be spoken as plain text.

Production readiness checklist

  • Every ssml value has a matching plain_text value.
  • Every SSML reply was tested on a real Microsoft Speech call.
  • Every provider and voice ID named in VOICE: is set up in the project.
  • Voice IDs and speeds are tested on each provider that you deploy.
  • Latency was tested for replies that use SSML or per-reply voice settings. They are not streamed.
  • A reviewer listened to the spelled-out codes and dates.

Common mistakes

Troubleshooting