> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How to use SSML and voice-specific response settings

[Back to how-to guides](https://koreai.mintlify.site/agent-platform/abl/how-to/overview.md#voice-and-realtime-conversations)

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](#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.

| Key | Pipeline voice, Microsoft Speech | Pipeline voice, any other provider | Realtime voice |
| - | - | - | - |
| `ssml` | Played as SSML. | Ignored. | Ignored. |
| `plain_text` | Used in the transcript. Spoken when `ssml` is missing or not usable. | Spoken in place of the reply text. | Spoken in place of the reply text when the platform supplies the text. |
| `provider`, `voice_id` | Changes the voice for this reply. | Changes the voice for this reply. | Not applied. Realtime providers use their own voices. |
| `speed`, `pace` | Ignored. Use `<prosody>` in `ssml`. | Applied for ElevenLabs, Sarvam AI, Cartesia, PlayHT, RimeLabs, Soniox, and custom providers. Ignored for the rest. | Ignored. |
| `temperature` | Ignored. | Applied for Sarvam AI, PlayHT, RimeLabs, Inworld, and custom providers. Ignored for the rest. | Ignored. |
| `instructions` | Not applied to speech. | Not applied to speech. | See [Configure speaking style, tone, and pace](https://koreai.mintlify.site/agent-platform/abl/how-to/configure-voice-speaking-style). |

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:

| You need | Use |
| - | - |
| A pause, emphasis, or a spelled-out code on Microsoft Speech. | `ssml` and `plain_text`. |
| The same words on every provider. | `plain_text` only. |
| A slower or faster voice on a supported non-Microsoft provider. | `speed`. |
| A different voice for one reply. | `provider` and `voice_id`. |
| One voice or speed for the whole call. | `EXECUTION.voice`. |

### 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`

```yaml theme={null}
AGENT: Booking_Confirmation

GOAL: "Confirm a hotel booking to a caller on the phone."

PERSONA: "You are a calm booking assistant."

FLOW:
  ask_details:
    REASONING: false
    GATHER:
      - booking_ref: required
        type: string
        prompt: "What is your booking reference?"
      - check_in: required
        type: date
        prompt: "What is your check-in date?"
    THEN: confirm

  confirm:
    REASONING: false
    RESPOND: "Booking {{booking_ref}} is confirmed for check-in on {{check_in}}."
      VOICE:
        SSML: |
          <speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">
            Booking <say-as interpret-as="characters">{{booking_ref}}</say-as> is confirmed
            for check-in on <say-as interpret-as="date" format="ymd">{{check_in}}</say-as>.
          </speak>
        PLAIN_TEXT: "Booking {{booking_ref}} is confirmed for check-in on {{check_in}}."
    THEN: COMPLETE

COMPLETE:
  - WHEN: booking_ref IS SET
    RESPOND: "Goodbye."
```

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`

```yaml theme={null}
AGENT: Delivery_Update

GOAL: "Confirm a delivery to the caller and read the tracking code back."

PERSONA: "You are a calm delivery assistant."

EXECUTION:
  voice:
    speed: 0.95

ON_START:
  RESPOND: "Hello. This is your delivery update."
    VOICE:
      SSML: |
        <speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">
          Hello. <break time="300ms"/> This is your delivery update.
        </speak>
      PLAIN_TEXT: "Hello. This is your delivery update."

FLOW:
  ask_details:
    REASONING: false
    GATHER:
      - tracking_code: required
        type: string
        prompt: "What is your tracking code?"
      - delivery_date: required
        type: date
        prompt: "What delivery date did you expect?"
    THEN: confirm

  confirm:
    REASONING: false
    RESPOND: "Tracking code {{tracking_code}}. Delivery date {{delivery_date}}."
      VOICE:
        SSML: |
          <speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">
            Tracking code <prosody rate="slow"><say-as interpret-as="characters">{{tracking_code}}</say-as></prosody>.
            <break time="400ms"/>
            Delivery date <say-as interpret-as="date" format="ymd">{{delivery_date}}</say-as>.
          </speak>
        PLAIN_TEXT: "Tracking code {{tracking_code}}. Delivery date {{delivery_date}}."
        SPEED: 0.9
    THEN: COMPLETE

COMPLETE:
  - WHEN: tracking_code IS SET
    RESPOND: "Thanks for calling. Goodbye."
```

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:

| Channel | Greeting | Confirmation |
| - | - | - |
| Microsoft Speech | SSML with a 300 ms pause. | SSML with a slow, spelled-out code. `SPEED` is ignored. |
| ElevenLabs | Plain text at speed 0.95. | Plain text at speed 0.9. |
| Other pipeline provider | Plain text. | Plain text. |

## 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.

```yaml theme={null}
EXECUTION:
  voice:
    provider: elevenlabs
    voice_id: your-voice-id
    speed: 1.1
    temperature: 0.4
```

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.

```yaml theme={null}
FLOW:
  read_code:
    REASONING: false
    RESPOND: "Your code is {{access_code}}."
      VOICE:
        PLAIN_TEXT: "Your code is {{access_code}}."
        VOICE_ID: your-slow-voice-id
        SPEED: 0.85
    THEN: COMPLETE
```

`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`

```yaml theme={null}
BEHAVIOR_PROFILE: voice_slow
PRIORITY: 100
WHEN: channel.name in ["voice", "voice_realtime", "voice_pipeline", "korevg"]

VOICE:
  provider: elevenlabs
  voice_id: your-voice-id
  speed: 0.95
```

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](https://koreai.mintlify.site/agent-platform/abl/how-to/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.

```yaml theme={null}
TEMPLATES:
  welcome:
    DEFAULT: "Welcome to Contoso Hotels."
    VOICE:
      SSML: |
        <speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">
          Welcome to <emphasis level="moderate">Contoso Hotels</emphasis>.
        </speak>
      PLAIN_TEXT: "Welcome to Contoso Hotels."

FLOW:
  greet:
    REASONING: false
    RESPOND: TEMPLATE(welcome)
    THEN: COMPLETE
```

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](https://koreai.mintlify.site/agent-platform/abl/how-to/configure-voice-speaking-style).

## 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

| Mistake | Why it happens | How to avoid it |
| - | - | - |
| No pauses on a Google or ElevenLabs channel. | Only Microsoft Speech plays SSML. | Write a good `plain_text`. Use `speed` where the provider supports it. |
| SSML is spoken as plain text on Microsoft Speech. | The value does not start with `<speak>`. | Start the value with `<speak>`. |
| A voice ID has no effect. | The provider is not part of the call. | Use a provider that the channel already uses. |
| `speed` has no effect. | The provider does not support it. | Check the support table. Use `<prosody>` on Microsoft Speech. |
| A reply starts late. | SSML and per-reply voice settings turn streaming off for that reply. | Use them only where the voice difference matters. |
| `instructions` does not change how a fixed reply sounds. | Pipeline text-to-speech does not read it. | Use SSML or `speed`. Put speaking style in agent or profile instructions. |

## Troubleshooting

| Symptom | Likely cause | What to check |
| - | - | - |
| The caller hears no `<break>` pause. | The provider is not Microsoft Speech, or `ssml` has no `<speak>` root. | The channel's provider. The first characters of the `ssml` value. |
| The voice does not change. | `unsupported_provider`. | The `voice_config_resolved` trace event. The channel's providers. |
| `speed` is ignored. | `unsupported_speed`. | The trace event. The provider list in the support table. |
| A reply is slow to start. | The reply is buffered. | Whether the reply sets `ssml`, `provider`, `voice_id`, `speed`, or `temperature`. |
| The caller hears the markup characters. | A provider read `ssml` as text. | Move the markup to `ssml`. Keep `plain_text` free of tags. |
| The call is rejected after you add `provider` at call level. | The provider may have no active credential in the project. | The project's voice settings for that provider. |

## Related HowTos

* [Write voice-friendly agent responses](https://koreai.mintlify.site/agent-platform/abl/how-to/write-voice-friendly-responses)
* [Configure speaking style, tone, and pace](https://koreai.mintlify.site/agent-platform/abl/how-to/configure-voice-speaking-style)
* [Read back numbers, codes, and critical details](https://koreai.mintlify.site/agent-platform/abl/how-to/read-back-critical-details)
* [Design low-latency voice flows](https://koreai.mintlify.site/agent-platform/abl/how-to/design-low-latency-voice-flows)
* [Use behavior profiles by context](https://koreai.mintlify.site/agent-platform/abl/how-to/use-behavior-profiles-by-context)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.