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

> ## Agent Instructions
> For AgentScope Python, use https://docs.agentscope.io/stable/en/index for new projects. For existing projects, check the installed agentscope version and use matching versioned documentation.
> The /latest/ alias points to development documentation. Use it only with the matching development source. Do not mix AgentScope 1.x and 2.x APIs.
> State the AgentScope version when providing installation commands or code examples. ReMe uses its own continuously updated /reme/latest/ documentation.

# 概述

> 让智能体用语音与用户对话，并在对话中调用工具完成任务

<Warning>
  实时语音智能体目前为实验性功能，接口在后续版本中可能调整。
</Warning>

实时语音智能体（`RealtimeAgent`）以语音作为输入与输出：它持续听取用户说话，用语音作出回应，并在对话过程中调用工具完成任务，而不是等一条完整的文字消息到达后再回复。

根据技术实现方式，可以分为以下两种：

| 实现                      | 工作方式                                           |
| ----------------------- | ---------------------------------------------- |
| 语音到语音（Speech-to-Speech） | 音频直接进出一个端到端（End-to-End）的语音模型，识别、理解与合成全部在模型内部完成 |
| 级联（ASR + LLM + TTS）     | 语音识别把用户语音转成文字交给 `Agent`，回复再由语音合成播放             |

AgentScope 目前已支持语音到语音方案，级联技术方案即将上线。这两套方案共享以下的能力：

| 能力     | 说明                                                           |
| ------ | ------------------------------------------------------------ |
| 回合检测   | 通过语音活动检测（VAD）判断用户何时开口、何时说完，以此划分对话回合；可以由模型 API 完成，也可以传入本地 VAD |
| 打断     | 用户开口即停止当前回复，上下文中只保留用户实际听到的部分；也可以由代码主动打断                      |
| 工具调用   | 支持 `Toolkit` 与权限系统，在语音对话中执行工具                                |
| 人机交互   | 支持在语音对话中向用户请求确认工具调用，等待期间语音流不中断                               |
| 断线自动恢复 | 模型 API 关闭会话后，用户下一句话自动重连，对话历史保留在智能体状态中                        |

各方案的使用方式参见对应页面：

<CardGroup cols={2}>
  <Card title="语音到语音" icon="waveform-lines" href="/versions/2.0.8/zh/building-blocks/realtime/speech-to-speech" cta="了解更多" arrow>
    通过端到端的语音模型实现实时语音对话，支持打断、工具调用与断线自动恢复。
  </Card>
</CardGroup>
