Supafone Labs ยท Documentation

Live Language and Voice Routing#

Agent Factory can keep one call active while a caller moves between two to four approved languages. Each language can use its own compatible voice. The feature is opt-in and disabled for every existing agent unless languageVoiceRouting is explicitly true.

What changes and what stays the same#

ConfigurationRuntime behavior
Routing field omitted or falseHistorical fixed-language and fixed-voice behavior
languageVoiceRouting: trueEnglish and Spanish profiles are selected automatically
Routing plus routingLanguagesTwo to four ordered languages; the first owns the greeting
Routing plus languageProfilesThe same routing behavior with developer-selected live-catalog voices

When a switch is accepted, the active language and matching voice change on the same call. The agent keeps its current stage, prompt, tools, captured facts, campaign context, and prior tool results. The caller does not restart intake or repeat information.

This is language routing, not accent classification. A name, nationality, accent, background speaker, or isolated borrowed word is not enough to change the active language.

Greeting behavior#

The first configured language is the primary language:

Translation preserves template tokens, business names, phone numbers, and URLs. Agent creation returns a clear error rather than silently saving an English greeting for a non-English primary language when translation is unavailable. Switching later in the call does not replay the greeting.

Outbound calls still follow outbound etiquette: the recipient answers first, the primary language and voice are active, and the reviewed campaign or outbound introduction remains authoritative. Automatic greeting translation does not overwrite campaign-specific opening copy, and an inbound greeting is never played into a ringing line. Localize custom outbound opening copy in the campaign or outbound-agent configuration.

TypeScript#

Use the automatic voice-selection path first:

ts
const agent = await supafone.labs.agents.createInbound({
  agentKey: "puerto-rico-intake",
  name: "Puerto Rico intake",
  businessName: "Northline Health",
  greeting: "Thank you for calling Northline Health. How can I help?",
  languageVoiceRouting: true,
  routingLanguages: ["es-PR", "en-US", "vi-VN"],
});

console.log(agent.language_voice_routing?.profiles);
console.log(agent.language_voice_routing?.greeting_translation);

The response shows the resolved public profile for every language. Voice selection comes from the account's current configured catalog.

For explicit control, select catalog voices and pass them as profiles:

ts
const agent = await supafone.labs.agents.createInbound({
  agentKey: "curated-intake",
  name: "Curated intake",
  languageVoiceRouting: true,
  languageProfiles: [
    {
      language: "en-US",
      voice: {
        provider: "cartesia",
        voiceId: "<current-catalog-voice-id>",
        model: "sonic-3.5",
      },
    },
    {
      language: "es-MX",
      voice: {
        provider: "cartesia",
        voiceId: "<current-catalog-voice-id>",
        model: "sonic-3.5",
      },
    },
  ],
});

Python#

python
agent = supafone.labs.agents.create_inbound({
    "agentKey": "puerto-rico-intake",
    "name": "Puerto Rico intake",
    "businessName": "Northline Health",
    "greeting": "Thank you for calling Northline Health. How can I help?",
    "languageVoiceRouting": True,
    "routingLanguages": ["es-PR", "en-US", "vi-VN"],
})

print(agent["language_voice_routing"]["profiles"])

Python accepts camelCase for copy-and-paste parity and snake_case for native Python style.

REST#

bash
curl https://api.supafone.ai/api/v1/labs/agents \
  -X POST \
  -H "Authorization: Bearer $SUPAFONE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Puerto Rico intake",
    "business_name": "Northline Health",
    "greeting": "Thank you for calling Northline Health. How can I help?",
    "language_voice_routing": true,
    "routing_languages": ["es-PR", "en-US"]
  }'

MCP#

The four hosted creation tools accept the same public fields:

Example request to an MCP client:

Create an inbound agent with live language and voice routing. Start in Puerto

Rican Spanish, also support English and Vietnamese, and choose compatible

configured voices automatically.

The MCP server submits only the public preferences. It does not contain the hosted detection or call-transition implementation.

PSTN, campaigns, and WebRTC#

One Agent Factory configuration is reused across the managed call paths:

Call pathSupported behavior
Inbound PSTNPrimary translated greeting, then same-call routing
Outbound PSTNRecipient speaks first; primary language/voice plus the reviewed outbound introduction, then same-call routing
Outbound campaignCampaign stage, recipient context, and tools survive a route
Browser WebRTCSame primary greeting and routing contract without Twilio

The current hosted routing adapter is managed Ultravox. The provider-neutral Voice Watcher framework supports other voice stacks, but this Agent Factory provisioning flag does not claim live voice-switch control for arbitrary BYOK agent runtimes.

Voice selection rules#

Automatic selection prefers a voice native to the requested language and then falls back to a voice whose configured model supports that language in the managed runtime. Every profile must resolve to a distinct, connected, runtime-compatible voice.

Use the Dynamic Voice Catalog to inspect language compatibility. Agent creation returns 422 for unsupported languages, stale voice IDs, disconnected providers, incompatible voices, or a duplicate voice assigned to multiple profiles.

Compatibility and safety#

Troubleshooting#

ResponseMeaningAction
422 unsupported languageThe locale is outside the managed runtime intersectionQuery voice capabilities and choose a supported language
422 voice not in catalogThe ID is stale or belongs to an unconnected providerRefresh GET /voices and select a current configured voice
422 incompatible or duplicate voiceThe profile cannot run that language or reuses another profile's voiceChoose a distinct compatible voice
503 routing disabledThe hosted safety switch is offKeep fixed-language mode or retry after service restoration
503 greeting translation unavailableA non-English primary greeting could not be safely translatedRetry provisioning; Supafone does not save the mismatched greeting

Next: Agent Factory, Hosted Agents API, Browser WebRTC Calls, and Outbound Call Campaigns.

View raw Markdown