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

# Realtime vs. streaming

> Two dialogue modes - speech-to-speech, or STT → agent → TTS - and when to use each.

The plugin runs in one of two dialogue modes. They use the same media bridge and the same features;
they differ only in how speech becomes a reply.

<CardGroup cols={2}>
  <Card title="Realtime" icon="bolt">
    **Speech-to-speech** via a realtime model (OpenAI / Azure OpenAI). Lowest latency, natural barge-in,
    most expressive. Needs a realtime provider key.
  </Card>

  <Card title="Streaming" icon="layer-group">
    **STT → your agent → TTS.** Uses your host's existing speech stack and full agent toolchain.
    Needs `ffmpeg` on `PATH`. No realtime key required.
  </Card>
</CardGroup>

## How each mode flows

Both modes share the same inbound/outbound media path through StandIn; they differ only in the middle -
how speech becomes a reply.

```mermaid theme={null}
flowchart LR
    IN["Caller audio<br/>(via StandIn)"] --> P["Plugin"]

    subgraph RT["Realtime"]
      RM["Realtime model<br/>speech-to-speech"]
    end
    subgraph ST["Streaming"]
      direction LR
      STT["STT"] --> AG["Your agent"] --> TTS["TTS"]
    end

    P -->|realtime| RM
    P -->|streaming| STT
    RM -.->|"delegate real work"| AG
    RM --> OUT["Reply audio<br/>(via StandIn)"]
    TTS --> OUT

    style IN fill:#1e293b,stroke:#475569,color:#e2e8f0
    style OUT fill:#1e293b,stroke:#475569,color:#e2e8f0
    style P fill:#166534,stroke:#22c55e,color:#dcfce7
    style RM fill:#0e7490,stroke:#06b6d4,color:#cffafe
    style STT fill:#c2410c,stroke:#fb923c,color:#fed7aa
    style TTS fill:#c2410c,stroke:#fb923c,color:#fed7aa
    style AG fill:#3730a3,stroke:#6366f1,color:#e0e7ff
```

## Choosing

| If you want…                                          | Use           |
| ----------------------------------------------------- | ------------- |
| The lowest latency and most natural turn-taking       | **Realtime**  |
| Speech-to-speech expressivity (tone, emotion)         | **Realtime**  |
| To reuse your agent's full tool/RAG pipeline per turn | **Streaming** |
| To avoid a realtime provider subscription             | **Streaming** |
| Tight control over the STT and TTS vendors            | **Streaming** |

Both modes support **barge-in** (the caller can interrupt), the **vision ring**, **group-call gating**,
**DTMF**, **multilingual replies**, and the avatar **driver cues**. The `languages` setting
(e.g. EN/AR/FR/DE; auto-detect when unset) applies to **realtime** mode; streaming mode is
multilingual through the host's own model/STT/TTS configuration instead.

## Switching

<Tabs>
  <Tab title="OpenClaw">
    Set `mode` in the plugin config:

    ```jsonc theme={null}
    { "mode": "realtime" }   // or "streaming"
    ```
  </Tab>

  <Tab title="Hermes">
    Pick the handler at launch (use `--handler streaming` for streaming mode):

    ```bash theme={null}
    hermes teams-call serve --handler realtime
    ```
  </Tab>
</Tabs>

<Note>
  **Streaming** shells out to **`ffmpeg`** for resampling - make sure it's installed and on `PATH`.
</Note>
