agora-agents 2.1.1 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/README.md +49 -27
  2. package/dist/cjs/AgoraPoolClient.d.ts +9 -6
  3. package/dist/cjs/AgoraPoolClient.js +1 -0
  4. package/dist/cjs/BaseClient.js +2 -2
  5. package/dist/cjs/agentkit/Agent.d.ts +52 -51
  6. package/dist/cjs/agentkit/Agent.js +51 -51
  7. package/dist/cjs/agentkit/AgentSession.d.ts +11 -9
  8. package/dist/cjs/agentkit/AgentSession.js +10 -5
  9. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.d.ts +1 -0
  10. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.js +57 -0
  11. package/dist/cjs/agentkit/__tests__/readme-examples.test.d.ts +1 -0
  12. package/dist/cjs/agentkit/__tests__/readme-examples.test.js +126 -0
  13. package/dist/cjs/agentkit/__tests__/type-safety.test.js +24 -17
  14. package/dist/cjs/agentkit/area.d.ts +4 -0
  15. package/dist/cjs/agentkit/area.js +2 -0
  16. package/dist/cjs/agentkit/avatar-types.d.ts +28 -2
  17. package/dist/cjs/agentkit/avatar-types.js +24 -2
  18. package/dist/cjs/agentkit/index.d.ts +8 -5
  19. package/dist/cjs/agentkit/index.js +27 -2
  20. package/dist/cjs/agentkit/presets.js +11 -4
  21. package/dist/cjs/agentkit/region-vendors.d.ts +15 -0
  22. package/dist/cjs/agentkit/region-vendors.js +2 -0
  23. package/dist/cjs/agentkit/token.d.ts +3 -2
  24. package/dist/cjs/agentkit/token.js +3 -2
  25. package/dist/cjs/agentkit/types.d.ts +29 -6
  26. package/dist/cjs/agentkit/vendors/avatar.d.ts +9 -4
  27. package/dist/cjs/agentkit/vendors/avatar.js +6 -3
  28. package/dist/cjs/agentkit/vendors/base.d.ts +38 -5
  29. package/dist/cjs/agentkit/vendors/base.js +60 -6
  30. package/dist/cjs/agentkit/vendors/cn.d.ts +251 -0
  31. package/dist/cjs/agentkit/vendors/cn.js +293 -0
  32. package/dist/cjs/agentkit/vendors/llm.d.ts +4 -2
  33. package/dist/cjs/agentkit/vendors/llm.js +10 -5
  34. package/dist/cjs/agentkit/vendors/mllm.d.ts +8 -4
  35. package/dist/cjs/agentkit/vendors/mllm.js +8 -4
  36. package/dist/cjs/agentkit/vendors/stt.d.ts +4 -6
  37. package/dist/cjs/agentkit/vendors/stt.js +48 -62
  38. package/dist/cjs/agentkit/vendors/tts.d.ts +3 -3
  39. package/dist/cjs/agentkit/vendors/tts.js +1 -1
  40. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +5 -2
  41. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +4 -0
  42. package/dist/cjs/api/types/Asr.d.ts +16 -1
  43. package/dist/cjs/api/types/BytedanceDuplexTts.d.ts +9 -0
  44. package/dist/cjs/api/types/BytedanceDuplexTts.js +3 -0
  45. package/dist/cjs/api/types/BytedanceDuplexTtsParams.d.ts +13 -0
  46. package/dist/cjs/api/types/BytedanceDuplexTtsParams.js +3 -0
  47. package/dist/cjs/api/types/BytedanceTts.d.ts +9 -0
  48. package/dist/cjs/api/types/BytedanceTts.js +3 -0
  49. package/dist/cjs/api/types/BytedanceTtsParams.d.ts +23 -0
  50. package/dist/cjs/api/types/BytedanceTtsParams.js +3 -0
  51. package/dist/cjs/api/types/CosyvoiceTts.d.ts +9 -0
  52. package/dist/cjs/api/types/CosyvoiceTts.js +3 -0
  53. package/dist/cjs/api/types/CosyvoiceTtsParams.d.ts +15 -0
  54. package/dist/cjs/api/types/CosyvoiceTtsParams.js +3 -0
  55. package/dist/cjs/api/types/DeepgramAsr.d.ts +0 -2
  56. package/dist/cjs/api/types/DeepgramAsrParams.d.ts +1 -1
  57. package/dist/cjs/api/types/FengmingAsr.d.ts +11 -0
  58. package/dist/cjs/api/types/FengmingAsr.js +3 -0
  59. package/dist/cjs/api/types/MinimaxTtsParams.d.ts +52 -3
  60. package/dist/cjs/api/types/SensetimeAvatarParams.d.ts +48 -0
  61. package/dist/cjs/api/types/SensetimeAvatarParams.js +3 -0
  62. package/dist/cjs/api/types/StepfunTts.d.ts +9 -0
  63. package/dist/cjs/api/types/StepfunTts.js +3 -0
  64. package/dist/cjs/api/types/StepfunTtsParams.d.ts +13 -0
  65. package/dist/cjs/api/types/StepfunTtsParams.js +3 -0
  66. package/dist/cjs/api/types/TencentAsr.d.ts +10 -0
  67. package/dist/cjs/api/types/TencentAsr.js +3 -0
  68. package/dist/cjs/api/types/TencentAsrParams.d.ts +17 -0
  69. package/dist/cjs/api/types/TencentAsrParams.js +3 -0
  70. package/dist/cjs/api/types/TencentTts.d.ts +9 -0
  71. package/dist/cjs/api/types/TencentTts.js +3 -0
  72. package/dist/cjs/api/types/TencentTtsParams.d.ts +23 -0
  73. package/dist/cjs/api/types/TencentTtsParams.js +3 -0
  74. package/dist/cjs/api/types/Tts.d.ts +16 -1
  75. package/dist/cjs/api/types/XfyunAsr.d.ts +10 -0
  76. package/dist/cjs/api/types/XfyunAsr.js +3 -0
  77. package/dist/cjs/api/types/XfyunAsrParams.d.ts +15 -0
  78. package/dist/cjs/api/types/XfyunAsrParams.js +3 -0
  79. package/dist/cjs/api/types/XfyunBigmodelAsr.d.ts +10 -0
  80. package/dist/cjs/api/types/XfyunBigmodelAsr.js +3 -0
  81. package/dist/cjs/api/types/XfyunBigmodelAsrParams.d.ts +17 -0
  82. package/dist/cjs/api/types/XfyunBigmodelAsrParams.js +3 -0
  83. package/dist/cjs/api/types/XfyunDialectAsr.d.ts +10 -0
  84. package/dist/cjs/api/types/XfyunDialectAsr.js +3 -0
  85. package/dist/cjs/api/types/XfyunDialectAsrParams.d.ts +15 -0
  86. package/dist/cjs/api/types/XfyunDialectAsrParams.js +3 -0
  87. package/dist/cjs/api/types/index.d.ts +20 -0
  88. package/dist/cjs/api/types/index.js +20 -0
  89. package/dist/cjs/core/domain/index.d.ts +2 -1
  90. package/dist/cjs/core/domain/index.js +5 -3
  91. package/dist/cjs/index.d.ts +3 -2
  92. package/dist/cjs/index.js +26 -2
  93. package/dist/cjs/version.d.ts +1 -1
  94. package/dist/cjs/version.js +1 -1
  95. package/dist/esm/AgoraPoolClient.d.mts +9 -6
  96. package/dist/esm/AgoraPoolClient.mjs +1 -0
  97. package/dist/esm/BaseClient.mjs +2 -2
  98. package/dist/esm/agentkit/Agent.d.mts +52 -51
  99. package/dist/esm/agentkit/Agent.mjs +51 -51
  100. package/dist/esm/agentkit/AgentSession.d.mts +11 -9
  101. package/dist/esm/agentkit/AgentSession.mjs +11 -6
  102. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.d.mts +1 -0
  103. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.mjs +55 -0
  104. package/dist/esm/agentkit/__tests__/readme-examples.test.d.mts +1 -0
  105. package/dist/esm/agentkit/__tests__/readme-examples.test.mjs +124 -0
  106. package/dist/esm/agentkit/__tests__/type-safety.test.mjs +24 -17
  107. package/dist/esm/agentkit/area.d.mts +4 -0
  108. package/dist/esm/agentkit/area.mjs +1 -0
  109. package/dist/esm/agentkit/avatar-types.d.mts +28 -2
  110. package/dist/esm/agentkit/avatar-types.mjs +23 -2
  111. package/dist/esm/agentkit/index.d.mts +8 -5
  112. package/dist/esm/agentkit/index.mjs +3 -2
  113. package/dist/esm/agentkit/presets.mjs +11 -4
  114. package/dist/esm/agentkit/region-vendors.d.mts +15 -0
  115. package/dist/esm/agentkit/region-vendors.mjs +1 -0
  116. package/dist/esm/agentkit/token.d.mts +3 -2
  117. package/dist/esm/agentkit/token.mjs +3 -2
  118. package/dist/esm/agentkit/types.d.mts +29 -6
  119. package/dist/esm/agentkit/vendors/avatar.d.mts +9 -4
  120. package/dist/esm/agentkit/vendors/avatar.mjs +6 -3
  121. package/dist/esm/agentkit/vendors/base.d.mts +38 -5
  122. package/dist/esm/agentkit/vendors/base.mjs +55 -5
  123. package/dist/esm/agentkit/vendors/cn.d.mts +251 -0
  124. package/dist/esm/agentkit/vendors/cn.mjs +272 -0
  125. package/dist/esm/agentkit/vendors/llm.d.mts +4 -2
  126. package/dist/esm/agentkit/vendors/llm.mjs +10 -5
  127. package/dist/esm/agentkit/vendors/mllm.d.mts +8 -4
  128. package/dist/esm/agentkit/vendors/mllm.mjs +8 -4
  129. package/dist/esm/agentkit/vendors/stt.d.mts +4 -6
  130. package/dist/esm/agentkit/vendors/stt.mjs +48 -62
  131. package/dist/esm/agentkit/vendors/tts.d.mts +3 -3
  132. package/dist/esm/agentkit/vendors/tts.mjs +1 -1
  133. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +5 -2
  134. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +4 -0
  135. package/dist/esm/api/types/Asr.d.mts +16 -1
  136. package/dist/esm/api/types/BytedanceDuplexTts.d.mts +9 -0
  137. package/dist/esm/api/types/BytedanceDuplexTts.mjs +2 -0
  138. package/dist/esm/api/types/BytedanceDuplexTtsParams.d.mts +13 -0
  139. package/dist/esm/api/types/BytedanceDuplexTtsParams.mjs +2 -0
  140. package/dist/esm/api/types/BytedanceTts.d.mts +9 -0
  141. package/dist/esm/api/types/BytedanceTts.mjs +2 -0
  142. package/dist/esm/api/types/BytedanceTtsParams.d.mts +23 -0
  143. package/dist/esm/api/types/BytedanceTtsParams.mjs +2 -0
  144. package/dist/esm/api/types/CosyvoiceTts.d.mts +9 -0
  145. package/dist/esm/api/types/CosyvoiceTts.mjs +2 -0
  146. package/dist/esm/api/types/CosyvoiceTtsParams.d.mts +15 -0
  147. package/dist/esm/api/types/CosyvoiceTtsParams.mjs +2 -0
  148. package/dist/esm/api/types/DeepgramAsr.d.mts +0 -2
  149. package/dist/esm/api/types/DeepgramAsrParams.d.mts +1 -1
  150. package/dist/esm/api/types/FengmingAsr.d.mts +11 -0
  151. package/dist/esm/api/types/FengmingAsr.mjs +2 -0
  152. package/dist/esm/api/types/MinimaxTtsParams.d.mts +52 -3
  153. package/dist/esm/api/types/SensetimeAvatarParams.d.mts +48 -0
  154. package/dist/esm/api/types/SensetimeAvatarParams.mjs +2 -0
  155. package/dist/esm/api/types/StepfunTts.d.mts +9 -0
  156. package/dist/esm/api/types/StepfunTts.mjs +2 -0
  157. package/dist/esm/api/types/StepfunTtsParams.d.mts +13 -0
  158. package/dist/esm/api/types/StepfunTtsParams.mjs +2 -0
  159. package/dist/esm/api/types/TencentAsr.d.mts +10 -0
  160. package/dist/esm/api/types/TencentAsr.mjs +2 -0
  161. package/dist/esm/api/types/TencentAsrParams.d.mts +17 -0
  162. package/dist/esm/api/types/TencentAsrParams.mjs +2 -0
  163. package/dist/esm/api/types/TencentTts.d.mts +9 -0
  164. package/dist/esm/api/types/TencentTts.mjs +2 -0
  165. package/dist/esm/api/types/TencentTtsParams.d.mts +23 -0
  166. package/dist/esm/api/types/TencentTtsParams.mjs +2 -0
  167. package/dist/esm/api/types/Tts.d.mts +16 -1
  168. package/dist/esm/api/types/XfyunAsr.d.mts +10 -0
  169. package/dist/esm/api/types/XfyunAsr.mjs +2 -0
  170. package/dist/esm/api/types/XfyunAsrParams.d.mts +15 -0
  171. package/dist/esm/api/types/XfyunAsrParams.mjs +2 -0
  172. package/dist/esm/api/types/XfyunBigmodelAsr.d.mts +10 -0
  173. package/dist/esm/api/types/XfyunBigmodelAsr.mjs +2 -0
  174. package/dist/esm/api/types/XfyunBigmodelAsrParams.d.mts +17 -0
  175. package/dist/esm/api/types/XfyunBigmodelAsrParams.mjs +2 -0
  176. package/dist/esm/api/types/XfyunDialectAsr.d.mts +10 -0
  177. package/dist/esm/api/types/XfyunDialectAsr.mjs +2 -0
  178. package/dist/esm/api/types/XfyunDialectAsrParams.d.mts +15 -0
  179. package/dist/esm/api/types/XfyunDialectAsrParams.mjs +2 -0
  180. package/dist/esm/api/types/index.d.mts +20 -0
  181. package/dist/esm/api/types/index.mjs +20 -0
  182. package/dist/esm/core/domain/index.d.mts +2 -1
  183. package/dist/esm/core/domain/index.mjs +4 -2
  184. package/dist/esm/index.d.mts +3 -2
  185. package/dist/esm/index.mjs +6 -6
  186. package/dist/esm/version.d.mts +1 -1
  187. package/dist/esm/version.mjs +1 -1
  188. package/package.json +1 -1
@@ -2,22 +2,25 @@
2
2
  * Agent class - A reusable agent definition.
3
3
  *
4
4
  * This class represents an agent configuration that can be used to create
5
- * multiple sessions. It provides a fluent builder pattern for configuration.
5
+ * multiple sessions. Set the unique agent instance `name` in
6
+ * {@link Agent.createSession}, not on the Agent itself.
6
7
  */
8
+ import type { AgoraClient } from "../AgoraPoolClient.mjs";
7
9
  import type * as Agora from "../api/index.mjs";
8
- import type { AgoraClient } from "../Client.mjs";
9
10
  import { AgentSession } from "./AgentSession.mjs";
11
+ import type { AgoraArea } from "./area.mjs";
12
+ import type { AvatarVendor, LlmVendor, SttVendor, TtsVendor } from "./region-vendors.mjs";
10
13
  import type { AdvancedFeatures, AvatarConfig, FillerWordsConfig, GeofenceConfig, InterruptionConfig, Labels, LlmConfig, LlmGreetingConfigs, MllmConfig, ParametersAudioScenario, RtcConfig, SalConfig, SessionOptions, SessionParamsInput, SttConfig, TtsConfig, TurnDetectionConfig } from "./types.mjs";
11
- import type { BaseAvatar, BaseLLM, BaseMLLM, BaseSTT, BaseTTS } from "./vendors/base.mjs";
14
+ import type { BaseMLLM } from "./vendors/base.mjs";
12
15
  /**
13
16
  * Configuration options for creating an Agent.
14
17
  *
15
18
  * Use the fluent builder methods (.withLlm(), .withTts(), .withStt(), .withMllm())
16
19
  * to configure vendor settings after construction.
17
20
  */
18
- export interface AgentOptions {
19
- /** Optional name for the agent (used as default session name) */
20
- name?: string;
21
+ export interface AgentOptions<TArea extends AgoraArea = AgoraArea> {
22
+ /** Agora client bound to this agent. Required for `createSession()`. */
23
+ client: AgoraClient<TArea>;
21
24
  /**
22
25
  * Published AI Studio pipeline ID to use as this agent's base configuration.
23
26
  * Explicit Agent config such as .withLlm(), .withTts(), .withStt(),
@@ -81,14 +84,21 @@ export interface AgentOptions {
81
84
  * import { Agent, OpenAI, MicrosoftTTS, DeepgramSTT } from 'agora-agents';
82
85
  *
83
86
  * // Use the fluent builder pattern to configure vendors
84
- * const agent = new Agent({ instructions: 'You are helpful.' })
87
+ * const agent = new Agent({ client, instructions: 'You are helpful.' })
85
88
  * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4', url: 'https://api.openai.com/v1/chat/completions' }))
86
89
  * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
87
90
  * .withStt(new DeepgramSTT({ apiKey: '...', model: 'nova-2' }));
91
+ *
92
+ * const session = agent.createSession({
93
+ * name: `conversation-${Date.now()}`,
94
+ * channel: `demo-channel-${Date.now()}`,
95
+ * agentUid: '1',
96
+ * remoteUids: ['100'],
97
+ * });
88
98
  * ```
89
99
  */
90
- export declare class Agent<TTSSampleRate extends number = number> {
91
- private _name?;
100
+ export declare class Agent<TTSSampleRate extends number = number, TArea extends AgoraArea = AgoraArea> {
101
+ private _client;
92
102
  private _pipelineId?;
93
103
  private _llm?;
94
104
  private _tts?;
@@ -109,13 +119,13 @@ export declare class Agent<TTSSampleRate extends number = number> {
109
119
  private _rtc?;
110
120
  private _fillerWords?;
111
121
  private _greetingConfigs?;
112
- constructor(options?: AgentOptions);
122
+ constructor(options: AgentOptions<TArea>);
113
123
  /**
114
124
  * Returns a new Agent with the specified LLM vendor.
115
125
  *
116
126
  * @param vendor - LLM vendor instance (e.g., new OpenAI({ apiKey: '...', model: 'gpt-4', url: 'https://api.openai.com/v1/chat/completions' }))
117
127
  */
118
- withLlm(vendor: BaseLLM): Agent<TTSSampleRate>;
128
+ withLlm(vendor: LlmVendor): Agent<TTSSampleRate, TArea>;
119
129
  /**
120
130
  * Returns a new Agent with the specified TTS vendor.
121
131
  *
@@ -125,7 +135,7 @@ export declare class Agent<TTSSampleRate extends number = number> {
125
135
  * @param vendor - TTS vendor instance (e.g., new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
126
136
  * @returns Agent with tracked sample rate type
127
137
  */
128
- withTts<SR extends number>(vendor: BaseTTS<SR>): Agent<SR>;
138
+ withTts<SR extends number>(vendor: TtsVendor<SR>): Agent<SR, TArea>;
129
139
  /**
130
140
  * Returns a new Agent with the specified STT vendor.
131
141
  *
@@ -141,7 +151,7 @@ export declare class Agent<TTSSampleRate extends number = number> {
141
151
  * }));
142
152
  * ```
143
153
  */
144
- withStt(vendor: BaseSTT): Agent<TTSSampleRate>;
154
+ withStt(vendor: SttVendor): Agent<TTSSampleRate, TArea>;
145
155
  /**
146
156
  * Returns a new Agent with the specified MLLM vendor.
147
157
  *
@@ -156,7 +166,7 @@ export declare class Agent<TTSSampleRate extends number = number> {
156
166
  *
157
167
  * @param vendor - MLLM vendor instance (e.g., new VertexAI({ model: '...', projectId: '...', ... }))
158
168
  */
159
- withMllm(vendor: BaseMLLM): Agent<TTSSampleRate>;
169
+ withMllm(vendor: BaseMLLM): Agent<TTSSampleRate, TArea>;
160
170
  /**
161
171
  * Returns a new Agent with the specified Avatar vendor.
162
172
  *
@@ -180,7 +190,8 @@ export declare class Agent<TTSSampleRate extends number = number> {
180
190
  * ```typescript
181
191
  * import { HeyGenAvatar, ElevenLabsTTS } from 'agora-agents';
182
192
  *
183
- * const agent = new Agent({ name: 'avatar-assistant' })
193
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
194
+ * const agent = new Agent({ client })
184
195
  * .withTts(new ElevenLabsTTS({
185
196
  * key: '...',
186
197
  * modelId: '...',
@@ -195,27 +206,27 @@ export declare class Agent<TTSSampleRate extends number = number> {
195
206
  * }));
196
207
  * ```
197
208
  */
198
- withAvatar<RequiredSR extends number>(this: Agent<RequiredSR>, vendor: BaseAvatar<RequiredSR>): Agent<RequiredSR>;
209
+ withAvatar<RequiredSR extends number>(this: Agent<RequiredSR, TArea>, vendor: AvatarVendor<RequiredSR>): Agent<RequiredSR, TArea>;
199
210
  /**
200
211
  * Returns a new Agent with the specified turn detection configuration.
201
212
  */
202
- withTurnDetection(config: TurnDetectionConfig): Agent<TTSSampleRate>;
213
+ withTurnDetection(config: TurnDetectionConfig): Agent<TTSSampleRate, TArea>;
203
214
  /**
204
215
  * Returns a new Agent with unified interruption control configured.
205
216
  */
206
- withInterruption(config: InterruptionConfig): Agent<TTSSampleRate>;
217
+ withInterruption(config: InterruptionConfig): Agent<TTSSampleRate, TArea>;
207
218
  /**
208
219
  * Returns a new Agent with the specified instructions.
209
220
  *
210
221
  * @deprecated Configure system messages on the LLM vendor instead.
211
222
  */
212
- withInstructions(instructions: string): Agent<TTSSampleRate>;
223
+ withInstructions(instructions: string): Agent<TTSSampleRate, TArea>;
213
224
  /**
214
225
  * Returns a new Agent with the specified greeting message.
215
226
  *
216
227
  * @deprecated Configure the greeting on the LLM or MLLM vendor instead.
217
228
  */
218
- withGreeting(greeting: string): Agent<TTSSampleRate>;
229
+ withGreeting(greeting: string): Agent<TTSSampleRate, TArea>;
219
230
  /**
220
231
  * Returns a new Agent with the specified greeting playback configuration.
221
232
  *
@@ -224,35 +235,31 @@ export declare class Agent<TTSSampleRate extends number = number> {
224
235
  *
225
236
  * @deprecated Configure greeting playback on the LLM vendor instead.
226
237
  */
227
- withGreetingConfigs(configs: LlmGreetingConfigs): Agent<TTSSampleRate>;
228
- /**
229
- * Returns a new Agent with the specified name.
230
- */
231
- withName(name: string): Agent<TTSSampleRate>;
238
+ withGreetingConfigs(configs: LlmGreetingConfigs): Agent<TTSSampleRate, TArea>;
232
239
  /**
233
240
  * Returns a new Agent with the specified SAL (Selective Attention Locking) configuration.
234
241
  */
235
- withSal(config: SalConfig): Agent<TTSSampleRate>;
242
+ withSal(config: SalConfig): Agent<TTSSampleRate, TArea>;
236
243
  /**
237
244
  * Returns a new Agent with the specified advanced features configuration.
238
245
  *
239
246
  * Use this to enable features like RTM and others.
240
247
  */
241
- withAdvancedFeatures(features: AdvancedFeatures): Agent<TTSSampleRate>;
248
+ withAdvancedFeatures(features: AdvancedFeatures): Agent<TTSSampleRate, TArea>;
242
249
  /**
243
250
  * Returns a new Agent with MCP tool invocation enabled or disabled.
244
251
  */
245
- withTools(enabled?: boolean): Agent<TTSSampleRate>;
252
+ withTools(enabled?: boolean): Agent<TTSSampleRate, TArea>;
246
253
  /**
247
254
  * Returns a new Agent with the specified session parameters.
248
255
  *
249
256
  * Use this to configure silence behaviour, graceful hang-up, data channel, and more.
250
257
  */
251
- withParameters(parameters: SessionParamsInput): Agent<TTSSampleRate>;
258
+ withParameters(parameters: SessionParamsInput): Agent<TTSSampleRate, TArea>;
252
259
  /**
253
260
  * Returns a new Agent with the specified RTC audio scenario.
254
261
  */
255
- withAudioScenario(audioScenario: ParametersAudioScenario): Agent<TTSSampleRate>;
262
+ withAudioScenario(audioScenario: ParametersAudioScenario): Agent<TTSSampleRate, TArea>;
256
263
  /**
257
264
  * Returns a new Agent with the specified failure message.
258
265
  *
@@ -260,40 +267,36 @@ export declare class Agent<TTSSampleRate extends number = number> {
260
267
  *
261
268
  * @deprecated Configure the failure message on the LLM or MLLM vendor instead.
262
269
  */
263
- withFailureMessage(message: string): Agent<TTSSampleRate>;
270
+ withFailureMessage(message: string): Agent<TTSSampleRate, TArea>;
264
271
  /**
265
272
  * Returns a new Agent with the specified maximum conversation history length.
266
273
  * Applies to the standard LLM pipeline only; the v2.7 MLLM core schema has no max_history field.
267
274
  *
268
275
  * @deprecated Configure max history on the LLM vendor instead.
269
276
  */
270
- withMaxHistory(maxHistory: number): Agent<TTSSampleRate>;
277
+ withMaxHistory(maxHistory: number): Agent<TTSSampleRate, TArea>;
271
278
  /**
272
279
  * Returns a new Agent with the specified geofence configuration.
273
280
  *
274
281
  * Restricts which geographic regions the agent's backend servers may run in.
275
282
  */
276
- withGeofence(geofence: GeofenceConfig): Agent<TTSSampleRate>;
283
+ withGeofence(geofence: GeofenceConfig): Agent<TTSSampleRate, TArea>;
277
284
  /**
278
285
  * Returns a new Agent with the specified custom labels.
279
286
  *
280
287
  * Labels are key-value pairs attached to the agent and returned in notification callbacks.
281
288
  */
282
- withLabels(labels: Labels): Agent<TTSSampleRate>;
289
+ withLabels(labels: Labels): Agent<TTSSampleRate, TArea>;
283
290
  /**
284
291
  * Returns a new Agent with the specified RTC configuration.
285
292
  */
286
- withRtc(rtc: RtcConfig): Agent<TTSSampleRate>;
293
+ withRtc(rtc: RtcConfig): Agent<TTSSampleRate, TArea>;
287
294
  /**
288
295
  * Returns a new Agent with the specified filler words configuration.
289
296
  *
290
297
  * Filler words are played while the agent waits for the LLM to respond.
291
298
  */
292
- withFillerWords(fillerWords: FillerWordsConfig): Agent<TTSSampleRate>;
293
- /**
294
- * Get the agent name.
295
- */
296
- get name(): string | undefined;
299
+ withFillerWords(fillerWords: FillerWordsConfig): Agent<TTSSampleRate, TArea>;
297
300
  /**
298
301
  * Get the AI Studio pipeline ID used as this agent's base configuration.
299
302
  */
@@ -388,18 +391,19 @@ export declare class Agent<TTSSampleRate extends number = number> {
388
391
  /**
389
392
  * Creates a new session from this agent configuration.
390
393
  *
391
- * @param client - The Agora client instance (must have appId and appCertificate properties)
392
394
  * @param options - Session connection options
393
395
  * @returns A new AgentSession instance ready to start
394
396
  *
395
397
  * @example
396
398
  * ```typescript
397
- * const agent = new Agent({ name: 'my-assistant', instructions: '...' })
398
- * .withLlm({ ... })
399
- * .withTts({ ... });
400
- *
401
- * const session = agent.createSession(client, {
402
- * channel: 'room-123',
399
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
400
+ * const agent = new Agent({ client })
401
+ * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4o-mini', url: 'https://api.openai.com/v1/chat/completions' }))
402
+ * .withTts(new MiniMaxTTS({ model: 'speech_2_6_turbo', voiceId: 'English_captivating_female1' }));
403
+ *
404
+ * const session = agent.createSession({
405
+ * name: `conversation-${Date.now()}`,
406
+ * channel: `demo-channel-${Date.now()}`,
403
407
  * agentUid: '1',
404
408
  * remoteUids: ['100'],
405
409
  * idleTimeout: 120,
@@ -408,10 +412,7 @@ export declare class Agent<TTSSampleRate extends number = number> {
408
412
  * const agentId = await session.start();
409
413
  * ```
410
414
  */
411
- createSession(client: AgoraClient & {
412
- readonly appId: string;
413
- readonly appCertificate?: string;
414
- }, options: SessionOptions): AgentSession;
415
+ createSession(options: SessionOptions): AgentSession;
415
416
  /**
416
417
  * Converts the Agent configuration to the Fern request properties format.
417
418
  *
@@ -2,9 +2,11 @@
2
2
  * Agent class - A reusable agent definition.
3
3
  *
4
4
  * This class represents an agent configuration that can be used to create
5
- * multiple sessions. It provides a fluent builder pattern for configuration.
5
+ * multiple sessions. Set the unique agent instance `name` in
6
+ * {@link Agent.createSession}, not on the Agent itself.
6
7
  */
7
8
  import { AgentSession } from "./AgentSession.mjs";
9
+ import { AudioScenario } from "./constants.mjs";
8
10
  import { generateConvoAIToken } from "./token.mjs";
9
11
  const DEFAULT_TURN_DETECTION_LANGUAGE = "en-US";
10
12
  const INTERACTION_LANGUAGES = new Set([
@@ -46,7 +48,7 @@ function isTurnDetectionLanguage(value) {
46
48
  }
47
49
  function assertTurnDetectionLanguage(value) {
48
50
  if (!isTurnDetectionLanguage(value)) {
49
- throw new Error(`Invalid interaction language: ${value}`);
51
+ throw new Error(`Invalid turnDetection.language: ${value}`);
50
52
  }
51
53
  }
52
54
  /**
@@ -59,15 +61,22 @@ function assertTurnDetectionLanguage(value) {
59
61
  * import { Agent, OpenAI, MicrosoftTTS, DeepgramSTT } from 'agora-agents';
60
62
  *
61
63
  * // Use the fluent builder pattern to configure vendors
62
- * const agent = new Agent({ instructions: 'You are helpful.' })
64
+ * const agent = new Agent({ client, instructions: 'You are helpful.' })
63
65
  * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4', url: 'https://api.openai.com/v1/chat/completions' }))
64
66
  * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
65
67
  * .withStt(new DeepgramSTT({ apiKey: '...', model: 'nova-2' }));
68
+ *
69
+ * const session = agent.createSession({
70
+ * name: `conversation-${Date.now()}`,
71
+ * channel: `demo-channel-${Date.now()}`,
72
+ * agentUid: '1',
73
+ * remoteUids: ['100'],
74
+ * });
66
75
  * ```
67
76
  */
68
77
  export class Agent {
69
- constructor(options = {}) {
70
- this._name = options.name;
78
+ constructor(options) {
79
+ this._client = options.client;
71
80
  this._pipelineId = options.pipelineId;
72
81
  this._instructions = options.instructions;
73
82
  this._greeting = options.greeting;
@@ -202,7 +211,8 @@ export class Agent {
202
211
  * ```typescript
203
212
  * import { HeyGenAvatar, ElevenLabsTTS } from 'agora-agents';
204
213
  *
205
- * const agent = new Agent({ name: 'avatar-assistant' })
214
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
215
+ * const agent = new Agent({ client })
206
216
  * .withTts(new ElevenLabsTTS({
207
217
  * key: '...',
208
218
  * modelId: '...',
@@ -273,14 +283,6 @@ export class Agent {
273
283
  newAgent._greetingConfigs = configs;
274
284
  return newAgent;
275
285
  }
276
- /**
277
- * Returns a new Agent with the specified name.
278
- */
279
- withName(name) {
280
- const newAgent = this._clone();
281
- newAgent._name = name;
282
- return newAgent;
283
- }
284
286
  /**
285
287
  * Returns a new Agent with the specified SAL (Selective Attention Locking) configuration.
286
288
  */
@@ -386,12 +388,6 @@ export class Agent {
386
388
  newAgent._fillerWords = fillerWords;
387
389
  return newAgent;
388
390
  }
389
- /**
390
- * Get the agent name.
391
- */
392
- get name() {
393
- return this._name;
394
- }
395
391
  /**
396
392
  * Get the AI Studio pipeline ID used as this agent's base configuration.
397
393
  */
@@ -519,7 +515,7 @@ export class Agent {
519
515
  */
520
516
  get config() {
521
517
  return {
522
- name: this._name,
518
+ client: this._client,
523
519
  pipelineId: this._pipelineId,
524
520
  instructions: this._instructions,
525
521
  turnDetection: this._turnDetection,
@@ -545,18 +541,19 @@ export class Agent {
545
541
  /**
546
542
  * Creates a new session from this agent configuration.
547
543
  *
548
- * @param client - The Agora client instance (must have appId and appCertificate properties)
549
544
  * @param options - Session connection options
550
545
  * @returns A new AgentSession instance ready to start
551
546
  *
552
547
  * @example
553
548
  * ```typescript
554
- * const agent = new Agent({ name: 'my-assistant', instructions: '...' })
555
- * .withLlm({ ... })
556
- * .withTts({ ... });
557
- *
558
- * const session = agent.createSession(client, {
559
- * channel: 'room-123',
549
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
550
+ * const agent = new Agent({ client })
551
+ * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4o-mini', url: 'https://api.openai.com/v1/chat/completions' }))
552
+ * .withTts(new MiniMaxTTS({ model: 'speech_2_6_turbo', voiceId: 'English_captivating_female1' }));
553
+ *
554
+ * const session = agent.createSession({
555
+ * name: `conversation-${Date.now()}`,
556
+ * channel: `demo-channel-${Date.now()}`,
560
557
  * agentUid: '1',
561
558
  * remoteUids: ['100'],
562
559
  * idleTimeout: 120,
@@ -565,10 +562,10 @@ export class Agent {
565
562
  * const agentId = await session.start();
566
563
  * ```
567
564
  */
568
- createSession(client, options) {
569
- var _a, _b;
570
- const name = (_b = (_a = options.name) !== null && _a !== void 0 ? _a : this._name) !== null && _b !== void 0 ? _b : `agent-${Date.now()}`;
571
- return new AgentSession(Object.assign(Object.assign({ client, agent: this, appId: client.appId, appCertificate: client.appCertificate }, options), { name }));
565
+ createSession(options) {
566
+ var _a;
567
+ const name = (_a = options.name) !== null && _a !== void 0 ? _a : `agent-${Date.now()}`;
568
+ return new AgentSession(Object.assign(Object.assign({ client: this._client, agent: this, appId: this._client.appId, appCertificate: this._client.appCertificate }, options), { name }));
572
569
  }
573
570
  /**
574
571
  * Converts the Agent configuration to the Fern request properties format.
@@ -578,7 +575,7 @@ export class Agent {
578
575
  * and RTM privileges (required for RTM-enabled sessions).
579
576
  */
580
577
  toProperties(opts) {
581
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
578
+ var _a, _b, _c, _d, _e, _f, _g, _h;
582
579
  // In MLLM mode the backend handles audio end-to-end; LLM, TTS, and ASR
583
580
  // are not required.
584
581
  const isMllmMode = ((_a = this._mllm) === null || _a === void 0 ? void 0 : _a.enable) === true || this._mllm !== undefined;
@@ -611,8 +608,13 @@ export class Agent {
611
608
  // When RTM is enabled, data_channel must also be 'rtm' for the client
612
609
  // to receive transcripts and state events. Default it automatically so
613
610
  // callers only need to set advancedFeatures.enable_rtm: true.
614
- const resolvedParameters = ((_b = this._advancedFeatures) === null || _b === void 0 ? void 0 : _b.enable_rtm) && !((_c = this._parameters) === null || _c === void 0 ? void 0 : _c.data_channel)
615
- ? Object.assign(Object.assign({}, this._parameters), { data_channel: "rtm" }) : this._parameters;
611
+ let resolvedParameters = this._parameters;
612
+ if (((_b = this._advancedFeatures) === null || _b === void 0 ? void 0 : _b.enable_rtm) && !(resolvedParameters === null || resolvedParameters === void 0 ? void 0 : resolvedParameters.data_channel)) {
613
+ resolvedParameters = Object.assign(Object.assign({}, resolvedParameters), { data_channel: "rtm" });
614
+ }
615
+ if ((resolvedParameters === null || resolvedParameters === void 0 ? void 0 : resolvedParameters.audio_scenario) === undefined) {
616
+ resolvedParameters = Object.assign(Object.assign({}, resolvedParameters), { audio_scenario: AudioScenario.Default });
617
+ }
616
618
  const base = {
617
619
  channel: opts.channel,
618
620
  token,
@@ -646,8 +648,8 @@ export class Agent {
646
648
  }
647
649
  return Object.assign(Object.assign({}, base), { mllm: mllmConfig, turn_detection: this._turnDetection });
648
650
  }
649
- const skipCategories = new Set((_d = opts.skipVendorValidationCategories) !== null && _d !== void 0 ? _d : []);
650
- const allowMissingCategories = new Set((_e = opts.allowMissingVendorCategories) !== null && _e !== void 0 ? _e : []);
651
+ const skipCategories = new Set((_c = opts.skipVendorValidationCategories) !== null && _c !== void 0 ? _c : []);
652
+ const allowMissingCategories = new Set((_d = opts.allowMissingVendorCategories) !== null && _d !== void 0 ? _d : []);
651
653
  if (opts.skipVendorValidation) {
652
654
  for (const category of ["asr", "llm", "tts"]) {
653
655
  skipCategories.add(category);
@@ -666,13 +668,15 @@ export class Agent {
666
668
  throw new Error("LLM configuration is required. Use withLlm() to set it.");
667
669
  }
668
670
  const llmConfig = this._llm
669
- ? Object.assign(Object.assign({}, this._llm), { system_messages: this._instructions
670
- ? [{ role: "system", content: this._instructions }]
671
- : this._llm.system_messages, greeting_message: (_f = this._greeting) !== null && _f !== void 0 ? _f : this._llm.greeting_message, greeting_configs: (_g = this._greetingConfigs) !== null && _g !== void 0 ? _g : this._llm.greeting_configs, failure_message: (_h = this._failureMessage) !== null && _h !== void 0 ? _h : this._llm.failure_message, max_history: (_j = this._maxHistory) !== null && _j !== void 0 ? _j : this._llm.max_history }) : undefined;
671
+ ? Object.assign(Object.assign({}, this._llm), { system_messages: this._llm.system_messages !== undefined
672
+ ? this._llm.system_messages
673
+ : this._instructions
674
+ ? [{ role: "system", content: this._instructions }]
675
+ : undefined, greeting_message: (_e = this._llm.greeting_message) !== null && _e !== void 0 ? _e : this._greeting, greeting_configs: (_f = this._llm.greeting_configs) !== null && _f !== void 0 ? _f : this._greetingConfigs, failure_message: (_g = this._llm.failure_message) !== null && _g !== void 0 ? _g : this._failureMessage, max_history: (_h = this._llm.max_history) !== null && _h !== void 0 ? _h : this._maxHistory }) : undefined;
676
+ const turnDetectionConfig = this._resolveTurnDetectionConfig();
672
677
  const asrConfig = this._stt !== undefined || !allowMissingAsr
673
- ? this._resolveAsrConfig()
678
+ ? this._resolveAsrConfig(turnDetectionConfig)
674
679
  : undefined;
675
- const turnDetectionConfig = this._resolveTurnDetectionConfig();
676
680
  const ttsConfig = this._tts;
677
681
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, base), { turn_detection: turnDetectionConfig }), (llmConfig && { llm: llmConfig })), (ttsConfig && { tts: ttsConfig })), (asrConfig && { asr: asrConfig }));
678
682
  }
@@ -686,8 +690,7 @@ export class Agent {
686
690
  * If a new private field is added to Agent, it MUST also be added here.
687
691
  */
688
692
  _clone() {
689
- const newAgent = new Agent();
690
- newAgent._name = this._name;
693
+ const newAgent = new Agent({ client: this._client });
691
694
  newAgent._pipelineId = this._pipelineId;
692
695
  newAgent._llm = this._llm;
693
696
  newAgent._tts = this._tts;
@@ -710,23 +713,20 @@ export class Agent {
710
713
  newAgent._greetingConfigs = this._greetingConfigs;
711
714
  return newAgent;
712
715
  }
713
- _resolveAsrConfig() {
716
+ _resolveAsrConfig(turnDetectionConfig) {
714
717
  var _a;
715
718
  const asrConfig = Object.assign({}, ((_a = this._stt) !== null && _a !== void 0 ? _a : {}));
716
719
  if (this._stt === undefined) {
717
720
  asrConfig.vendor = "ares";
718
721
  }
719
- delete asrConfig.language;
722
+ asrConfig.language = turnDetectionConfig.language;
720
723
  return Object.keys(asrConfig).length > 0 ? asrConfig : undefined;
721
724
  }
722
725
  _resolveTurnDetectionConfig() {
723
- var _a, _b;
726
+ var _a;
724
727
  const turnDetection = Object.assign({}, ((_a = this._turnDetection) !== null && _a !== void 0 ? _a : {}));
725
728
  const existingTurnDetectionLanguage = turnDetection.language;
726
- const existingAsrLanguage = (_b = this._stt) === null || _b === void 0 ? void 0 : _b.language;
727
- const language = existingTurnDetectionLanguage !== null && existingTurnDetectionLanguage !== void 0 ? existingTurnDetectionLanguage : (existingAsrLanguage !== undefined && isTurnDetectionLanguage(existingAsrLanguage)
728
- ? existingAsrLanguage
729
- : DEFAULT_TURN_DETECTION_LANGUAGE);
729
+ const language = existingTurnDetectionLanguage !== null && existingTurnDetectionLanguage !== void 0 ? existingTurnDetectionLanguage : DEFAULT_TURN_DETECTION_LANGUAGE;
730
730
  assertTurnDetectionLanguage(language);
731
731
  turnDetection.language = language;
732
732
  return turnDetection;
@@ -4,10 +4,11 @@
4
4
  * This class provides a high-level interface for managing agent sessions,
5
5
  * including starting, stopping, and interacting with the agent.
6
6
  */
7
+ import type { AgoraClient } from "../AgoraPoolClient.mjs";
7
8
  import type { AgentManagementClient } from "../api/resources/agentManagement/client/Client.mjs";
8
9
  import type { AgentsClient } from "../api/resources/agents/client/Client.mjs";
9
- import type { AgoraClient } from "../Client.mjs";
10
10
  import type { Agent } from "./Agent.mjs";
11
+ import type { AgoraArea } from "./area.mjs";
11
12
  import { type PresetInput } from "./presets.mjs";
12
13
  import type { AgentConfigUpdate, ConversationHistory, ConversationTurns, GetTurnsOptions, SayOptions, SessionInfo, ThinkOptions, ThinkResponse } from "./types.mjs";
13
14
  /**
@@ -23,14 +24,14 @@ export type AgentSessionEventHandler<T = unknown> = (data: T) => void;
23
24
  */
24
25
  export interface AgentSessionOptions {
25
26
  /** The Agora client instance */
26
- client: AgoraClient;
27
+ client: AgoraClient<AgoraArea>;
27
28
  /** The agent configuration */
28
- agent: Agent;
29
+ agent: Agent<number, AgoraArea>;
29
30
  /** The App ID */
30
31
  appId: string;
31
32
  /** The App Certificate — enables automatic RTC token generation when starting sessions */
32
33
  appCertificate?: string;
33
- /** Unique name for this agent instance */
34
+ /** Unique agent instance name (set via {@link Agent.createSession}) */
34
35
  name: string;
35
36
  /** The channel to join */
36
37
  channel: string;
@@ -77,13 +78,14 @@ export interface AgentSessionOptions {
77
78
  * appCertificate: '...',
78
79
  * });
79
80
  *
80
- * const agent = new Agent({ name: 'support-assistant', instructions: 'You are a helpful voice assistant.' })
81
+ * const agent = new Agent({ client, instructions: 'You are a helpful voice assistant.' })
81
82
  * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4o-mini', url: 'https://api.openai.com/v1/chat/completions' }))
82
83
  * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
83
84
  * .withStt(new DeepgramSTT({ apiKey: '...', language: 'en-US' }));
84
85
  *
85
- * const session = agent.createSession(client, {
86
- * channel: 'support-room-123',
86
+ * const session = agent.createSession({
87
+ * name: `conversation-${Date.now()}`,
88
+ * channel: `demo-channel-${Date.now()}`,
87
89
  * agentUid: '1',
88
90
  * remoteUids: ['100'],
89
91
  * });
@@ -136,7 +138,7 @@ export declare class AgentSession {
136
138
  /**
137
139
  * The agent configuration.
138
140
  */
139
- get agent(): Agent;
141
+ get agent(): Agent<number, AgoraArea>;
140
142
  /**
141
143
  * The App ID for this session.
142
144
  */
@@ -183,7 +185,7 @@ export declare class AgentSession {
183
185
  * Fills session-derived avatar fields and generates avatar ConvoAI tokens.
184
186
  *
185
187
  * Token management is gated to vendors that publish a separate RTC video
186
- * identity (HeyGen, LiveAvatar, Generic). Other vendors (Akool, Anam) do
188
+ * identity (HeyGen, LiveAvatar, Generic, SenseTime). Other vendors (Akool, Anam) do
187
189
  * not run a separate publisher and never receive an auto-generated token.
188
190
  */
189
191
  private _enrichAvatarParams;
@@ -14,7 +14,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
14
14
  });
15
15
  };
16
16
  import { AgoraError } from "../errors/index.mjs";
17
- import { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.mjs";
17
+ import { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, isSensetimeAvatar, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.mjs";
18
18
  import { getPresetCategory, inferAsrPreset, inferLlmPreset, inferTtsPreset, normalizePresetInput, resolveSessionPresets, } from "./presets.mjs";
19
19
  import { ExpiresIn as ExpiresInHelper, generateConvoAIToken } from "./token.mjs";
20
20
  /**
@@ -32,13 +32,14 @@ import { ExpiresIn as ExpiresInHelper, generateConvoAIToken } from "./token.mjs"
32
32
  * appCertificate: '...',
33
33
  * });
34
34
  *
35
- * const agent = new Agent({ name: 'support-assistant', instructions: 'You are a helpful voice assistant.' })
35
+ * const agent = new Agent({ client, instructions: 'You are a helpful voice assistant.' })
36
36
  * .withLlm(new OpenAI({ apiKey: '...', model: 'gpt-4o-mini', url: 'https://api.openai.com/v1/chat/completions' }))
37
37
  * .withTts(new ElevenLabsTTS({ key: '...', modelId: '...', voiceId: '...', baseUrl: 'wss://api.elevenlabs.io/v1', sampleRate: 24000 }))
38
38
  * .withStt(new DeepgramSTT({ apiKey: '...', language: 'en-US' }));
39
39
  *
40
- * const session = agent.createSession(client, {
41
- * channel: 'support-room-123',
40
+ * const session = agent.createSession({
41
+ * name: `conversation-${Date.now()}`,
42
+ * channel: `demo-channel-${Date.now()}`,
42
43
  * agentUid: '1',
43
44
  * remoteUids: ['100'],
44
45
  * });
@@ -190,6 +191,7 @@ export class AgentSession {
190
191
  // are filled by `_enrichAvatarParams()` and validated separately.
191
192
  if (isHeyGenAvatar(strictAvatar) ||
192
193
  isLiveAvatarAvatar(strictAvatar) ||
194
+ isSensetimeAvatar(strictAvatar) ||
193
195
  isAkoolAvatar(strictAvatar) ||
194
196
  isAnamAvatar(strictAvatar) ||
195
197
  isGenericAvatar(strictAvatar)) {
@@ -225,7 +227,7 @@ export class AgentSession {
225
227
  * Fills session-derived avatar fields and generates avatar ConvoAI tokens.
226
228
  *
227
229
  * Token management is gated to vendors that publish a separate RTC video
228
- * identity (HeyGen, LiveAvatar, Generic). Other vendors (Akool, Anam) do
230
+ * identity (HeyGen, LiveAvatar, Generic, SenseTime). Other vendors (Akool, Anam) do
229
231
  * not run a separate publisher and never receive an auto-generated token.
230
232
  */
231
233
  _enrichAvatarParams(properties, expirySeconds) {
@@ -276,10 +278,13 @@ export class AgentSession {
276
278
  const strictAvatar = avatar;
277
279
  if (isHeyGenAvatar(strictAvatar) ||
278
280
  isLiveAvatarAvatar(strictAvatar) ||
281
+ isSensetimeAvatar(strictAvatar) ||
279
282
  isAkoolAvatar(strictAvatar) ||
280
283
  isAnamAvatar(strictAvatar) ||
281
284
  isGenericAvatar(strictAvatar)) {
282
- validateAvatarConfig(strictAvatar, { requireSessionFields: isGenericAvatar(strictAvatar) });
285
+ validateAvatarConfig(strictAvatar, {
286
+ requireSessionFields: isGenericAvatar(strictAvatar),
287
+ });
283
288
  }
284
289
  if (!isAvatarTokenManaged(strictAvatar)) {
285
290
  return;