> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# set_agent_voice

> Set the AI verb's own voice, used by any language that has no voice of its own.

[ref-agentbase]: /docs/server-sdks/reference/python/agents/agent-base

[add-language]: /docs/server-sdks/reference/python/agents/agent-base/add-language

[set-fallback-voice]: /docs/server-sdks/reference/python/agents/agent-base/set-fallback-voice

[set-default-voice]: /docs/server-sdks/reference/python/agents/agent-base/set-default-voice

[swml-ai]: /docs/swml/reference/calling/ai

Set the agent's own voice, sent as the `voice` key of the SWML [`ai`][swml-ai] verb. A
language added with [`add_language()`][add-language] that has no voice of its own uses
this one.

The platform tries an agent's voices in this order: the language's own voice or voice
list, this voice for a language with none, the
[`set_fallback_voice()`][set-fallback-voice] list, and the platform's own last resort.

## Parameters

**`voice`** `str | Sequence[str] | None` — required

One voice as `engine.voice:model`, or a list of up to 8. In a list, the first voice
speaks and the rest are tried in order when it fails. A one-item list stays a list.
`None` clears the setting.

---

## Returns

[`AgentBase`][ref-agentbase] -- Returns self for method chaining.

## Raises

`ValueError` for an empty voice, an empty list, a list of more than 8 voices, or a list
entry that isn't a non-empty string.

## Example

```python {5}
from signalwire import AgentBase

agent = AgentBase(name="sales", route="/sales")
agent.prompt_add_section("Role", "You answer sales calls.")
agent.set_agent_voice(["rime.spore:arcana", "elevenlabs.josh"])
agent.serve()
```

The `ai` verb renders with the voice list:

```json
{"ai": {"prompt": {"...": "..."}, "params": {}, "voice": ["rime.spore:arcana", "elevenlabs.josh"]}}
```

To set a voice for every voice field the agent leaves empty, including multilingual
languages, use [`set_default_voice()`][set-default-voice].