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

# set_language_mode()

> Let the agent understand and respond in additional languages

Configures the voice agent to understand and respond in additional languages beyond English. The agent starts in the primary language and switches to a secondary language when the caller requests it or speaks in that language.

<Tabs>
  <Tab title="Python">
    ```python signature theme={null}
    call.set_language_mode(
        primary: Language = "english",
        secondary: list[Language] | None = None,
    )
    ```

    | Parameter | Type | Default | Description |
    | - | - | - | - |
    | `primary` | `Language` | `"english"` | The language the agent starts the conversation in. |
    | `secondary` | `list[Language] \| None` | `None` | Additional languages the agent can switch to when the caller requests them. |

    The `Language` type is defined as:

    ```python theme={null}
    Literal["english", "spanish", "french", "german", "italian"]
    ```

    **Return value:** `None`
  </Tab>

  <Tab title="TypeScript">
    ```typescript signature theme={null}
    await call.setLanguageMode({
      primary?: Language,   // default: "english"
      secondary?: Language[],
    })
    ```

    | Parameter | Type | Default | Description |
    | - | - | - | - |
    | `primary` | `Language` | `"english"` | The language the agent starts the conversation in. |
    | `secondary` | `Language[]` | `[]` | Additional languages the agent can switch to when the caller requests them. |

    The `Language` type is defined as:

    ```typescript theme={null}
    type Language = "english" | "spanish" | "french" | "german" | "italian";
    ```

    **Return value:** `Promise<void>`
  </Tab>
</Tabs>

## Example: single secondary language

<Tabs>
  <Tab title="Python">
    ```python example.py theme={null}
    @agent.on_call_start
    def on_call_start(call: guava.Call):
        call.set_persona(organization_name="Harper Valley Property Insurance")
        call.set_language_mode(primary="english", secondary=["spanish"])
        call.set_task(
            task_id="intro",
            objective="Answer questions regarding property insurance policy.",
        )
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript example.ts theme={null}
    agent.onCallStart(async (call: guava.Call) => {
      await call.setPersona({ organizationName: "Harper Valley Property Insurance" });
      await call.setLanguageMode({ primary: "english", secondary: ["spanish"] });
      await call.setTask({
        taskId: "intro",
        objective: "Answer questions regarding property insurance policy.",
      });
    });
    ```
  </Tab>
</Tabs>

## Example: multiple secondary languages

<Tabs>
  <Tab title="Python">
    ```python example.py theme={null}
    call.set_language_mode(
        primary="english",
        secondary=["spanish", "french", "german"],
    )
    ```
  </Tab>

  <Tab title="TypeScript">
    ```typescript example.ts theme={null}
    await call.setLanguageMode({
      primary: "english",
      secondary: ["spanish", "french", "german"],
    });
    ```
  </Tab>
</Tabs>

## Transcript behavior

* There is no auto-translation on the transcript. Each turn appears in the language it was spoken in — if the caller speaks Spanish, that turn is in Spanish; if they speak English, that turn is in English.
* There is currently no per-turn language marker in the transcript.

## Edge cases

* If `secondary` is empty or not provided, the agent operates in `primary` only (the current default behavior).
* When a non-English language is detected during a call, the system automatically switches to a language-specific TTS voice.
* The `grace` voice has clones for Spanish, French, German, and Italian. If no dedicated clone exists for a voice + language combination, the base voice is used.

<Warning>
  **Compliance:** English and Spanish are currently supported for HITRUST / PCI-compliant deployments. All languages other than English and Spanish are not. Support for other languages is planned.
</Warning>


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