retell-sdk 4.59.0 → 4.61.0

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.
@@ -0,0 +1,1099 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import { isRequestOptions } from '../core';
5
+ import * as Core from '../core';
6
+
7
+ export class ChatAgent extends APIResource {
8
+ /**
9
+ * Create a new chat agent
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const chatAgentResponse = await client.chatAgent.create({
14
+ * response_engine: {
15
+ * llm_id: 'llm_234sdertfsdsfsdf',
16
+ * type: 'retell-llm',
17
+ * },
18
+ * });
19
+ * ```
20
+ */
21
+ create(body: ChatAgentCreateParams, options?: Core.RequestOptions): Core.APIPromise<ChatAgentResponse> {
22
+ return this._client.post('/create-chat-agent', { body, ...options });
23
+ }
24
+
25
+ /**
26
+ * Retrieve details of a specific chat agent
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const chatAgentResponse = await client.chatAgent.retrieve(
31
+ * '16b980523634a6dc504898cda492e939',
32
+ * );
33
+ * ```
34
+ */
35
+ retrieve(
36
+ agentId: string,
37
+ query?: ChatAgentRetrieveParams,
38
+ options?: Core.RequestOptions,
39
+ ): Core.APIPromise<ChatAgentResponse>;
40
+ retrieve(agentId: string, options?: Core.RequestOptions): Core.APIPromise<ChatAgentResponse>;
41
+ retrieve(
42
+ agentId: string,
43
+ query: ChatAgentRetrieveParams | Core.RequestOptions = {},
44
+ options?: Core.RequestOptions,
45
+ ): Core.APIPromise<ChatAgentResponse> {
46
+ if (isRequestOptions(query)) {
47
+ return this.retrieve(agentId, {}, query);
48
+ }
49
+ return this._client.get(`/get-chat-agent/${agentId}`, { query, ...options });
50
+ }
51
+
52
+ /**
53
+ * Update an existing chat agent
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const chatAgentResponse = await client.chatAgent.update(
58
+ * '16b980523634a6dc504898cda492e939',
59
+ * );
60
+ * ```
61
+ */
62
+ update(
63
+ agentId: string,
64
+ params: ChatAgentUpdateParams,
65
+ options?: Core.RequestOptions,
66
+ ): Core.APIPromise<ChatAgentResponse> {
67
+ const { version, ...body } = params;
68
+ return this._client.patch(`/update-chat-agent/${agentId}`, { query: { version }, body, ...options });
69
+ }
70
+
71
+ /**
72
+ * List all chat agents
73
+ *
74
+ * @example
75
+ * ```ts
76
+ * const chatAgentResponses = await client.chatAgent.list();
77
+ * ```
78
+ */
79
+ list(query?: ChatAgentListParams, options?: Core.RequestOptions): Core.APIPromise<ChatAgentListResponse>;
80
+ list(options?: Core.RequestOptions): Core.APIPromise<ChatAgentListResponse>;
81
+ list(
82
+ query: ChatAgentListParams | Core.RequestOptions = {},
83
+ options?: Core.RequestOptions,
84
+ ): Core.APIPromise<ChatAgentListResponse> {
85
+ if (isRequestOptions(query)) {
86
+ return this.list({}, query);
87
+ }
88
+ return this._client.get('/list-chat-agents', { query, ...options });
89
+ }
90
+
91
+ /**
92
+ * Delete an existing chat agent
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * await client.chatAgent.delete(
97
+ * 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
98
+ * );
99
+ * ```
100
+ */
101
+ delete(agentId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
102
+ return this._client.delete(`/delete-chat-agent/${agentId}`, {
103
+ ...options,
104
+ headers: { Accept: '*/*', ...options?.headers },
105
+ });
106
+ }
107
+
108
+ /**
109
+ * Get all versions of a chat agent
110
+ *
111
+ * @example
112
+ * ```ts
113
+ * const chatAgentResponses =
114
+ * await client.chatAgent.getVersions(
115
+ * '16b980523634a6dc504898cda492e939',
116
+ * );
117
+ * ```
118
+ */
119
+ getVersions(agentId: string, options?: Core.RequestOptions): Core.APIPromise<ChatAgentGetVersionsResponse> {
120
+ return this._client.get(`/get-chat-agent-versions/${agentId}`, options);
121
+ }
122
+
123
+ /**
124
+ * Publish the latest version of the chat agent and create a new draft chat agent
125
+ * with newer version.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * await client.chatAgent.publish(
130
+ * '16b980523634a6dc504898cda492e939',
131
+ * );
132
+ * ```
133
+ */
134
+ publish(agentId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
135
+ return this._client.post(`/publish-chat-agent/${agentId}`, {
136
+ ...options,
137
+ headers: { Accept: '*/*', ...options?.headers },
138
+ });
139
+ }
140
+ }
141
+
142
+ export interface ChatAgentResponse {
143
+ /**
144
+ * Unique id of chat agent.
145
+ */
146
+ agent_id: string;
147
+
148
+ /**
149
+ * Last modification timestamp (milliseconds since epoch). Either the time of last
150
+ * update or creation if no updates available.
151
+ */
152
+ last_modification_timestamp: number;
153
+
154
+ /**
155
+ * The Response Engine to attach to the agent. It is used to generate responses for
156
+ * the agent. You need to create a Response Engine first before attaching it to an
157
+ * agent.
158
+ */
159
+ response_engine:
160
+ | ChatAgentResponse.ResponseEngineRetellLm
161
+ | ChatAgentResponse.ResponseEngineCustomLm
162
+ | ChatAgentResponse.ResponseEngineConversationFlow;
163
+
164
+ /**
165
+ * The name of the chat agent. Only used for your own reference.
166
+ */
167
+ agent_name?: string | null;
168
+
169
+ /**
170
+ * Message to display when the chat is automatically closed.
171
+ */
172
+ auto_close_message?: string | null;
173
+
174
+ /**
175
+ * Controls what data is stored for this agent. "everything" stores all data
176
+ * including transcripts and recordings. "everything_except_pii" stores data but
177
+ * excludes PII when possible based on PII configuration. "basic_attributes_only"
178
+ * stores only basic metadata. If not set, defaults to "everything".
179
+ */
180
+ data_storage_setting?: 'everything' | 'everything_except_pii' | 'basic_attributes_only' | null;
181
+
182
+ /**
183
+ * If users stay silent for a period after agent speech, end the chat. The minimum
184
+ * value allowed is 360,000 ms (0.1 hours). The maximum value allowed is
185
+ * 259,200,000 ms (72 hours). By default, this is set to 3,600,000 (1 hour).
186
+ */
187
+ end_chat_after_silence_ms?: number;
188
+
189
+ /**
190
+ * Whether the chat agent is published.
191
+ */
192
+ is_published?: boolean;
193
+
194
+ /**
195
+ * Specifies what language (and dialect) the chat will operate in. For instance,
196
+ * selecting `en-GB` optimizes for British English. If unset, will use default
197
+ * value `en-US`. Select `multi` for multilingual support, currently this supports
198
+ * Spanish and English.
199
+ */
200
+ language?:
201
+ | 'en-US'
202
+ | 'en-IN'
203
+ | 'en-GB'
204
+ | 'en-AU'
205
+ | 'en-NZ'
206
+ | 'de-DE'
207
+ | 'es-ES'
208
+ | 'es-419'
209
+ | 'hi-IN'
210
+ | 'fr-FR'
211
+ | 'fr-CA'
212
+ | 'ja-JP'
213
+ | 'pt-PT'
214
+ | 'pt-BR'
215
+ | 'zh-CN'
216
+ | 'ru-RU'
217
+ | 'it-IT'
218
+ | 'ko-KR'
219
+ | 'nl-NL'
220
+ | 'nl-BE'
221
+ | 'pl-PL'
222
+ | 'tr-TR'
223
+ | 'th-TH'
224
+ | 'vi-VN'
225
+ | 'ro-RO'
226
+ | 'bg-BG'
227
+ | 'ca-ES'
228
+ | 'da-DK'
229
+ | 'fi-FI'
230
+ | 'el-GR'
231
+ | 'hu-HU'
232
+ | 'id-ID'
233
+ | 'no-NO'
234
+ | 'sk-SK'
235
+ | 'sv-SE'
236
+ | 'multi';
237
+
238
+ /**
239
+ * Whether this agent opts in to signed url for public log. If not set, default
240
+ * value of false will apply.
241
+ */
242
+ opt_in_signed_url?: boolean;
243
+
244
+ /**
245
+ * Configuration for PII scrubbing from transcripts and recordings.
246
+ */
247
+ pii_config?: ChatAgentResponse.PiiConfig;
248
+
249
+ /**
250
+ * Post chat analysis data to extract from the chat. This data will augment the
251
+ * pre-defined variables extracted in the chat analysis. This will be available
252
+ * after the chat ends.
253
+ */
254
+ post_chat_analysis_data?: Array<
255
+ | ChatAgentResponse.StringAnalysisData
256
+ | ChatAgentResponse.EnumAnalysisData
257
+ | ChatAgentResponse.BooleanAnalysisData
258
+ | ChatAgentResponse.NumberAnalysisData
259
+ > | null;
260
+
261
+ /**
262
+ * The model to use for post chat analysis. Default to gpt-4.1-mini.
263
+ */
264
+ post_chat_analysis_model?:
265
+ | 'gpt-4o'
266
+ | 'gpt-4o-mini'
267
+ | 'gpt-4.1'
268
+ | 'gpt-4.1-mini'
269
+ | 'gpt-4.1-nano'
270
+ | 'gpt-5'
271
+ | 'gpt-5.1'
272
+ | 'gpt-5-mini'
273
+ | 'gpt-5-nano'
274
+ | 'claude-4.5-sonnet'
275
+ | 'claude-4.0-sonnet'
276
+ | 'claude-3.7-sonnet'
277
+ | 'claude-3.5-haiku'
278
+ | 'gemini-2.0-flash'
279
+ | 'gemini-2.0-flash-lite'
280
+ | 'gemini-2.5-flash'
281
+ | 'gemini-2.5-flash-lite';
282
+
283
+ /**
284
+ * The version of the chat agent.
285
+ */
286
+ version?: number;
287
+
288
+ /**
289
+ * The timeout for the webhook in milliseconds. If not set, default value of 10000
290
+ * will apply.
291
+ */
292
+ webhook_timeout_ms?: number;
293
+
294
+ /**
295
+ * The webhook for agent to listen to chat events. See what events it would get at
296
+ * [webhook doc](/features/webhook). If set, will binds webhook events for this
297
+ * agent to the specified url, and will ignore the account level webhook for this
298
+ * agent. Set to `null` to remove webhook url from this agent.
299
+ */
300
+ webhook_url?: string | null;
301
+ }
302
+
303
+ export namespace ChatAgentResponse {
304
+ export interface ResponseEngineRetellLm {
305
+ /**
306
+ * id of the Retell LLM Response Engine.
307
+ */
308
+ llm_id: string;
309
+
310
+ /**
311
+ * type of the Response Engine.
312
+ */
313
+ type: 'retell-llm';
314
+
315
+ /**
316
+ * Version of the Retell LLM Response Engine.
317
+ */
318
+ version?: number | null;
319
+ }
320
+
321
+ export interface ResponseEngineCustomLm {
322
+ /**
323
+ * LLM websocket url of the custom LLM.
324
+ */
325
+ llm_websocket_url: string;
326
+
327
+ /**
328
+ * type of the Response Engine.
329
+ */
330
+ type: 'custom-llm';
331
+ }
332
+
333
+ export interface ResponseEngineConversationFlow {
334
+ /**
335
+ * ID of the Conversation Flow Response Engine.
336
+ */
337
+ conversation_flow_id: string;
338
+
339
+ /**
340
+ * type of the Response Engine.
341
+ */
342
+ type: 'conversation-flow';
343
+
344
+ /**
345
+ * Version of the Conversation Flow Response Engine.
346
+ */
347
+ version?: number | null;
348
+ }
349
+
350
+ /**
351
+ * Configuration for PII scrubbing from transcripts and recordings.
352
+ */
353
+ export interface PiiConfig {
354
+ /**
355
+ * List of PII categories to scrub from transcripts and recordings.
356
+ */
357
+ categories: Array<
358
+ | 'person_name'
359
+ | 'address'
360
+ | 'email'
361
+ | 'phone_number'
362
+ | 'ssn'
363
+ | 'passport'
364
+ | 'driver_license'
365
+ | 'credit_card'
366
+ | 'bank_account'
367
+ | 'password'
368
+ | 'pin'
369
+ | 'medical_id'
370
+ | 'date_of_birth'
371
+ >;
372
+
373
+ /**
374
+ * The processing mode for PII scrubbing. Currently only post-call is supported.
375
+ */
376
+ mode: 'post_call';
377
+ }
378
+
379
+ export interface StringAnalysisData {
380
+ /**
381
+ * Description of the variable.
382
+ */
383
+ description: string;
384
+
385
+ /**
386
+ * Name of the variable.
387
+ */
388
+ name: string;
389
+
390
+ /**
391
+ * Type of the variable to extract.
392
+ */
393
+ type: 'string';
394
+
395
+ /**
396
+ * Examples of the variable value to teach model the style and syntax.
397
+ */
398
+ examples?: Array<string>;
399
+ }
400
+
401
+ export interface EnumAnalysisData {
402
+ /**
403
+ * The possible values of the variable, must be non empty array.
404
+ */
405
+ choices: Array<string>;
406
+
407
+ /**
408
+ * Description of the variable.
409
+ */
410
+ description: string;
411
+
412
+ /**
413
+ * Name of the variable.
414
+ */
415
+ name: string;
416
+
417
+ /**
418
+ * Type of the variable to extract.
419
+ */
420
+ type: 'enum';
421
+ }
422
+
423
+ export interface BooleanAnalysisData {
424
+ /**
425
+ * Description of the variable.
426
+ */
427
+ description: string;
428
+
429
+ /**
430
+ * Name of the variable.
431
+ */
432
+ name: string;
433
+
434
+ /**
435
+ * Type of the variable to extract.
436
+ */
437
+ type: 'boolean';
438
+ }
439
+
440
+ export interface NumberAnalysisData {
441
+ /**
442
+ * Description of the variable.
443
+ */
444
+ description: string;
445
+
446
+ /**
447
+ * Name of the variable.
448
+ */
449
+ name: string;
450
+
451
+ /**
452
+ * Type of the variable to extract.
453
+ */
454
+ type: 'number';
455
+ }
456
+ }
457
+
458
+ export type ChatAgentListResponse = Array<ChatAgentResponse>;
459
+
460
+ export type ChatAgentGetVersionsResponse = Array<ChatAgentResponse>;
461
+
462
+ export interface ChatAgentCreateParams {
463
+ /**
464
+ * The Response Engine to attach to the agent. It is used to generate responses for
465
+ * the agent. You need to create a Response Engine first before attaching it to an
466
+ * agent.
467
+ */
468
+ response_engine:
469
+ | ChatAgentCreateParams.ResponseEngineRetellLm
470
+ | ChatAgentCreateParams.ResponseEngineCustomLm
471
+ | ChatAgentCreateParams.ResponseEngineConversationFlow;
472
+
473
+ /**
474
+ * The name of the chat agent. Only used for your own reference.
475
+ */
476
+ agent_name?: string | null;
477
+
478
+ /**
479
+ * Message to display when the chat is automatically closed.
480
+ */
481
+ auto_close_message?: string | null;
482
+
483
+ /**
484
+ * Controls what data is stored for this agent. "everything" stores all data
485
+ * including transcripts and recordings. "everything_except_pii" stores data but
486
+ * excludes PII when possible based on PII configuration. "basic_attributes_only"
487
+ * stores only basic metadata. If not set, defaults to "everything".
488
+ */
489
+ data_storage_setting?: 'everything' | 'everything_except_pii' | 'basic_attributes_only' | null;
490
+
491
+ /**
492
+ * If users stay silent for a period after agent speech, end the chat. The minimum
493
+ * value allowed is 360,000 ms (0.1 hours). The maximum value allowed is
494
+ * 259,200,000 ms (72 hours). By default, this is set to 3,600,000 (1 hour).
495
+ */
496
+ end_chat_after_silence_ms?: number;
497
+
498
+ /**
499
+ * Specifies what language (and dialect) the chat will operate in. For instance,
500
+ * selecting `en-GB` optimizes for British English. If unset, will use default
501
+ * value `en-US`. Select `multi` for multilingual support, currently this supports
502
+ * Spanish and English.
503
+ */
504
+ language?:
505
+ | 'en-US'
506
+ | 'en-IN'
507
+ | 'en-GB'
508
+ | 'en-AU'
509
+ | 'en-NZ'
510
+ | 'de-DE'
511
+ | 'es-ES'
512
+ | 'es-419'
513
+ | 'hi-IN'
514
+ | 'fr-FR'
515
+ | 'fr-CA'
516
+ | 'ja-JP'
517
+ | 'pt-PT'
518
+ | 'pt-BR'
519
+ | 'zh-CN'
520
+ | 'ru-RU'
521
+ | 'it-IT'
522
+ | 'ko-KR'
523
+ | 'nl-NL'
524
+ | 'nl-BE'
525
+ | 'pl-PL'
526
+ | 'tr-TR'
527
+ | 'th-TH'
528
+ | 'vi-VN'
529
+ | 'ro-RO'
530
+ | 'bg-BG'
531
+ | 'ca-ES'
532
+ | 'da-DK'
533
+ | 'fi-FI'
534
+ | 'el-GR'
535
+ | 'hu-HU'
536
+ | 'id-ID'
537
+ | 'no-NO'
538
+ | 'sk-SK'
539
+ | 'sv-SE'
540
+ | 'multi';
541
+
542
+ /**
543
+ * Whether this agent opts in to signed url for public log. If not set, default
544
+ * value of false will apply.
545
+ */
546
+ opt_in_signed_url?: boolean;
547
+
548
+ /**
549
+ * Configuration for PII scrubbing from transcripts and recordings.
550
+ */
551
+ pii_config?: ChatAgentCreateParams.PiiConfig;
552
+
553
+ /**
554
+ * Post chat analysis data to extract from the chat. This data will augment the
555
+ * pre-defined variables extracted in the chat analysis. This will be available
556
+ * after the chat ends.
557
+ */
558
+ post_chat_analysis_data?: Array<
559
+ | ChatAgentCreateParams.StringAnalysisData
560
+ | ChatAgentCreateParams.EnumAnalysisData
561
+ | ChatAgentCreateParams.BooleanAnalysisData
562
+ | ChatAgentCreateParams.NumberAnalysisData
563
+ > | null;
564
+
565
+ /**
566
+ * The model to use for post chat analysis. Default to gpt-4.1-mini.
567
+ */
568
+ post_chat_analysis_model?:
569
+ | 'gpt-4o'
570
+ | 'gpt-4o-mini'
571
+ | 'gpt-4.1'
572
+ | 'gpt-4.1-mini'
573
+ | 'gpt-4.1-nano'
574
+ | 'gpt-5'
575
+ | 'gpt-5.1'
576
+ | 'gpt-5-mini'
577
+ | 'gpt-5-nano'
578
+ | 'claude-4.5-sonnet'
579
+ | 'claude-4.0-sonnet'
580
+ | 'claude-3.7-sonnet'
581
+ | 'claude-3.5-haiku'
582
+ | 'gemini-2.0-flash'
583
+ | 'gemini-2.0-flash-lite'
584
+ | 'gemini-2.5-flash'
585
+ | 'gemini-2.5-flash-lite';
586
+
587
+ /**
588
+ * The timeout for the webhook in milliseconds. If not set, default value of 10000
589
+ * will apply.
590
+ */
591
+ webhook_timeout_ms?: number;
592
+
593
+ /**
594
+ * The webhook for agent to listen to chat events. See what events it would get at
595
+ * [webhook doc](/features/webhook). If set, will binds webhook events for this
596
+ * agent to the specified url, and will ignore the account level webhook for this
597
+ * agent. Set to `null` to remove webhook url from this agent.
598
+ */
599
+ webhook_url?: string | null;
600
+ }
601
+
602
+ export namespace ChatAgentCreateParams {
603
+ export interface ResponseEngineRetellLm {
604
+ /**
605
+ * id of the Retell LLM Response Engine.
606
+ */
607
+ llm_id: string;
608
+
609
+ /**
610
+ * type of the Response Engine.
611
+ */
612
+ type: 'retell-llm';
613
+
614
+ /**
615
+ * Version of the Retell LLM Response Engine.
616
+ */
617
+ version?: number | null;
618
+ }
619
+
620
+ export interface ResponseEngineCustomLm {
621
+ /**
622
+ * LLM websocket url of the custom LLM.
623
+ */
624
+ llm_websocket_url: string;
625
+
626
+ /**
627
+ * type of the Response Engine.
628
+ */
629
+ type: 'custom-llm';
630
+ }
631
+
632
+ export interface ResponseEngineConversationFlow {
633
+ /**
634
+ * ID of the Conversation Flow Response Engine.
635
+ */
636
+ conversation_flow_id: string;
637
+
638
+ /**
639
+ * type of the Response Engine.
640
+ */
641
+ type: 'conversation-flow';
642
+
643
+ /**
644
+ * Version of the Conversation Flow Response Engine.
645
+ */
646
+ version?: number | null;
647
+ }
648
+
649
+ /**
650
+ * Configuration for PII scrubbing from transcripts and recordings.
651
+ */
652
+ export interface PiiConfig {
653
+ /**
654
+ * List of PII categories to scrub from transcripts and recordings.
655
+ */
656
+ categories: Array<
657
+ | 'person_name'
658
+ | 'address'
659
+ | 'email'
660
+ | 'phone_number'
661
+ | 'ssn'
662
+ | 'passport'
663
+ | 'driver_license'
664
+ | 'credit_card'
665
+ | 'bank_account'
666
+ | 'password'
667
+ | 'pin'
668
+ | 'medical_id'
669
+ | 'date_of_birth'
670
+ >;
671
+
672
+ /**
673
+ * The processing mode for PII scrubbing. Currently only post-call is supported.
674
+ */
675
+ mode: 'post_call';
676
+ }
677
+
678
+ export interface StringAnalysisData {
679
+ /**
680
+ * Description of the variable.
681
+ */
682
+ description: string;
683
+
684
+ /**
685
+ * Name of the variable.
686
+ */
687
+ name: string;
688
+
689
+ /**
690
+ * Type of the variable to extract.
691
+ */
692
+ type: 'string';
693
+
694
+ /**
695
+ * Examples of the variable value to teach model the style and syntax.
696
+ */
697
+ examples?: Array<string>;
698
+ }
699
+
700
+ export interface EnumAnalysisData {
701
+ /**
702
+ * The possible values of the variable, must be non empty array.
703
+ */
704
+ choices: Array<string>;
705
+
706
+ /**
707
+ * Description of the variable.
708
+ */
709
+ description: string;
710
+
711
+ /**
712
+ * Name of the variable.
713
+ */
714
+ name: string;
715
+
716
+ /**
717
+ * Type of the variable to extract.
718
+ */
719
+ type: 'enum';
720
+ }
721
+
722
+ export interface BooleanAnalysisData {
723
+ /**
724
+ * Description of the variable.
725
+ */
726
+ description: string;
727
+
728
+ /**
729
+ * Name of the variable.
730
+ */
731
+ name: string;
732
+
733
+ /**
734
+ * Type of the variable to extract.
735
+ */
736
+ type: 'boolean';
737
+ }
738
+
739
+ export interface NumberAnalysisData {
740
+ /**
741
+ * Description of the variable.
742
+ */
743
+ description: string;
744
+
745
+ /**
746
+ * Name of the variable.
747
+ */
748
+ name: string;
749
+
750
+ /**
751
+ * Type of the variable to extract.
752
+ */
753
+ type: 'number';
754
+ }
755
+ }
756
+
757
+ export interface ChatAgentRetrieveParams {
758
+ /**
759
+ * Optional version of the API to use for this request. If not provided, will
760
+ * default to latest version.
761
+ */
762
+ version?: number;
763
+ }
764
+
765
+ export interface ChatAgentUpdateParams {
766
+ /**
767
+ * Query param: Optional version of the API to use for this request. Default to
768
+ * latest version.
769
+ */
770
+ version?: number;
771
+
772
+ /**
773
+ * Body param: The name of the chat agent. Only used for your own reference.
774
+ */
775
+ agent_name?: string | null;
776
+
777
+ /**
778
+ * Body param: Message to display when the chat is automatically closed.
779
+ */
780
+ auto_close_message?: string | null;
781
+
782
+ /**
783
+ * Body param: Controls what data is stored for this agent. "everything" stores all
784
+ * data including transcripts and recordings. "everything_except_pii" stores data
785
+ * but excludes PII when possible based on PII configuration.
786
+ * "basic_attributes_only" stores only basic metadata. If not set, defaults to
787
+ * "everything".
788
+ */
789
+ data_storage_setting?: 'everything' | 'everything_except_pii' | 'basic_attributes_only' | null;
790
+
791
+ /**
792
+ * Body param: If users stay silent for a period after agent speech, end the chat.
793
+ * The minimum value allowed is 360,000 ms (0.1 hours). The maximum value allowed
794
+ * is 259,200,000 ms (72 hours). By default, this is set to 3,600,000 (1 hour).
795
+ */
796
+ end_chat_after_silence_ms?: number;
797
+
798
+ /**
799
+ * Body param: Specifies what language (and dialect) the chat will operate in. For
800
+ * instance, selecting `en-GB` optimizes for British English. If unset, will use
801
+ * default value `en-US`. Select `multi` for multilingual support, currently this
802
+ * supports Spanish and English.
803
+ */
804
+ language?:
805
+ | 'en-US'
806
+ | 'en-IN'
807
+ | 'en-GB'
808
+ | 'en-AU'
809
+ | 'en-NZ'
810
+ | 'de-DE'
811
+ | 'es-ES'
812
+ | 'es-419'
813
+ | 'hi-IN'
814
+ | 'fr-FR'
815
+ | 'fr-CA'
816
+ | 'ja-JP'
817
+ | 'pt-PT'
818
+ | 'pt-BR'
819
+ | 'zh-CN'
820
+ | 'ru-RU'
821
+ | 'it-IT'
822
+ | 'ko-KR'
823
+ | 'nl-NL'
824
+ | 'nl-BE'
825
+ | 'pl-PL'
826
+ | 'tr-TR'
827
+ | 'th-TH'
828
+ | 'vi-VN'
829
+ | 'ro-RO'
830
+ | 'bg-BG'
831
+ | 'ca-ES'
832
+ | 'da-DK'
833
+ | 'fi-FI'
834
+ | 'el-GR'
835
+ | 'hu-HU'
836
+ | 'id-ID'
837
+ | 'no-NO'
838
+ | 'sk-SK'
839
+ | 'sv-SE'
840
+ | 'multi';
841
+
842
+ /**
843
+ * Body param: Whether this agent opts in to signed url for public log. If not set,
844
+ * default value of false will apply.
845
+ */
846
+ opt_in_signed_url?: boolean;
847
+
848
+ /**
849
+ * Body param: Configuration for PII scrubbing from transcripts and recordings.
850
+ */
851
+ pii_config?: ChatAgentUpdateParams.PiiConfig;
852
+
853
+ /**
854
+ * Body param: Post chat analysis data to extract from the chat. This data will
855
+ * augment the pre-defined variables extracted in the chat analysis. This will be
856
+ * available after the chat ends.
857
+ */
858
+ post_chat_analysis_data?: Array<
859
+ | ChatAgentUpdateParams.StringAnalysisData
860
+ | ChatAgentUpdateParams.EnumAnalysisData
861
+ | ChatAgentUpdateParams.BooleanAnalysisData
862
+ | ChatAgentUpdateParams.NumberAnalysisData
863
+ > | null;
864
+
865
+ /**
866
+ * Body param: The model to use for post chat analysis. Default to gpt-4.1-mini.
867
+ */
868
+ post_chat_analysis_model?:
869
+ | 'gpt-4o'
870
+ | 'gpt-4o-mini'
871
+ | 'gpt-4.1'
872
+ | 'gpt-4.1-mini'
873
+ | 'gpt-4.1-nano'
874
+ | 'gpt-5'
875
+ | 'gpt-5.1'
876
+ | 'gpt-5-mini'
877
+ | 'gpt-5-nano'
878
+ | 'claude-4.5-sonnet'
879
+ | 'claude-4.0-sonnet'
880
+ | 'claude-3.7-sonnet'
881
+ | 'claude-3.5-haiku'
882
+ | 'gemini-2.0-flash'
883
+ | 'gemini-2.0-flash-lite'
884
+ | 'gemini-2.5-flash'
885
+ | 'gemini-2.5-flash-lite';
886
+
887
+ /**
888
+ * Body param: The Response Engine to attach to the agent. It is used to generate
889
+ * responses for the agent. You need to create a Response Engine first before
890
+ * attaching it to an agent.
891
+ */
892
+ response_engine?:
893
+ | ChatAgentUpdateParams.ResponseEngineRetellLm
894
+ | ChatAgentUpdateParams.ResponseEngineCustomLm
895
+ | ChatAgentUpdateParams.ResponseEngineConversationFlow;
896
+
897
+ /**
898
+ * Body param: The timeout for the webhook in milliseconds. If not set, default
899
+ * value of 10000 will apply.
900
+ */
901
+ webhook_timeout_ms?: number;
902
+
903
+ /**
904
+ * Body param: The webhook for agent to listen to chat events. See what events it
905
+ * would get at [webhook doc](/features/webhook). If set, will binds webhook events
906
+ * for this agent to the specified url, and will ignore the account level webhook
907
+ * for this agent. Set to `null` to remove webhook url from this agent.
908
+ */
909
+ webhook_url?: string | null;
910
+ }
911
+
912
+ export namespace ChatAgentUpdateParams {
913
+ /**
914
+ * Configuration for PII scrubbing from transcripts and recordings.
915
+ */
916
+ export interface PiiConfig {
917
+ /**
918
+ * List of PII categories to scrub from transcripts and recordings.
919
+ */
920
+ categories: Array<
921
+ | 'person_name'
922
+ | 'address'
923
+ | 'email'
924
+ | 'phone_number'
925
+ | 'ssn'
926
+ | 'passport'
927
+ | 'driver_license'
928
+ | 'credit_card'
929
+ | 'bank_account'
930
+ | 'password'
931
+ | 'pin'
932
+ | 'medical_id'
933
+ | 'date_of_birth'
934
+ >;
935
+
936
+ /**
937
+ * The processing mode for PII scrubbing. Currently only post-call is supported.
938
+ */
939
+ mode: 'post_call';
940
+ }
941
+
942
+ export interface StringAnalysisData {
943
+ /**
944
+ * Description of the variable.
945
+ */
946
+ description: string;
947
+
948
+ /**
949
+ * Name of the variable.
950
+ */
951
+ name: string;
952
+
953
+ /**
954
+ * Type of the variable to extract.
955
+ */
956
+ type: 'string';
957
+
958
+ /**
959
+ * Examples of the variable value to teach model the style and syntax.
960
+ */
961
+ examples?: Array<string>;
962
+ }
963
+
964
+ export interface EnumAnalysisData {
965
+ /**
966
+ * The possible values of the variable, must be non empty array.
967
+ */
968
+ choices: Array<string>;
969
+
970
+ /**
971
+ * Description of the variable.
972
+ */
973
+ description: string;
974
+
975
+ /**
976
+ * Name of the variable.
977
+ */
978
+ name: string;
979
+
980
+ /**
981
+ * Type of the variable to extract.
982
+ */
983
+ type: 'enum';
984
+ }
985
+
986
+ export interface BooleanAnalysisData {
987
+ /**
988
+ * Description of the variable.
989
+ */
990
+ description: string;
991
+
992
+ /**
993
+ * Name of the variable.
994
+ */
995
+ name: string;
996
+
997
+ /**
998
+ * Type of the variable to extract.
999
+ */
1000
+ type: 'boolean';
1001
+ }
1002
+
1003
+ export interface NumberAnalysisData {
1004
+ /**
1005
+ * Description of the variable.
1006
+ */
1007
+ description: string;
1008
+
1009
+ /**
1010
+ * Name of the variable.
1011
+ */
1012
+ name: string;
1013
+
1014
+ /**
1015
+ * Type of the variable to extract.
1016
+ */
1017
+ type: 'number';
1018
+ }
1019
+
1020
+ export interface ResponseEngineRetellLm {
1021
+ /**
1022
+ * id of the Retell LLM Response Engine.
1023
+ */
1024
+ llm_id: string;
1025
+
1026
+ /**
1027
+ * type of the Response Engine.
1028
+ */
1029
+ type: 'retell-llm';
1030
+
1031
+ /**
1032
+ * Version of the Retell LLM Response Engine.
1033
+ */
1034
+ version?: number | null;
1035
+ }
1036
+
1037
+ export interface ResponseEngineCustomLm {
1038
+ /**
1039
+ * LLM websocket url of the custom LLM.
1040
+ */
1041
+ llm_websocket_url: string;
1042
+
1043
+ /**
1044
+ * type of the Response Engine.
1045
+ */
1046
+ type: 'custom-llm';
1047
+ }
1048
+
1049
+ export interface ResponseEngineConversationFlow {
1050
+ /**
1051
+ * ID of the Conversation Flow Response Engine.
1052
+ */
1053
+ conversation_flow_id: string;
1054
+
1055
+ /**
1056
+ * type of the Response Engine.
1057
+ */
1058
+ type: 'conversation-flow';
1059
+
1060
+ /**
1061
+ * Version of the Conversation Flow Response Engine.
1062
+ */
1063
+ version?: number | null;
1064
+ }
1065
+ }
1066
+
1067
+ export interface ChatAgentListParams {
1068
+ /**
1069
+ * A limit on the number of objects to be returned. Limit can range between 1 and
1070
+ * 1000, and the default is 1000.
1071
+ */
1072
+ limit?: number;
1073
+
1074
+ /**
1075
+ * The pagination key to continue fetching the next page of agents. Pagination key
1076
+ * is represented by a agent id, pagination key and version pair is exclusive (not
1077
+ * included in the fetched page). If not set, will start from the beginning.
1078
+ */
1079
+ pagination_key?: string;
1080
+
1081
+ /**
1082
+ * Specifies the version of the agent associated with the pagination_key. When
1083
+ * paginating, both the pagination_key and its version must be provided to ensure
1084
+ * consistent ordering and to fetch the next page correctly.
1085
+ */
1086
+ pagination_key_version?: number;
1087
+ }
1088
+
1089
+ export declare namespace ChatAgent {
1090
+ export {
1091
+ type ChatAgentResponse as ChatAgentResponse,
1092
+ type ChatAgentListResponse as ChatAgentListResponse,
1093
+ type ChatAgentGetVersionsResponse as ChatAgentGetVersionsResponse,
1094
+ type ChatAgentCreateParams as ChatAgentCreateParams,
1095
+ type ChatAgentRetrieveParams as ChatAgentRetrieveParams,
1096
+ type ChatAgentUpdateParams as ChatAgentUpdateParams,
1097
+ type ChatAgentListParams as ChatAgentListParams,
1098
+ };
1099
+ }