AgentsAgentBase

add_language

View as MarkdownOpen in Claude

Add a language configuration with voice settings. The agent uses these configurations to support multilingual conversations with appropriate TTS voices.

Language configurations map to the SWML ai.languages array. See the SWML languages reference for the full specification.

The voice parameter supports three formats: a simple voice name, an explicit engine/model via separate parameters, or a combined "engine.voice:model" string.

Parameters

name
strRequired

Human-readable language name (e.g., "English", "French", "Spanish").

code
strRequired

Language code (e.g., "en-US", "fr-FR", "es-MX").

voice
strRequired

TTS voice identifier. Accepts one of three formats:

  • Simple name: "en-US-Neural2-F"
  • Combined format: "elevenlabs.josh:eleven_turbo_v2_5"
  • Short name with explicit engine/model: "josh"
speech_fillers
Optional[list[str]]

Filler phrases used during natural speech pauses (e.g., ["Um...", "Let me see..."]).

function_fillers
Optional[list[str]]

Filler phrases spoken while executing SWAIG functions (e.g., ["One moment please...", "Looking that up..."]).

engine
Optional[str]

Explicit TTS engine name (e.g., "elevenlabs", "rime"). Overrides the combined string format if provided.

model
Optional[str]

Explicit TTS model name (e.g., "eleven_turbo_v2_5", "arcana"). Overrides the combined string format if provided.

Returns

AgentBase — Returns self for method chaining.

Examples

Simple voice

1from signalwire import AgentBase
2
3agent = AgentBase(name="support", route="/support")
4agent.set_prompt_text("You are a helpful assistant.")
5agent.add_language("English", "en-US", "rime.spore")
6agent.serve()

Explicit engine and model

1from signalwire import AgentBase
2
3agent = AgentBase(name="support", route="/support")
4agent.set_prompt_text("You are a helpful assistant.")
5agent.add_language(
6 "English", "en-US", "josh",
7 engine="elevenlabs",
8 model="eleven_turbo_v2_5"
9)
10agent.serve()

With fillers

1from signalwire import AgentBase
2
3agent = AgentBase(name="support", route="/support")
4agent.set_prompt_text("You are a helpful assistant.")
5agent.add_language(
6 "English", "en-US", "rime.spore",
7 speech_fillers=["Um...", "Let me think..."],
8 function_fillers=["One moment please...", "Looking that up..."]
9)
10agent.serve()