agora-agents 2.5.0 → 2.6.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 (105) hide show
  1. package/dist/cjs/AgoraPoolClient.js +39 -1
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/agentkit/Agent.d.ts +6 -6
  4. package/dist/cjs/agentkit/Agent.js +4 -3
  5. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.js +26 -0
  6. package/dist/cjs/agentkit/index.d.ts +8 -8
  7. package/dist/cjs/agentkit/index.js +6 -2
  8. package/dist/cjs/agentkit/region-vendors.d.ts +3 -1
  9. package/dist/cjs/agentkit/types.d.ts +8 -4
  10. package/dist/cjs/agentkit/vendors/base.d.ts +11 -1
  11. package/dist/cjs/agentkit/vendors/base.js +18 -2
  12. package/dist/cjs/agentkit/vendors/cn.d.ts +8 -0
  13. package/dist/cjs/agentkit/vendors/cn.js +9 -3
  14. package/dist/cjs/agentkit/vendors/mllm.d.ts +99 -1
  15. package/dist/cjs/agentkit/vendors/mllm.js +68 -1
  16. package/dist/cjs/agentkit/vendors/stt.d.ts +15 -5
  17. package/dist/cjs/agentkit/vendors/stt.js +14 -7
  18. package/dist/cjs/agentkit/vendors/tts.d.ts +19 -0
  19. package/dist/cjs/agentkit/vendors/tts.js +16 -1
  20. package/dist/cjs/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.d.ts +9 -0
  21. package/dist/cjs/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.js +6 -0
  22. package/dist/cjs/api/resources/agents/client/Client.js +17 -1
  23. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +49 -4
  24. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +9 -0
  25. package/dist/cjs/api/types/AresAsr.d.ts +2 -0
  26. package/dist/cjs/api/types/AssemblyAiAsrParams.d.ts +1 -1
  27. package/dist/cjs/api/types/FengmingAsr.d.ts +3 -2
  28. package/dist/cjs/api/types/FengmingAsrParams.d.ts +4 -0
  29. package/dist/cjs/api/types/FengmingAsrParams.js +3 -0
  30. package/dist/cjs/api/types/Llm.d.ts +12 -0
  31. package/dist/cjs/api/types/LlmTool.d.ts +14 -0
  32. package/dist/cjs/api/types/LlmTool.js +3 -0
  33. package/dist/cjs/api/types/LlmToolExecution.d.ts +9 -0
  34. package/dist/cjs/api/types/LlmToolExecution.js +3 -0
  35. package/dist/cjs/api/types/LlmToolFunction.d.ts +28 -0
  36. package/dist/cjs/api/types/LlmToolFunction.js +3 -0
  37. package/dist/cjs/api/types/LlmToolServer.d.ts +42 -0
  38. package/dist/cjs/api/types/LlmToolServer.js +12 -0
  39. package/dist/cjs/api/types/Mllm.d.ts +4 -0
  40. package/dist/cjs/api/types/Mllm.js +2 -0
  41. package/dist/cjs/api/types/SpeechmaticsAsrParams.d.ts +12 -3
  42. package/dist/cjs/api/types/Tts.d.ts +4 -1
  43. package/dist/cjs/api/types/TypecastTts.d.ts +9 -0
  44. package/dist/cjs/api/types/TypecastTts.js +3 -0
  45. package/dist/cjs/api/types/TypecastTtsParams.d.ts +13 -0
  46. package/dist/cjs/api/types/TypecastTtsParams.js +3 -0
  47. package/dist/cjs/api/types/index.d.ts +7 -0
  48. package/dist/cjs/api/types/index.js +7 -0
  49. package/dist/cjs/index.d.ts +2 -2
  50. package/dist/cjs/index.js +7 -3
  51. package/dist/cjs/version.d.ts +1 -1
  52. package/dist/cjs/version.js +1 -1
  53. package/dist/esm/AgoraPoolClient.mjs +40 -2
  54. package/dist/esm/BaseClient.mjs +2 -2
  55. package/dist/esm/agentkit/Agent.d.mts +6 -6
  56. package/dist/esm/agentkit/Agent.mjs +4 -3
  57. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.mjs +26 -0
  58. package/dist/esm/agentkit/index.d.mts +8 -8
  59. package/dist/esm/agentkit/index.mjs +3 -3
  60. package/dist/esm/agentkit/region-vendors.d.mts +3 -1
  61. package/dist/esm/agentkit/types.d.mts +8 -4
  62. package/dist/esm/agentkit/vendors/base.d.mts +11 -1
  63. package/dist/esm/agentkit/vendors/base.mjs +16 -1
  64. package/dist/esm/agentkit/vendors/cn.d.mts +8 -0
  65. package/dist/esm/agentkit/vendors/cn.mjs +9 -3
  66. package/dist/esm/agentkit/vendors/mllm.d.mts +99 -1
  67. package/dist/esm/agentkit/vendors/mllm.mjs +66 -1
  68. package/dist/esm/agentkit/vendors/stt.d.mts +15 -5
  69. package/dist/esm/agentkit/vendors/stt.mjs +14 -7
  70. package/dist/esm/agentkit/vendors/tts.d.mts +19 -0
  71. package/dist/esm/agentkit/vendors/tts.mjs +14 -0
  72. package/dist/esm/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.d.mts +9 -0
  73. package/dist/esm/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.mjs +6 -0
  74. package/dist/esm/api/resources/agents/client/Client.mjs +17 -1
  75. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +49 -4
  76. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +9 -0
  77. package/dist/esm/api/types/AresAsr.d.mts +2 -0
  78. package/dist/esm/api/types/AssemblyAiAsrParams.d.mts +1 -1
  79. package/dist/esm/api/types/FengmingAsr.d.mts +3 -2
  80. package/dist/esm/api/types/FengmingAsrParams.d.mts +4 -0
  81. package/dist/esm/api/types/FengmingAsrParams.mjs +2 -0
  82. package/dist/esm/api/types/Llm.d.mts +12 -0
  83. package/dist/esm/api/types/LlmTool.d.mts +14 -0
  84. package/dist/esm/api/types/LlmTool.mjs +2 -0
  85. package/dist/esm/api/types/LlmToolExecution.d.mts +9 -0
  86. package/dist/esm/api/types/LlmToolExecution.mjs +2 -0
  87. package/dist/esm/api/types/LlmToolFunction.d.mts +28 -0
  88. package/dist/esm/api/types/LlmToolFunction.mjs +2 -0
  89. package/dist/esm/api/types/LlmToolServer.d.mts +42 -0
  90. package/dist/esm/api/types/LlmToolServer.mjs +9 -0
  91. package/dist/esm/api/types/Mllm.d.mts +4 -0
  92. package/dist/esm/api/types/Mllm.mjs +2 -0
  93. package/dist/esm/api/types/SpeechmaticsAsrParams.d.mts +12 -3
  94. package/dist/esm/api/types/Tts.d.mts +4 -1
  95. package/dist/esm/api/types/TypecastTts.d.mts +9 -0
  96. package/dist/esm/api/types/TypecastTts.mjs +2 -0
  97. package/dist/esm/api/types/TypecastTtsParams.d.mts +13 -0
  98. package/dist/esm/api/types/TypecastTtsParams.mjs +2 -0
  99. package/dist/esm/api/types/index.d.mts +7 -0
  100. package/dist/esm/api/types/index.mjs +7 -0
  101. package/dist/esm/index.d.mts +2 -2
  102. package/dist/esm/index.mjs +3 -3
  103. package/dist/esm/version.d.mts +1 -1
  104. package/dist/esm/version.mjs +1 -1
  105. package/package.json +1 -1
@@ -7,8 +7,18 @@
7
7
  * sets `mllm.enable: true`.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.XaiGrok = exports.VertexAI = exports.GeminiLive = exports.OpenAIRealtime = void 0;
10
+ exports.QwenOmni = exports.XaiGrok = exports.VertexAI = exports.GeminiLive = exports.AzureOpenAIRealtime = exports.OpenAIRealtime = void 0;
11
11
  const base_js_1 = require("./base.js");
12
+ function requireString(value, field, vendor) {
13
+ if (typeof value !== "string" || value.length === 0) {
14
+ throw new Error(`${vendor} requires ${field}`);
15
+ }
16
+ }
17
+ function requireObject(value, field, vendor) {
18
+ if (value == null || typeof value !== "object" || Array.isArray(value)) {
19
+ throw new Error(`${vendor} requires ${field}`);
20
+ }
21
+ }
12
22
  /**
13
23
  * OpenAI Realtime API MLLM vendor.
14
24
  *
@@ -43,6 +53,36 @@ class OpenAIRealtime extends base_js_1.BaseMLLM {
43
53
  }
44
54
  }
45
55
  exports.OpenAIRealtime = OpenAIRealtime;
56
+ /**
57
+ * Azure OpenAI Realtime MLLM vendor for global deployments.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const agent = new Agent({ client }).withMllm(new AzureOpenAIRealtime({
62
+ * apiKey: process.env.AZURE_OPENAI_API_KEY,
63
+ * url: 'wss://example.openai.azure.com/openai/realtime',
64
+ * model: 'gpt-4o-realtime-preview',
65
+ * maxHistory: 32,
66
+ * turnDetection: { mode: 'server_vad' },
67
+ * }));
68
+ * ```
69
+ */
70
+ class AzureOpenAIRealtime extends base_js_1.BaseMLLM {
71
+ constructor(options) {
72
+ super();
73
+ requireString(options.apiKey, "apiKey", "AzureOpenAIRealtime");
74
+ requireString(options.url, "url", "AzureOpenAIRealtime");
75
+ requireObject(options.turnDetection, "turnDetection", "AzureOpenAIRealtime");
76
+ this.options = options;
77
+ }
78
+ toConfig() {
79
+ const { apiKey, url, model, voice, instructions, maxHistory, greetingMessage, outputModalities, messages, params, turnDetection, } = this.options;
80
+ const mergedParams = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ((params === null || params === void 0 ? void 0 : params.model) !== undefined && { model: params.model })), ((params === null || params === void 0 ? void 0 : params.voice) !== undefined && { voice: params.voice })), ((params === null || params === void 0 ? void 0 : params.instructions) !== undefined && { instructions: params.instructions })), (model !== undefined && { model })), (voice !== undefined && { voice })), (instructions !== undefined && { instructions }));
81
+ const hasParams = Object.keys(mergedParams).length > 0;
82
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "azure", api_key: apiKey, url }, (hasParams && { params: mergedParams })), (maxHistory !== undefined && { max_history: maxHistory })), (greetingMessage && { greeting_message: greetingMessage })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), { turn_detection: turnDetection });
83
+ }
84
+ }
85
+ exports.AzureOpenAIRealtime = AzureOpenAIRealtime;
46
86
  /**
47
87
  * Google Gemini Live MLLM vendor (direct API, non-Vertex AI).
48
88
  *
@@ -132,3 +172,30 @@ class XaiGrok extends base_js_1.BaseMLLM {
132
172
  }
133
173
  }
134
174
  exports.XaiGrok = XaiGrok;
175
+ /**
176
+ * Alibaba Cloud Qwen Omni Realtime MLLM vendor for Chinese mainland deployments.
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * const agent = new Agent({ client }).withMllm(new QwenOmni({
181
+ * apiKey: process.env.DASHSCOPE_API_KEY,
182
+ * model: 'qwen3.5-omni-plus-realtime',
183
+ * url: 'wss://dashscope.aliyuncs.com/api-ws/v1/realtime',
184
+ * greetingMessage: '你好,有什么可以帮你?',
185
+ * }));
186
+ * ```
187
+ */
188
+ class QwenOmni extends base_js_1.BaseCNMLLM {
189
+ constructor(options) {
190
+ super();
191
+ requireString(options.apiKey, "apiKey", "QwenOmni");
192
+ requireString(options.model, "model", "QwenOmni");
193
+ requireString(options.url, "url", "QwenOmni");
194
+ this.options = options;
195
+ }
196
+ toConfig() {
197
+ const { apiKey, model, url, voice, instructions, greetingMessage, failureMessage, inputModalities, outputModalities, messages, params, turnDetection, } = this.options;
198
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "qwen_omni", api_key: apiKey, url, params: Object.assign(Object.assign(Object.assign(Object.assign({}, params), { model }), (voice !== undefined && { voice })), (instructions !== undefined && { instructions })) }, (greetingMessage && { greeting_message: greetingMessage })), (failureMessage && { failure_message: failureMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (messages && { messages })), (turnDetection && { turn_detection: turnDetection }));
199
+ }
200
+ }
201
+ exports.QwenOmni = QwenOmni;
@@ -7,9 +7,7 @@ import { BaseSTT } from "./base.js";
7
7
  /**
8
8
  * Constructor options for Speechmatics STT.
9
9
  */
10
- export interface SpeechmaticsSTTOptions {
11
- /** Speechmatics API key */
12
- apiKey: string;
10
+ interface SpeechmaticsSTTCommonOptions {
13
11
  /** Language code (e.g., 'en', 'es', 'fr') */
14
12
  language: string;
15
13
  /** Model name */
@@ -19,13 +17,23 @@ export interface SpeechmaticsSTTOptions {
19
17
  /** Additional vendor-specific parameters */
20
18
  additionalParams?: Record<string, unknown>;
21
19
  }
20
+ export type SpeechmaticsSTTOptions = SpeechmaticsSTTCommonOptions & ({
21
+ /** Speechmatics API key */
22
+ key: string;
23
+ /** @deprecated Use `key` instead. This alias is normalized to the REST API's `key` field. */
24
+ apiKey?: string;
25
+ } | {
26
+ key?: undefined;
27
+ /** @deprecated Use `key` instead. This alias is normalized to the REST API's `key` field. */
28
+ apiKey: string;
29
+ });
22
30
  /**
23
31
  * Speechmatics STT vendor.
24
32
  *
25
33
  * @example
26
34
  * ```typescript
27
35
  * const stt = new SpeechmaticsSTT({
28
- * apiKey: process.env.SPEECHMATICS_API_KEY,
36
+ * key: process.env.SPEECHMATICS_API_KEY,
29
37
  * language: 'en',
30
38
  * });
31
39
  * ```
@@ -216,7 +224,7 @@ export interface AssemblyAISTTOptions {
216
224
  /** Language code */
217
225
  language: string;
218
226
  /** AssemblyAI streaming WebSocket URL */
219
- uri?: string;
227
+ ws_url?: string;
220
228
  /** Additional vendor-specific parameters */
221
229
  additionalParams?: Record<string, unknown>;
222
230
  }
@@ -240,6 +248,8 @@ export declare class AssemblyAISTT extends BaseSTT {
240
248
  * Constructor options for Agora ARES STT.
241
249
  */
242
250
  export interface AresSTTOptions {
251
+ /** Hotwords that improve recognition accuracy */
252
+ keywords?: string[];
243
253
  /** Additional vendor-specific parameters */
244
254
  additionalParams?: Record<string, unknown>;
245
255
  }
@@ -20,7 +20,7 @@ function isDeepgramManagedModel(model) {
20
20
  * @example
21
21
  * ```typescript
22
22
  * const stt = new SpeechmaticsSTT({
23
- * apiKey: process.env.SPEECHMATICS_API_KEY,
23
+ * key: process.env.SPEECHMATICS_API_KEY,
24
24
  * language: 'en',
25
25
  * });
26
26
  * ```
@@ -31,10 +31,14 @@ class SpeechmaticsSTT extends base_js_1.BaseSTT {
31
31
  this.options = options;
32
32
  }
33
33
  toConfig() {
34
- const { apiKey, language, model, uri, additionalParams } = this.options;
34
+ const { key, apiKey, language, model, uri, additionalParams } = this.options;
35
+ const wireKey = key !== null && key !== void 0 ? key : apiKey;
36
+ _requireString(wireKey, "key", "SpeechmaticsSTT");
37
+ const params = Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { key: wireKey, language }), (model !== undefined && { model })), (uri !== undefined && { uri }));
38
+ delete params.api_key;
35
39
  return {
36
40
  vendor: "speechmatics",
37
- params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, language }), (model !== undefined && { model })), (uri !== undefined && { uri })),
41
+ params,
38
42
  };
39
43
  }
40
44
  }
@@ -197,10 +201,10 @@ class AssemblyAISTT extends base_js_1.BaseSTT {
197
201
  this.options = options;
198
202
  }
199
203
  toConfig() {
200
- const { apiKey, language, uri, additionalParams } = this.options;
204
+ const { apiKey, language, ws_url, additionalParams } = this.options;
201
205
  return {
202
206
  vendor: "assemblyai",
203
- params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (language && { language })), (uri && { uri })),
207
+ params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (language && { language })), (ws_url && { ws_url })),
204
208
  };
205
209
  }
206
210
  }
@@ -219,8 +223,11 @@ class AresSTT extends base_js_1.BaseSTT {
219
223
  this.options = options;
220
224
  }
221
225
  toConfig() {
222
- const { additionalParams } = this.options;
223
- return Object.assign({ vendor: "ares" }, (additionalParams && Object.keys(additionalParams).length > 0 && { params: additionalParams }));
226
+ const { keywords, additionalParams } = this.options;
227
+ const hasParams = keywords !== undefined || (additionalParams !== undefined && Object.keys(additionalParams).length > 0);
228
+ return Object.assign({ vendor: "ares" }, (hasParams && {
229
+ params: Object.assign(Object.assign({}, additionalParams), (keywords !== undefined && { keywords })),
230
+ }));
224
231
  }
225
232
  }
226
233
  exports.AresSTT = AresSTT;
@@ -322,6 +322,25 @@ export declare class MistralTTS extends BaseTTS {
322
322
  constructor(options: MistralTTSOptions);
323
323
  toConfig(): TtsConfig;
324
324
  }
325
+ /** Constructor options for Typecast TTS. */
326
+ export interface TypecastTTSOptions {
327
+ /** Typecast API key */
328
+ apiKey: string;
329
+ /** Typecast voice identifier */
330
+ voiceId: string;
331
+ /** Typecast TTS model name (e.g., 'ssfm-v30') */
332
+ model: string;
333
+ /** Additional vendor-specific parameters */
334
+ additionalParams?: Record<string, unknown>;
335
+ /** Skip patterns for bracketed content */
336
+ skipPatterns?: number[];
337
+ }
338
+ /** Typecast TTS vendor. */
339
+ export declare class TypecastTTS extends BaseTTS {
340
+ private readonly options;
341
+ constructor(options: TypecastTTSOptions);
342
+ toConfig(): TtsConfig;
343
+ }
325
344
  /**
326
345
  * Constructor options for Hume AI TTS.
327
346
  */
@@ -3,7 +3,7 @@
3
3
  * Type-safe TTS (Text-to-Speech) vendor classes.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.XAiTTS = exports.GenericTTS = exports.MurfTTS = exports.SarvamTTS = exports.MiniMaxTTS = exports.FishAudioTTS = exports.RimeTTS = exports.HumeAITTS = exports.MistralTTS = exports.GradiumTTS = exports.DeepgramTTS = exports.AmazonTTS = exports.GoogleTTS = exports.CartesiaTTS = exports.OpenAITTS = exports.MicrosoftTTS = exports.ElevenLabsTTS = void 0;
6
+ exports.XAiTTS = exports.GenericTTS = exports.MurfTTS = exports.SarvamTTS = exports.MiniMaxTTS = exports.FishAudioTTS = exports.RimeTTS = exports.HumeAITTS = exports.TypecastTTS = exports.MistralTTS = exports.GradiumTTS = exports.DeepgramTTS = exports.AmazonTTS = exports.GoogleTTS = exports.CartesiaTTS = exports.OpenAITTS = exports.MicrosoftTTS = exports.ElevenLabsTTS = void 0;
7
7
  const constants_js_1 = require("../constants.js");
8
8
  const presets_js_1 = require("../presets.js");
9
9
  const base_js_1 = require("./base.js");
@@ -223,6 +223,21 @@ class MistralTTS extends base_js_1.BaseTTS {
223
223
  }
224
224
  }
225
225
  exports.MistralTTS = MistralTTS;
226
+ /** Typecast TTS vendor. */
227
+ class TypecastTTS extends base_js_1.BaseTTS {
228
+ constructor(options) {
229
+ super();
230
+ requireString(options.apiKey, "apiKey", "TypecastTTS");
231
+ requireString(options.voiceId, "voiceId", "TypecastTTS");
232
+ requireString(options.model, "model", "TypecastTTS");
233
+ this.options = options;
234
+ }
235
+ toConfig() {
236
+ const { apiKey, voiceId, model, additionalParams, skipPatterns } = this.options;
237
+ return Object.assign({ vendor: "typecast", params: Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, voice_id: voiceId, model }) }, (skipPatterns && { skip_patterns: skipPatterns }));
238
+ }
239
+ }
240
+ exports.TypecastTTS = TypecastTTS;
226
241
  /**
227
242
  * Hume AI TTS vendor.
228
243
  *
@@ -26,18 +26,21 @@ export interface AgentThinkAgentManagementRequest {
26
26
  * - `inject`: Inject the custom text instruction into the current turn without interrupting it.
27
27
  * - `interrupt`: Immediately interrupt the current flow and initiate a new round of dialogue.
28
28
  * - `ignore`: Ignore the request.
29
+ * - `append`: Do not interrupt the user. Wait for the user's ASR text to be sent to the LLM and for the resulting response to finish, then send the custom text instruction to the LLM.
29
30
  */
30
31
  on_listening_action?: AgentThinkAgentManagementRequest.OnListeningAction;
31
32
  /**
32
33
  * The action to take when the agent is in a thinking state:
33
34
  * - `interrupt`: Interrupt the current state and start a new conversation turn.
34
35
  * - `ignore`: Ignore the request.
36
+ * - `append`: Do not interrupt the current LLM inference. Allow the current turn to finish generating and playing its response first. After the current turn's LLM output is complete, send the queued custom text instruction to the LLM.
35
37
  */
36
38
  on_thinking_action?: AgentThinkAgentManagementRequest.OnThinkingAction;
37
39
  /**
38
40
  * The action to take when the agent is in a speaking state:
39
41
  * - `interrupt`: Interrupt the current state and start a new conversation turn.
40
42
  * - `ignore`: Ignore the request.
43
+ * - `append`: Do not interrupt the current TTS playback; the audio stream continues. After the current turn's LLM output is complete, send the custom text instruction directly to the LLM.
41
44
  */
42
45
  on_speaking_action?: AgentThinkAgentManagementRequest.OnSpeakingAction;
43
46
  /**
@@ -55,31 +58,37 @@ export declare namespace AgentThinkAgentManagementRequest {
55
58
  * - `inject`: Inject the custom text instruction into the current turn without interrupting it.
56
59
  * - `interrupt`: Immediately interrupt the current flow and initiate a new round of dialogue.
57
60
  * - `ignore`: Ignore the request.
61
+ * - `append`: Do not interrupt the user. Wait for the user's ASR text to be sent to the LLM and for the resulting response to finish, then send the custom text instruction to the LLM.
58
62
  */
59
63
  const OnListeningAction: {
60
64
  readonly Inject: "inject";
61
65
  readonly Interrupt: "interrupt";
62
66
  readonly Ignore: "ignore";
67
+ readonly Append: "append";
63
68
  };
64
69
  type OnListeningAction = (typeof OnListeningAction)[keyof typeof OnListeningAction];
65
70
  /**
66
71
  * The action to take when the agent is in a thinking state:
67
72
  * - `interrupt`: Interrupt the current state and start a new conversation turn.
68
73
  * - `ignore`: Ignore the request.
74
+ * - `append`: Do not interrupt the current LLM inference. Allow the current turn to finish generating and playing its response first. After the current turn's LLM output is complete, send the queued custom text instruction to the LLM.
69
75
  */
70
76
  const OnThinkingAction: {
71
77
  readonly Interrupt: "interrupt";
72
78
  readonly Ignore: "ignore";
79
+ readonly Append: "append";
73
80
  };
74
81
  type OnThinkingAction = (typeof OnThinkingAction)[keyof typeof OnThinkingAction];
75
82
  /**
76
83
  * The action to take when the agent is in a speaking state:
77
84
  * - `interrupt`: Interrupt the current state and start a new conversation turn.
78
85
  * - `ignore`: Ignore the request.
86
+ * - `append`: Do not interrupt the current TTS playback; the audio stream continues. After the current turn's LLM output is complete, send the custom text instruction directly to the LLM.
79
87
  */
80
88
  const OnSpeakingAction: {
81
89
  readonly Interrupt: "interrupt";
82
90
  readonly Ignore: "ignore";
91
+ readonly Append: "append";
83
92
  };
84
93
  type OnSpeakingAction = (typeof OnSpeakingAction)[keyof typeof OnSpeakingAction];
85
94
  }
@@ -9,28 +9,34 @@ var AgentThinkAgentManagementRequest;
9
9
  * - `inject`: Inject the custom text instruction into the current turn without interrupting it.
10
10
  * - `interrupt`: Immediately interrupt the current flow and initiate a new round of dialogue.
11
11
  * - `ignore`: Ignore the request.
12
+ * - `append`: Do not interrupt the user. Wait for the user's ASR text to be sent to the LLM and for the resulting response to finish, then send the custom text instruction to the LLM.
12
13
  */
13
14
  AgentThinkAgentManagementRequest.OnListeningAction = {
14
15
  Inject: "inject",
15
16
  Interrupt: "interrupt",
16
17
  Ignore: "ignore",
18
+ Append: "append",
17
19
  };
18
20
  /**
19
21
  * The action to take when the agent is in a thinking state:
20
22
  * - `interrupt`: Interrupt the current state and start a new conversation turn.
21
23
  * - `ignore`: Ignore the request.
24
+ * - `append`: Do not interrupt the current LLM inference. Allow the current turn to finish generating and playing its response first. After the current turn's LLM output is complete, send the queued custom text instruction to the LLM.
22
25
  */
23
26
  AgentThinkAgentManagementRequest.OnThinkingAction = {
24
27
  Interrupt: "interrupt",
25
28
  Ignore: "ignore",
29
+ Append: "append",
26
30
  };
27
31
  /**
28
32
  * The action to take when the agent is in a speaking state:
29
33
  * - `interrupt`: Interrupt the current state and start a new conversation turn.
30
34
  * - `ignore`: Ignore the request.
35
+ * - `append`: Do not interrupt the current TTS playback; the audio stream continues. After the current turn's LLM output is complete, send the custom text instruction directly to the LLM.
31
36
  */
32
37
  AgentThinkAgentManagementRequest.OnSpeakingAction = {
33
38
  Interrupt: "interrupt",
34
39
  Ignore: "ignore",
40
+ Append: "append",
35
41
  };
36
42
  })(AgentThinkAgentManagementRequest || (exports.AgentThinkAgentManagementRequest = AgentThinkAgentManagementRequest = {}));
@@ -60,6 +60,21 @@ const headers_js_1 = require("../../../../core/headers.js");
60
60
  const core = __importStar(require("../../../../core/index.js"));
61
61
  const environments = __importStar(require("../../../../environments.js"));
62
62
  const errors = __importStar(require("../../../../errors/index.js"));
63
+ function normalizeSpeechmaticsCredential(body) {
64
+ var _a;
65
+ const asr = body.properties.asr;
66
+ if ((asr === null || asr === void 0 ? void 0 : asr.vendor) !== "speechmatics" || asr.params == null) {
67
+ return body;
68
+ }
69
+ const params = asr.params;
70
+ const wireKey = (_a = params.key) !== null && _a !== void 0 ? _a : params.api_key;
71
+ if (wireKey === undefined) {
72
+ return body;
73
+ }
74
+ const normalizedParams = Object.assign(Object.assign({}, params), { key: wireKey });
75
+ delete normalizedParams.api_key;
76
+ return Object.assign(Object.assign({}, body), { properties: Object.assign(Object.assign({}, body.properties), { asr: Object.assign(Object.assign({}, asr), { params: normalizedParams }) }) });
77
+ }
63
78
  class AgentsClient {
64
79
  constructor(options) {
65
80
  this._options = (0, BaseClient_js_1.normalizeClientOptions)(options);
@@ -124,6 +139,7 @@ class AgentsClient {
124
139
  return __awaiter(this, void 0, void 0, function* () {
125
140
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
126
141
  const { appid } = request, _body = __rest(request, ["appid"]);
142
+ const _normalizedBody = normalizeSpeechmaticsCredential(_body);
127
143
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({ Authorization: yield this._getAuthorizationHeader() }, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
128
144
  const _response = yield core.fetcher({
129
145
  url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgoraEnvironment.Default, `v2/projects/${core.url.encodePathParam(appid)}/join`),
@@ -132,7 +148,7 @@ class AgentsClient {
132
148
  contentType: "application/json",
133
149
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
134
150
  requestType: "json",
135
- body: _body,
151
+ body: _normalizedBody,
136
152
  timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
137
153
  maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
138
154
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -111,7 +111,10 @@ export declare namespace StartAgentsRequest {
111
111
  labels?: Record<string, string>;
112
112
  /** RTC media encryption configuration. */
113
113
  rtc?: Properties.Rtc;
114
- /** Filler word configuration. Plays filler words while waiting for LLM responses to reduce user anxiety and improve conversation flow. */
114
+ /**
115
+ * Filler word configuration. Plays filler words while waiting for LLM responses to reduce user anxiety and improve conversation flow.
116
+ * When `enable` is `true`, `content.static_config.phrases` must be present and non-empty, even when `content.mode` is `generated`, because generated mode still falls back to static filler words.
117
+ */
115
118
  filler_words?: Properties.FillerWords;
116
119
  /** Agent configuration parameters. */
117
120
  parameters?: Properties.Parameters;
@@ -566,6 +569,7 @@ export declare namespace StartAgentsRequest {
566
569
  }
567
570
  /**
568
571
  * Filler word configuration. Plays filler words while waiting for LLM responses to reduce user anxiety and improve conversation flow.
572
+ * When `enable` is `true`, `content.static_config.phrases` must be present and non-empty, even when `content.mode` is `generated`, because generated mode still falls back to static filler words.
569
573
  */
570
574
  interface FillerWords {
571
575
  /**
@@ -608,14 +612,31 @@ export declare namespace StartAgentsRequest {
608
612
  /**
609
613
  * Filler word content mode:
610
614
  * - `static`: Static filler words. Uses a predefined list of filler words.
615
+ * - `generated`: LLM-generated filler words based on the last user message. Falls back to static filler words when generation is not ready, fails, or returns empty text.
616
+ */
617
+ mode?: Content.Mode;
618
+ /**
619
+ * Static filler word configuration. Required when `mode` is `static`.
620
+ * Also required whenever `filler_words.enable` is `true`, including when `mode` is `generated`, because generated mode uses static filler words as fallback.
611
621
  */
612
- mode?: "static";
613
- /** Static filler word configuration. Used when `mode` is `static`. */
614
622
  static_config?: Content.StaticConfig;
623
+ /** Generated filler word configuration. Required when `content.mode` is `generated`. */
624
+ generated_config?: Content.GeneratedConfig;
615
625
  }
616
626
  namespace Content {
617
627
  /**
618
- * Static filler word configuration. Used when `mode` is `static`.
628
+ * Filler word content mode:
629
+ * - `static`: Static filler words. Uses a predefined list of filler words.
630
+ * - `generated`: LLM-generated filler words based on the last user message. Falls back to static filler words when generation is not ready, fails, or returns empty text.
631
+ */
632
+ const Mode: {
633
+ readonly Static: "static";
634
+ readonly Generated: "generated";
635
+ };
636
+ type Mode = (typeof Mode)[keyof typeof Mode];
637
+ /**
638
+ * Static filler word configuration. Required when `mode` is `static`.
639
+ * Also required whenever `filler_words.enable` is `true`, including when `mode` is `generated`, because generated mode uses static filler words as fallback.
619
640
  */
620
641
  interface StaticConfig {
621
642
  /** List of filler word phrases. Maximum 100 filler words, each not exceeding 50 English words. */
@@ -639,6 +660,30 @@ export declare namespace StartAgentsRequest {
639
660
  };
640
661
  type SelectionRule = (typeof SelectionRule)[keyof typeof SelectionRule];
641
662
  }
663
+ /**
664
+ * Generated filler word configuration. Required when `content.mode` is `generated`.
665
+ */
666
+ interface GeneratedConfig {
667
+ /** OpenAI-compatible LLM provider used to generate filler words. Runs in parallel with the main business LLM and only uses the last user message as input. */
668
+ llm_provider: GeneratedConfig.LlmProvider;
669
+ /** System prompt used to generate a short filler phrase based on the last user message. The generated text should be conversational and must not answer the user's question. */
670
+ prompt: string;
671
+ /** Fallback strategy when generated filler text is not ready, fails, or returns empty text. Phase 1 only supports `static`. */
672
+ fallback_strategy: "static";
673
+ }
674
+ namespace GeneratedConfig {
675
+ /**
676
+ * OpenAI-compatible LLM provider used to generate filler words. Runs in parallel with the main business LLM and only uses the last user message as input.
677
+ */
678
+ interface LlmProvider {
679
+ /** Base URL of the OpenAI-compatible chat completions endpoint. If the URL does not end with `/chat/completions`, the engine appends it automatically. */
680
+ base_url: string;
681
+ /** API key for authenticating requests to the filler LLM provider. */
682
+ api_key: string;
683
+ /** Additional request parameters merged into the generated filler LLM request body, such as `model`. */
684
+ params?: Record<string, unknown>;
685
+ }
686
+ }
642
687
  }
643
688
  }
644
689
  /**
@@ -187,6 +187,15 @@ var StartAgentsRequest;
187
187
  (function (FillerWords) {
188
188
  let Content;
189
189
  (function (Content) {
190
+ /**
191
+ * Filler word content mode:
192
+ * - `static`: Static filler words. Uses a predefined list of filler words.
193
+ * - `generated`: LLM-generated filler words based on the last user message. Falls back to static filler words when generation is not ready, fails, or returns empty text.
194
+ */
195
+ Content.Mode = {
196
+ Static: "static",
197
+ Generated: "generated",
198
+ };
190
199
  let StaticConfig;
191
200
  (function (StaticConfig) {
192
201
  /**
@@ -4,6 +4,8 @@ import type * as Agora from "../index.js";
4
4
  */
5
5
  export interface AresAsr {
6
6
  language?: Agora.AsrLanguage;
7
+ /** A list of hotwords to improve ASR accuracy. */
8
+ keywords?: string[];
7
9
  params?: Agora.AresAsrParams;
8
10
  /** Accepts any additional properties */
9
11
  [key: string]: any;
@@ -7,7 +7,7 @@ export interface AssemblyAiAsrParams {
7
7
  /** Language code for speech recognition */
8
8
  language: string;
9
9
  /** WebSocket URL for AssemblyAI's streaming API */
10
- uri?: string | null;
10
+ ws_url?: string | null;
11
11
  /** Accepts any additional properties */
12
12
  [key: string]: any;
13
13
  }
@@ -4,8 +4,9 @@ import type * as Agora from "../index.js";
4
4
  */
5
5
  export interface FengmingAsr {
6
6
  language?: Agora.AsrLanguage;
7
- /** Agora Fengming ASR configuration parameters. */
8
- params?: Record<string, unknown>;
7
+ /** A list of hotwords to improve ASR accuracy. */
8
+ keywords?: string[];
9
+ params?: Agora.FengmingAsrParams;
9
10
  /** Accepts any additional properties */
10
11
  [key: string]: any;
11
12
  }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Agora Fengming ASR configuration parameters.
3
+ */
4
+ export type FengmingAsrParams = Record<string, unknown>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -42,6 +42,18 @@ export interface Llm {
42
42
  template_variables?: Record<string, string>;
43
43
  /** MCP server configuration. */
44
44
  mcp_servers?: Record<string, unknown>[];
45
+ /**
46
+ * Inline REST (pass-through sync) tool definitions for standard text LLM function calling.
47
+ * Required fields per tool: `type`, `function.name`, `function.parameters`
48
+ * (`type: object` with `properties`), `server.method` (`GET` or `POST`), and `server.url`.
49
+ * The combination of `type: function` and `server` identifies a REST tool.
50
+ * Phase 1a supports GET and POST only; `execution.mode` defaults to and only accepts `sync`.
51
+ * Template rules:
52
+ * - Values must be a constant, or exactly one single-level placeholder.
53
+ * - `{{args.<name>}}`: `server.url` and `server.body` only; not allowed in headers.
54
+ * - `{{template_variables.<name>}}` and `{{tool_call_id}}`: `server.url`, `server.headers`, and `server.body`.
55
+ */
56
+ tools?: Agora.LlmTool[];
45
57
  /** Custom headers to include in requests to the LLM. */
46
58
  headers?: Record<string, string>;
47
59
  /** Accepts any additional properties */
@@ -0,0 +1,14 @@
1
+ import type * as Agora from "../index.js";
2
+ /**
3
+ * Inline REST tool definition. `type: function` combined with `server` declares a REST tool.
4
+ * Phase 1a executes the HTTP request synchronously and returns the raw result to the model context.
5
+ */
6
+ export interface LlmTool {
7
+ /** Tool type. Must be `function`. */
8
+ type: "function";
9
+ function: Agora.LlmToolFunction;
10
+ execution?: Agora.LlmToolExecution;
11
+ server: Agora.LlmToolServer;
12
+ /** Accepts any additional properties */
13
+ [key: string]: any;
14
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tool execution configuration. Defaults to `{"mode": "sync"}`. Phase 1a only allows `sync`.
3
+ */
4
+ export interface LlmToolExecution {
5
+ /** Execution mode. Phase 1a only accepts `sync`. */
6
+ mode?: "sync";
7
+ /** Accepts any additional properties */
8
+ [key: string]: any;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Tool interface exposed to the model. `parameters` defines LLM arguments, not the HTTP request shape.
3
+ */
4
+ export interface LlmToolFunction {
5
+ /** Function name visible to the model. Used as the REST tool index key (ASCII case-insensitive). */
6
+ name: string;
7
+ /** Function description visible to the model. */
8
+ description?: string;
9
+ /** JSON Schema defining the LLM tool-call arguments (`args`). Must be an object schema with `type: object` and `properties`. */
10
+ parameters: LlmToolFunction.Parameters;
11
+ /** Accepts any additional properties */
12
+ [key: string]: any;
13
+ }
14
+ export declare namespace LlmToolFunction {
15
+ /**
16
+ * JSON Schema defining the LLM tool-call arguments (`args`). Must be an object schema with `type: object` and `properties`.
17
+ */
18
+ interface Parameters {
19
+ /** JSON Schema type. Must be `object`. */
20
+ type: "object";
21
+ /** Argument property definitions keyed by argument name. */
22
+ properties: Record<string, unknown>;
23
+ /** List of required argument names. */
24
+ required?: string[];
25
+ /** Accepts any additional properties */
26
+ [key: string]: any;
27
+ }
28
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });