Design voice-agent TTS fallback for timeouts, quota, invalid voices and outages while preserving role, language, pace and transcript context.
A voice-agent TTS fallback keeps a call audible when the primary speech provider fails. The fallback must handle provider errors without creating a second failure: set one bounded retry, preserve the intended role and language, and transfer or play a prepared recovery message when no voice path is healthy.
Fish Audio can be the primary speech engine, with another supported provider or a pre-recorded recovery path as backup. LiveKit, Vapi, Retell and a custom Agora or Twilio bridge expose different fallback controls, so the policy belongs in the agent platform or your own media layer.
Speech is a real-time dependency. A late response is heard immediately, and a missing response can leave the caller in silence with no visual error or retry button.
The main failure classes are provider timeout, rate limit, expired credential, exhausted credits, invalid voice ID, malformed text, unsupported language, failed audio conversion and a provider outage. A fallback policy should distinguish temporary faults from requests that will fail again unchanged.
| Failure | Retry primary? | Fallback? | Action |
|---|---|---|---|
| Network timeout / no first audio | Once within budget | Yes | Cancel request and use backup voice |
| 429 rate limit | After delay when turn can wait | Yes | Respect retry window and reduce concurrency |
| Invalid voice or language | No | Yes | Use an approved compatible voice |
| Authentication / quota | No | Yes | Alert operations and use backup |
| Malformed audio | No | Yes | Reject bytes and keep transcript accurate |
| Provider 5xx | Bounded retry | Yes | Circuit-break after repeated failures |
Preserve the agent's role before preserving the exact voice. A calm support agent should sound like a calm support agent, in the same language and roughly the same pace.
Record these attributes with each agent version:
A different voice is noticeable, but switching language, urgency or persona makes the agent sound broken. If the identity itself is contractual, a human transfer may be safer than an unrelated fallback voice.
Put fallback in the layer that can cancel audio and update the conversation state. For LiveKit and Pipecat, that is the agent pipeline. For Vapi or Retell, it is the platform's voice or provider fallback configuration. For Agora, it is the custom TTS adapter plus the agent configuration.
Do not hide failover inside a speech proxy that keeps returning HTTP 200 to the orchestrator. The agent must know whether it is on primary, fallback or recovery so it can update metrics and decide whether to transfer.
Use request IDs that connect the primary and fallback attempts. Log provider, voice, failure class, time to failure, retry count and whether audio reached the caller.
Set the TTS timeout below the caller's patience limit and inside the turn's total latency budget. If the agent has already spent time on retrieval, the TTS timeout should be shorter than on a short greeting.
Open a circuit breaker after repeated provider failures. Stop sending new turns to a provider that is clearly unavailable, and probe recovery on a controlled interval rather than sacrificing every caller.
Use one fallback attempt per turn by default. A chain of three providers can produce seconds of silence while each timeout expires. The final recovery path should be immediate: a prepared audio message, a text-only channel or a human transfer.
The assistant context should reflect what the caller heard. If primary audio was cancelled before playback and the fallback spoke the reply, record the fallback turn. If no speech reached the caller, do not add a completed assistant message.
This is especially important after barge-in. A caller who interrupts should not have the next model turn influenced by the discarded tail of the previous answer.
LiveKit, Pipecat and other pipelines expose speech boundary events; preserve those in your logs. The Pipecat text to speech guide and LiveKit text to speech guide cover interruption and provider configuration.
Use fault injection rather than waiting for a real outage. Force a timeout before first audio, a 429 response, an invalid voice, an authentication error, a malformed PCM frame and a mid-stream disconnect.
For each case, record:
Run the tests at normal and peak concurrency. A fallback that works with one call can breach the latency budget when every session fails over at once.
Create a voice matrix per agent and language. Include one primary Fish Audio voice, one compatible fallback and a scripted recovery message.
If a fallback voice uses the same persona but not the same clone, review a full paragraph rather than one sentence. Pace and pronunciation differences accumulate over a long answer.
Keep the fallback voice rights and consent record beside the primary voice. A cloned voice requires documented permission, and switching to a library voice may change the commercial or identity requirements.
The primary provider may charge for a generation that never reached the caller. Add retry and failover overhead to the budget rather than assuming only audible speech is billed.
Fish Audio usage follows generated characters, and API access is included in the Studio pack. Fallback-platform and telephony fees remain separate. The TTS API pricing guide converts character volume into a planning estimate.
Alert when fallback rate rises because the additional provider can change both cost and voice behaviour.
Monitor primary success rate, fallback rate, time to first audio, timeout class, retry rate, circuit-breaker state and calls ending without audio. Segment by provider, region, language and agent version.
Review a sample of failed calls for transcript correctness and human-transfer quality. Uptime alone is insufficient if fallback speech is distorted or the agent loses context after failover.
The TTS API for voice agents guide covers provider selection, while the telephony TTS API guide covers PCM and transport failure modes.
A primary TTS provider can time out, rate-limit, reject a voice, exhaust credits or return malformed audio. A fallback keeps the conversation audible or transfers the caller cleanly.
No. Match the fallback to the agent role by language, gender presentation, pace and formality. If no suitable voice exists, use a short handoff message or human transfer.
Use explicit classes for timeout or missing first audio, rate limits, authentication, quota, invalid voice, malformed audio and provider 5xx responses. Do not retry validation errors without changing the request.
Set one fallback attempt per turn, a hard latency budget and a circuit breaker. If the fallback also fails, transfer or play a pre-recorded recovery message.
The conversation history should contain the text actually spoken by the fallback. If the primary output was cancelled or never heard, do not mark it as delivered.