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

# Speech model reference

> Configure built-in speech-to-speech models for Mantle voice channels.

Speech models receive audio from a voice channel and return spoken audio. The
model handles the live conversation; Mantle runs your skills, tools, and
constraints when asked, then returns results for the model to say. See
[Speech models](https://rasa.com/docs/mantle/voice/speech-models.md) for how the two parts work together.

> [!WARNING]
>
> Speech models are a beta feature. Their behavior and configuration may change
> in future releases. They are not intended for production or for processing
> sensitive or personal data.

## Where to configure it

Set a shared default in `agent.yml`, or override it for one channel in
`integrations.yml`:

> [tab] Shared default
>
> ```yaml agent.yml theme={null}
> voice:
>   speech_model:
>     name: polyai_dialog_rsn_1
>     instructions: |
>       Handle the live conversation. Delegate requests that need agent
>       capabilities to the Mantle agent.
> ```

> [tab] One channel
>
> ```yaml integrations.yml theme={null}
> channels:
>   json_audio:
>     enabled: true
>     server_url: localhost:5005
>     speech_model:
>       name: polyai_dialog_rsn_1
>       instructions: |
>         Handle the live conversation. Delegate requests that need agent
>         capabilities to the Mantle agent.
> ```

The `name` selects the provider. `instructions` is required and must not be
empty. Keep provider API keys in environment variables; the built-in providers
read their own key and do not accept a key in this configuration. The selected
provider's settings are validated when its speech model is initialized.

The `instructions` in the examples are written by you; they are not Rasa's
default prompt. Rasa appends framework instructions that tell the model how to
ask Mantle to do agent work. The appended prompts and tools differ for
OpenAI GPT-Live and the other built-in providers.

## Prompts and Mantle tools

OpenAI Realtime, PolyAI Dialog-RSN-1, and Rime Prism use the same appended
delegation instructions:

> [accordion] Built-in instructions for Realtime, PolyAI, and Rime
>
> ```text theme={null}
> When you call delegate_to_background, write `message` in first person as if the
> caller were speaking directly to the background agent. Preserve explicit
> confirmations, denials, corrections, identifiers, and requested actions. Never
> replace them with a third-person summary such as "the user wants ...". If the
> background agent asked a question, send the caller's answer to that question,
> not a summary of the overall goal. Once the background agent responds to a
> delegated request, it owns that task until its result says the task is complete.
> Relay its questions to the caller and always call delegate_to_background with
> the caller's next answer before asking another task-specific question. Do not
> collect task fields or advance the workflow yourself. Background-agent results
> contain `messages` in their original order. Treat them as authoritative and
> communicate them naturally without claiming an action succeeded unless the
> result says it did.
> ```

> [accordion] Built-in instructions for OpenAI GPT-Live
>
> ```text theme={null}
> Delegation policy:
> Backend tools:
> - Rasa agent: use the agent capabilities described in the preceding instructions.
>
> Generate <|SpawnThinking|> when:
> - The request needs an agent capability or careful reasoning.
> - A correction, confirmation, or new detail changes work already requested.
>
> Do not generate <|SpawnThinking|> when:
> - You can answer from the live conversation or a still-current agent result.
> - You need a brief clarification before the agent can act.
>
> Generate <|SpawnThinking|> before giving an answer that depends on agent work.
> Do not guess the result while waiting.
> ```

The first three providers receive a `delegate_to_background` function tool with
a required `message` string. The model writes the caller's request in first
person; Rasa sends it to Mantle and returns Mantle's ordered `messages` for the
model to say. PolyAI also requires an `utterance` string: a brief spoken
acknowledgement while Mantle works. The adapter marks it as `poly_spoken` so
PolyAI speaks it during the background request.

OpenAI GPT-Live uses client delegation instead of a function tool. The model
signals the handoff with `<|SpawnThinking|>`; Rasa builds the request from the
recent transcript and sends Mantle's result back as commentary.

A channel-level `speech_model` overrides the shared `voice.speech_model` for
that channel. Configure either a speech model or cascaded `asr` / `tts` on a
channel. If a channel sets `asr` or `tts`, it uses cascaded speech instead of
the shared speech model. Those sides resolve from the channel, then
`voice.asr` / `voice.tts`, then the channel's built-in default when available.

When a channel leaves media settings unset, `voice.speech_model` takes
precedence over `voice.asr` and `voice.tts`. See
[`integrations.yml` voice channels](https://rasa.com/docs/mantle/reference/integrations-yml#voice-channels)
and [`agent.yml` voice settings](https://rasa.com/docs/mantle/reference/agent-yml#speech_model).

## Built-in providers

Every provider requires non-empty `instructions`. Other supported fields are
provider-specific.

| Provider | `name` | API key environment variable |
| - | - | - |
| OpenAI Realtime | `openai_realtime` | `OPENAI_API_KEY` |
| OpenAI GPT-Live | `openai_live` | `OPENAI_API_KEY` |
| PolyAI Dialog-RSN-1 | `polyai_dialog_rsn_1` | `POLY_API_KEY` |
| Rime Prism | `rime_prism` | `RIME_API_KEY` |

Provider configs reject unknown fields. The tables below list the supported
fields and defaults for each provider. `instructions` is required and must
contain text.

### OpenAI Realtime

| Field | Default or allowed values |
| - | - |
| `model` | `gpt-realtime` |
| `voice` | `marin` |
| `turn_detection` | `semantic_vad` (default) or `server_vad` |
| `max_output_tokens` | `4096` |

```yaml theme={null}
speech_model:
  name: openai_realtime
  instructions: |
    Handle the live conversation. Delegate requests that need agent
    capabilities to the Mantle agent.
  model: gpt-realtime
  voice: marin
  turn_detection: semantic_vad
  max_output_tokens: 4096
```

`turn_detection` accepts `semantic_vad` or `server_vad`.

### OpenAI GPT-Live

| Field | Default or allowed values |
| - | - |
| `model` | `gpt-live-1` only |
| `voice` | `marin` |

```yaml theme={null}
speech_model:
  name: openai_live
  instructions: |
    Handle the live conversation. Delegate requests that need agent
    capabilities to the Mantle agent.
  model: gpt-live-1
  voice: marin
```

### PolyAI Dialog-RSN-1

| Field | Default or allowed values |
| - | - |
| `model` | `dialog-rsn-1` |
| `voice` | Optional; provider default when omitted |
| `websocket_base_url` | `wss://api.studio.poly.ai/v1` |
| `max_output_tokens` | `4096` |

```yaml theme={null}
speech_model:
  name: polyai_dialog_rsn_1
  instructions: |
    Handle the live conversation. Delegate requests that need agent
    capabilities to the Mantle agent.
  model: dialog-rsn-1
```

The `voice` field is optional. If you override `websocket_base_url`, it must be
a secure WebSocket URL whose hostname ends in `.poly.ai` and whose path ends
in `/v1`.

### Rime Prism

| Field | Default or allowed values |
| - | - |
| `voice` | `aurora` |

```yaml theme={null}
speech_model:
  name: rime_prism
  instructions: |
    Handle the live conversation. Delegate requests that need agent
    capabilities to the Mantle agent.
  voice: aurora
```

## Credentials and audio formats

Set the provider's API key in the environment of the process running Rasa.
For example, set `POLY_API_KEY` before starting the server when using PolyAI.
Do not put API keys directly in `agent.yml` or `integrations.yml`.

Built-in speech models support μ-law audio at 8 kHz or mono 16-bit linear PCM.
The provider adapter converts channel audio to the format required by its
service when needed. A channel with an unsupported audio format fails when the
speech model is initialized.

## Limitations

* The speech model is used only on voice channels configured for speech-model
  mode. Text messages continue to use the Mantle orchestrator.
* Mantle remains responsible for skills, tools, constraints, and agent results.
  The speech model delegates work to Mantle; it does not receive the agent's
  tools directly.
* The Inspector in Rasa Studio uses Studio's Deepgram voice gateway. Set
  channel-level ASR and TTS on `inspector` if you want Studio's gateway there
  while other voice channels use a speech model.

## Troubleshooting

| Symptom | Check |
| - | - |
| Speech model name is rejected | Use one of the `name` values in the provider table. |
| The model cannot connect | Check that the provider API key is set in the Rasa process environment. |
| Configuration fails with an unknown field | Check the provider's supported fields. Provider configs reject unknown keys. |
| A channel still reports missing ASR or TTS | Confirm `speech_model` is on that channel or set `voice.speech_model` in `agent.yml`. Check that the channel has not selected cascaded `asr` / `tts` mode. |
| Audio setup fails | Confirm the channel uses μ-law 8 kHz or mono 16-bit linear PCM. |

See [Test and monitor voice](https://rasa.com/docs/mantle/voice/testing.md) for inspecting a call and
[Speech providers](https://rasa.com/docs/mantle/reference/speech-providers.md) for cascaded ASR and TTS.


## Related topics

- [Speech models](https://rasa.com/docs/mantle/voice/speech-models.md)
- [Speech providers](https://rasa.com/docs/mantle/reference/speech-providers.md)
- [agent.yml](https://rasa.com/docs/mantle/reference/agent-yml.md)
- [integrations.yml](https://rasa.com/docs/mantle/reference/integrations-yml.md)
- [Voice agents](https://rasa.com/docs/mantle/voice/overview.md)


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