Skip to content

Commit 6c20f07

Browse files
docs(agentkit): update v1.5.0 guides, reference, and changelog
Documents MLLM sessions without TTS, avatar cascading constraints, GenericAvatar session enrichment, turn pagination, and v2.7 error handling. Updates README examples and adds the errors reference page.
1 parent 64703bd commit 6c20f07

10 files changed

Lines changed: 277 additions & 97 deletions

File tree

README.md

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ from agora_agent.agentkit import (
5353
Agent,
5454
DataChannel,
5555
DeepgramSTT,
56+
GenericAvatar,
5657
MiniMaxTTS,
5758
OpenAI,
59+
XaiGrok,
5860
expires_in_hours,
5961
)
6062

@@ -190,7 +192,7 @@ If you want to bring your own vendor credentials instead of using Agora-managed
190192

191193
## MLLM (Realtime / Multimodal)
192194

193-
Use `with_mllm()` for OpenAI Realtime or Gemini Live. No STT, LLM, or TTS vendor is needed when MLLM mode is enabled.
195+
Use `with_mllm()` for OpenAI Realtime, Gemini Live, Vertex AI, or xAI Grok. No STT, LLM, or TTS vendor is needed when MLLM mode is enabled.
194196

195197
```python
196198
from agora_agent.agentkit import Agent, OpenAIRealtime
@@ -216,18 +218,14 @@ A full reference for this library is available [here](https://github.com/AgoraIO
216218

217219
## MLLM Flow (Multimodal)
218220

219-
For real-time audio processing using OpenAI's Realtime API or Google Gemini Live, use the MLLM (Multimodal Large Language Model) flow instead of the cascading ASR -> LLM -> TTS flow. See the [MLLM Overview](https://docs.agora.io/en/conversational-ai/models/mllm/overview) for more details.
221+
For real-time audio processing using OpenAI Realtime, Gemini Live, Vertex AI, or xAI Grok, use the MLLM (Multimodal Large Language Model) flow instead of the cascading ASR -> LLM -> TTS flow. MLLM mode does not require separate TTS, STT, or LLM vendors. See the [MLLM Overview](https://docs.agora.io/en/conversational-ai/models/mllm/overview) for more details.
220222

221223
```python
222-
from agora-agent-server-sdk import Agora
223-
from agora-agent-server-sdk.agents import (
224+
from agora_agent import Agora
225+
from agora_agent.agents import (
224226
StartAgentsRequestProperties,
225-
StartAgentsRequestPropertiesAdvancedFeatures,
226227
StartAgentsRequestPropertiesMllm,
227228
StartAgentsRequestPropertiesMllmVendor,
228-
StartAgentsRequestPropertiesTts,
229-
StartAgentsRequestPropertiesTtsVendor,
230-
StartAgentsRequestPropertiesLlm,
231229
StartAgentsRequestPropertiesTurnDetection,
232230
StartAgentsRequestPropertiesTurnDetectionType,
233231
)
@@ -246,10 +244,8 @@ client.agents.start(
246244
agent_rtc_uid="1001",
247245
remote_rtc_uids=["1002"],
248246
idle_timeout=120,
249-
advanced_features=StartAgentsRequestPropertiesAdvancedFeatures(
250-
enable_mllm=True,
251-
),
252247
mllm=StartAgentsRequestPropertiesMllm(
248+
enable=True,
253249
url="wss://api.openai.com/v1/realtime",
254250
api_key="<your_openai_api_key>",
255251
vendor=StartAgentsRequestPropertiesMllmVendor.OPENAI,
@@ -266,33 +262,21 @@ client.agents.start(
266262
threshold=0.5,
267263
silence_duration_ms=500,
268264
),
269-
# TTS and LLM are still required but not used when MLLM is enabled
270-
tts=StartAgentsRequestPropertiesTts(
271-
vendor=StartAgentsRequestPropertiesTtsVendor.MICROSOFT,
272-
params={},
273-
),
274-
llm=StartAgentsRequestPropertiesLlm(
275-
url="https://api.openai.com/v1/chat/completions",
276-
),
277265
),
278266
)
279267
```
280268

281269

282270
## MLLM Flow (Multimodal)
283271

284-
For real-time audio processing using OpenAI's Realtime API or Google Gemini Live, use the MLLM (Multimodal Large Language Model) flow instead of the cascading ASR -> LLM -> TTS flow. See the [MLLM Overview](https://docs.agora.io/en/conversational-ai/models/mllm/overview) for more details.
272+
For real-time audio processing using OpenAI Realtime, Gemini Live, Vertex AI, or xAI Grok, use the MLLM (Multimodal Large Language Model) flow instead of the cascading ASR -> LLM -> TTS flow. MLLM mode does not require separate TTS, STT, or LLM vendors. See the [MLLM Overview](https://docs.agora.io/en/conversational-ai/models/mllm/overview) for more details.
285273

286274
```python
287-
from agora-agent-server-sdk import Agora
288-
from agora-agent-server-sdk.agents import (
275+
from agora_agent import Agora
276+
from agora_agent.agents import (
289277
StartAgentsRequestProperties,
290-
StartAgentsRequestPropertiesAdvancedFeatures,
291278
StartAgentsRequestPropertiesMllm,
292279
StartAgentsRequestPropertiesMllmVendor,
293-
StartAgentsRequestPropertiesTts,
294-
StartAgentsRequestPropertiesTtsVendor,
295-
StartAgentsRequestPropertiesLlm,
296280
StartAgentsRequestPropertiesTurnDetection,
297281
StartAgentsRequestPropertiesTurnDetectionType,
298282
)
@@ -311,10 +295,8 @@ client.agents.start(
311295
agent_rtc_uid="1001",
312296
remote_rtc_uids=["1002"],
313297
idle_timeout=120,
314-
advanced_features=StartAgentsRequestPropertiesAdvancedFeatures(
315-
enable_mllm=True,
316-
),
317298
mllm=StartAgentsRequestPropertiesMllm(
299+
enable=True,
318300
url="wss://api.openai.com/v1/realtime",
319301
api_key="<your_openai_api_key>",
320302
vendor=StartAgentsRequestPropertiesMllmVendor.OPENAI,
@@ -331,14 +313,6 @@ client.agents.start(
331313
threshold=0.5,
332314
silence_duration_ms=500,
333315
),
334-
# TTS and LLM are still required but not used when MLLM is enabled
335-
tts=StartAgentsRequestPropertiesTts(
336-
vendor=StartAgentsRequestPropertiesTtsVendor.MICROSOFT,
337-
params={},
338-
),
339-
llm=StartAgentsRequestPropertiesLlm(
340-
url="https://api.openai.com/v1/chat/completions",
341-
),
342316
),
343317
)
344318
```

changelog.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,37 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/).
66

7+
## [v1.5.0] — 2026-05-20
8+
9+
### Added
10+
11+
- **`XaiGrok`** — New MLLM wrapper for xAI Grok (`mllm.vendor`: `"xai"`), including Realtime API URL, voice, language, sample rate, modalities, messages, and MLLM turn detection support.
12+
- **`GenericAvatar`** — New generic avatar wrapper (`vendor: "generic"`) for custom avatar providers.
13+
- **Avatar token enrichment**`AgentSession.start()` now fills missing generic avatar `agora_appid` and `agora_channel` from the session and generates missing avatar `agora_token` values for HeyGen, LiveAvatar, and Generic avatars using each avatar's `agora_uid`.
14+
- **Turn pagination**`AgentSession.get_turns()` and `AsyncAgentSession.get_turns()` now accept `page_index` and `page_size`. New `get_all_turns()` helpers fetch and combine all pages.
15+
- **Greeting interruption control** — LLM vendor `greeting_configs` now accepts the typed `LlmGreetingConfigs` shape, including v2.7 `interruptable`.
16+
- **Type alias parity** — Added public aliases for v2.7 generated types such as `LlmConfig`, `TtsConfig`, `SttConfig`, `MllmConfig`, `AvatarConfig`, `AgentConfigUpdate`, `ConversationTurns`, `ConversationHistory`, `SessionInfo`, `Labels`, `SpeakPriority`, and `FillerWordsContentSelectionRule`.
17+
18+
### Changed
19+
20+
- **`XaiGrok` is the primary xAI MLLM class** — Matches the product name ([xAI Grok](https://docs.agora.io/en/conversational-ai/models/mllm/xai)) and the TypeScript/Go SDKs. `XaiRealtime` remains as a deprecated backward-compatible alias.
21+
- **Package version** — Bumped to `v1.5.0` to match the Fern-generated SDK headers.
22+
- **RTM data channel default** — When `advanced_features.enable_rtm=True`, AgentKit now defaults `parameters.data_channel` to `"rtm"` unless the caller explicitly sets a data channel.
23+
- **Agent-level LLM overrides** — In the standard ASR + LLM + TTS pipeline, agent-level `greeting`, `failure_message`, and `max_history` now override vendor defaults, matching the TypeScript SDK. In MLLM mode, agent-level `greeting` and `failure_message` fill only missing fields.
24+
- **MLLM core alignment** — MLLM wrappers no longer expose or emit unsupported `predefined_tools` or `max_history` fields because they are not present in the generated v2.7 core `mllm` type.
25+
- **MLLM without TTS** — MLLM sessions no longer require separate TTS, STT, or LLM vendor configuration.
26+
- **Avatar pipeline support** — Avatar vendors are now explicitly limited to the cascading ASR + LLM + TTS pipeline. Combining `with_avatar()` with `with_mllm()` is rejected at `Agent.to_properties()` and `AgentSession.start()` (matching the TypeScript SDK), with a disabled avatar (`enable=False`) still permitted alongside MLLM.
27+
- **VertexAI parity**`VertexAI.to_config()` now spreads `additional_params` first so explicit `model`, `project_id`, `location`, and `adc_credentials_string` fields always win, matching the TypeScript and Gemini Live wrappers.
28+
- **Pagination guard parity**`AgentSession.get_all_turns()` and `AsyncAgentSession.get_all_turns()` now raise `RuntimeError` if the server's pagination metadata is missing (`page_index`/`total_pages`/`is_last_page`) or if the next page does not advance, matching the TypeScript SDK.
29+
30+
### Migration notes
31+
32+
- **`XaiRealtime``XaiGrok`** — Import and use `XaiGrok` for xAI MLLM (`mllm.vendor`: `"xai"`). `XaiRealtime` still works but emits `DeprecationWarning`. Future xAI cascading vendors will use `XaiSTT` and `XaiTTS`, not `XaiRealtime`.
33+
- **`think()` default** — The server default for `on_listening_action` changed from `inject` to `interrupt` in API v2.7. Pass `on_listening_action="inject"` explicitly to preserve the old behavior.
34+
- **Turn analytics pagination** — Sessions with more than 50 turns must request additional pages via `get_turns(page_index=..., page_size=...)` or use `get_all_turns()`.
35+
- **Error reasons** — API v2.7 adds status codes `401`, `429`, and `500`; `InvalidRequest` is split into `InvalidRequestBody`, `MissingRequiredField`, and `InvalidFieldValue`, with new reasons such as `ServiceNotEnabled`, `AccountSuspended`, and `ResourceAllocationFailed`.
36+
- **Event `112`** — Webhook event `112 turns finished` can be used as an alternative batch delivery path for post-session turn data.
37+
738
## [v1.4.1] — 2026-05-18
839

940
### Fixed
@@ -58,8 +89,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
5889
### Fixed
5990

6091
- **`AresSTT`** — Removed redundant `language` key from the `params` dict. Language is now emitted only at the top level. `params` is only included when `additional_params` is provided.
61-
- **`OpenAIRealtime` / `VertexAI` (MLLM)** — Agent-level `greeting`, `failure_message`, and `max_history` overrides are now correctly applied when the agent is in MLLM mode. Previously these values were silently dropped.
62-
- **`VertexAI` (MLLM)**`messages` is now correctly placed inside `params` (required by the Gemini Live API). Previously it was emitted at the top level and silently ignored.
92+
- **`OpenAIRealtime` / `VertexAI` (MLLM)** — Agent-level `greeting` and `failure_message` defaults are now correctly applied when missing in MLLM mode. Previously these values were silently dropped.
93+
- **`VertexAI` (MLLM)**`messages` is emitted at the MLLM top level, matching the generated core SDK contract.
6394

6495
### Changed
6596

@@ -72,8 +103,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
72103
- **`OpenAITTS`** — New optional parameters: `response_format` (str, e.g. `"pcm"`) and `speed` (float).
73104
- **`CartesiaTTS`**`voice_id` user-facing field is preserved; voice is serialized to the required nested object format automatically.
74105
- **`RimeTTS`** — New optional parameters: `lang` (str), `sampling_rate` (int, serialized as `samplingRate`), `speed_alpha` (float, serialized as `speedAlpha`).
75-
- **`OpenAIRealtime`** — New optional parameters: `predefined_tools` (List[str]), `failure_message` (str), `max_history` (int).
76-
- **`VertexAI` (MLLM)** — New optional parameters: `predefined_tools` (List[str]), `failure_message` (str), `max_history` (int).
106+
- **`OpenAIRealtime`** — New optional parameter: `failure_message` (str).
107+
- **`VertexAI` (MLLM)** — New optional parameter: `failure_message` (str).
77108
- **`HeyGenAvatar`** — New fields: `agora_token` (str, optional), `avatar_id` (str, optional), `enable` (bool, optional, default `True`), `disable_idle_timeout` (bool, optional), `activity_idle_timeout` (int, optional).
78109

79110
## [v1.1.0] — 2026-03-17

docs/concepts/vendors.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ Used with `agent.with_mllm()` for the [MLLM flow](../guides/mllm-flow.md). These
9797
| `OpenAIRealtime` | OpenAI Realtime | `api_key`; optional `turn_detection` |
9898
| `GeminiLive` | Google Gemini Live API | `api_key`, `model`; optional `turn_detection` |
9999
| `VertexAI` | Vertex AI (Gemini Live) | `model`, `project_id`, `location`, `adc_credentials_string`; optional `turn_detection` |
100+
| `XaiGrok` | xAI Grok (`mllm.vendor`: `xai`) | `api_key`; optional `voice`, `language`, `sample_rate`, `turn_detection` |
101+
102+
`XaiRealtime` is deprecated (use `XaiGrok`). Future xAI STT/TTS wrappers will be `XaiSTT` / `XaiTTS`, not `XaiRealtime`.
100103

101104
<!-- snippet: executable -->
102105
```python
@@ -107,12 +110,15 @@ mllm = OpenAIRealtime(api_key='your-openai-key', model='gpt-4o-realtime-preview'
107110

108111
## Avatar Vendors
109112

110-
Used with `agent.with_avatar()`. Avatars require specific TTS sample rates — see [Avatar Integration](../guides/avatars.md).
113+
Used with `agent.with_avatar()` in the cascading ASR + LLM + TTS pipeline. Some avatars require specific TTS sample rates — see [Avatar Integration](../guides/avatars.md).
111114

112115
| Class | Provider | Required Parameters | Required TTS Sample Rate |
113116
|---|---|---|---|
114-
| `HeyGenAvatar` | HeyGen | `api_key`, `quality`, `agora_uid` | 24000 Hz |
115-
| `AkoolAvatar` | Akool | `api_key`, `agora_uid` | 16000 Hz |
117+
| `HeyGenAvatar` | HeyGen (deprecated alias) | `api_key`, `quality`, `agora_uid` | 24000 Hz |
118+
| `LiveAvatarAvatar` | LiveAvatar | `api_key`, `quality`, `agora_uid` | 24000 Hz |
119+
| `AkoolAvatar` | Akool | `api_key` | 16000 Hz |
120+
| `AnamAvatar` | Anam | `api_key` | None |
121+
| `GenericAvatar` | Generic Avatar | `api_key`, `api_base_url`, `avatar_id`, `agora_uid` | None |
116122

117123
<!-- snippet: executable -->
118124
```python

docs/guides/avatars.md

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
11
---
22
sidebar_position: 3
33
title: Avatar Integration
4-
description: Add a digital avatar (HeyGen or Akool) to your Conversational AI agent.
4+
description: Add a digital avatar to your Conversational AI agent.
55
---
66

77
# Avatar Integration
88

9-
You can attach a digital avatar to your voice agent so that users see a visual representation of the AI speaking. Two avatar providers are supported:
9+
You can attach a digital avatar to your voice agent so that users see a visual representation of the AI speaking.
10+
11+
Avatars are currently supported only with the cascading ASR + LLM + TTS pipeline. MLLM sessions handle audio end-to-end and do not support avatars at this time.
1012

1113
| Provider | Class | Required TTS Sample Rate |
1214
|---|---|---|
13-
| HeyGen | `HeyGenAvatar` | 24000 Hz |
15+
| LiveAvatar | `LiveAvatarAvatar` | 24000 Hz |
16+
| HeyGen (deprecated alias) | `HeyGenAvatar` | 24000 Hz |
1417
| Akool | `AkoolAvatar` | 16000 Hz |
18+
| Anam | `AnamAvatar` | None |
19+
| Generic | `GenericAvatar` | None |
20+
21+
## Token Model
22+
23+
The agent and avatar join the same RTC channel with separate UIDs. The agent token is scoped to `agent_uid`; `avatar.params.agora_token` is scoped to the avatar `agora_uid`.
24+
25+
When using `AgentSession.start()`, `agora_token` is optional for LiveAvatar, HeyGen, and Generic avatars. If omitted, AgentKit generates it with the same ConvoAI token path as the agent, using the avatar UID. You can still pass `agora_token` explicitly.
1526

1627
## Sample Rate Constraint
1728

18-
Each avatar vendor requires a specific TTS sample rate. The SDK validates this when you call `with_avatar()` — if the TTS sample rate does not match, a `ValueError` is raised immediately:
29+
Each avatar vendor requires a specific TTS sample rate. The SDK validates this when you add TTS or avatar configuration and again when the session starts. If the TTS sample rate does not match, a `ValueError` is raised:
1930

2031
```
2132
ValueError: Avatar requires TTS sample rate of 24000 Hz, but TTS is configured with 16000 Hz. Please update your TTS sample_rate to 24000.
2233
```
2334

24-
This validation happens at build time (when chaining methods), not at runtime when the session starts. Python raises this as a `ValueError` — there is no compile-time check as in statically typed languages.
35+
Python raises this as a `ValueError` — there is no compile-time check as in statically typed languages.
2536

26-
Additionally, if the TTS `sample_rate` is not explicitly set (returns `None`), the SDK issues a warning:
37+
Additionally, if the TTS sample rate is not explicitly available, the SDK issues a warning through the session warning callback:
2738

2839
```
29-
UserWarning: Avatar requires TTS sample rate of 24000 Hz, but TTS sample_rate is not explicitly set. Please ensure your TTS provider is configured for 24000 Hz.
40+
Warning: LiveAvatar avatar detected but TTS sample_rate is not explicitly set. LiveAvatar requires 24,000 Hz. Please ensure your TTS provider is configured for 24kHz.
3041
```
3142

3243
## HeyGen Avatar (24 kHz)
@@ -58,7 +69,7 @@ agent = (
5869
api_key='your-heygen-key',
5970
quality='medium',
6071
agora_uid='2',
61-
avatar_name='your-avatar-name',
72+
avatar_id='your-avatar-id',
6273
))
6374
)
6475

@@ -68,6 +79,21 @@ session.say('Hello! I am your visual assistant.')
6879
session.stop()
6980
```
7081

82+
## Generic Avatar
83+
84+
`GenericAvatar` supports custom avatar providers. `agora_appid`, `agora_channel`, and `agora_token` are optional when using `AgentSession.start()`.
85+
86+
```python
87+
from agora_agent.agentkit.vendors import GenericAvatar
88+
89+
agent = agent.with_avatar(GenericAvatar(
90+
api_key='your-avatar-provider-key',
91+
api_base_url='https://avatar-provider.example.com',
92+
avatar_id='avatar-123',
93+
agora_uid='2',
94+
))
95+
```
96+
7197
## Akool Avatar (16 kHz)
7298

7399
Akool requires a TTS vendor configured at 16000 Hz:
@@ -143,15 +169,14 @@ If you call `with_avatar()` before `with_tts()`, the sample rate check is deferr
143169
| `api_key` | `str` | Yes | HeyGen API key |
144170
| `quality` | `str` | Yes | Avatar quality: `low`, `medium`, or `high` |
145171
| `agora_uid` | `str` | Yes | Agora UID for the avatar video stream |
146-
| `avatar_name` | `str` | No | Avatar name |
147-
| `voice_id` | `str` | No | Voice ID |
148-
| `language` | `str` | No | Language code |
149-
| `version` | `str` | No | API version (`v1` or `v2`) |
172+
| `agora_token` | `str` | No | Avatar token, generated at session start when omitted |
173+
| `avatar_id` | `str` | No | Avatar ID |
174+
| `disable_idle_timeout` | `bool` | No | Disable idle timeout |
175+
| `activity_idle_timeout` | `int` | No | Idle timeout in seconds |
150176

151177
## Akool Options
152178

153179
| Parameter | Type | Required | Description |
154180
|---|---|---|---|
155181
| `api_key` | `str` | Yes | Akool API key |
156-
| `agora_uid` | `str` | Yes | Agora UID for the avatar video stream |
157182
| `avatar_id` | `str` | No | Avatar ID |

0 commit comments

Comments
 (0)