import { APIResource } from "../core/resource.js"; import { APIPromise } from "../core/api-promise.js"; import { RequestOptions } from "../internal/request-options.js"; export declare class Llm extends APIResource { /** * Create a new Retell LLM Response Engine that can be attached to an agent. This * is used to generate response output for the agent. * * @example * ```ts * const llmResponse = await client.llm.create(); * ``` */ create(body: LlmCreateParams, options?: RequestOptions): APIPromise; /** * Retrieve details of a specific Retell LLM Response Engine * * @example * ```ts * const llmResponse = await client.llm.retrieve( * '16b980523634a6dc504898cda492e939', * ); * ``` */ retrieve(llmID: string, query?: LlmRetrieveParams | null | undefined, options?: RequestOptions): APIPromise; /** * Update an existing Retell LLM Response Engine * * @example * ```ts * const llmResponse = await client.llm.update( * '16b980523634a6dc504898cda492e939', * { * begin_message: * 'Hey I am a virtual assistant calling from Retell Hospital.', * }, * ); * ``` */ update(llmID: string, params: LlmUpdateParams, options?: RequestOptions): APIPromise; /** * List Retell LLM Response Engines with pagination * * @example * ```ts * const llms = await client.llm.list(); * ``` */ list(query?: LlmListParams | null | undefined, options?: RequestOptions): APIPromise; /** * Delete an existing Retell LLM Response Engine * * @example * ```ts * await client.llm.delete('oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD'); * ``` */ delete(llmID: string, params?: LlmDeleteParams | null | undefined, options?: RequestOptions): APIPromise; } export interface LlmResponse { /** * Last modification timestamp (milliseconds since epoch). Either the time of last * update or creation if no updates available. */ last_modification_timestamp: number; /** * Unique id of Retell LLM Response Engine. */ llm_id: string; /** * If set, the AI will begin the conversation after waiting for the user for the * duration (in milliseconds) specified by this attribute. This only applies if the * agent is configured to wait for the user to speak first. If not set, the agent * will wait indefinitely for the user to speak. */ begin_after_user_silence_ms?: number | null; /** * First utterance said by the agent in the call. If not set, LLM will dynamically * generate a message. If set to "", agent will wait for user to speak first. */ begin_message?: string | null; /** * Default dynamic variables represented as key-value pairs of strings. These are * injected into your Retell LLM prompt and tool description when specific values * are not provided in a request. Only applicable for Retell LLM. */ default_dynamic_variables?: { [key: string]: string; } | null; /** * General prompt appended to system prompt no matter what state the agent is in. * * - System prompt (with state) = general prompt + state prompt. * - System prompt (no state) = general prompt. */ general_prompt?: string | null; /** * A list of tools the model may call (to get external knowledge, call API, etc). * You can select from some common predefined tools like end call, transfer call, * etc; or you can create your own custom tool for the LLM to use. * * - Tools of LLM (with state) = general tools + state tools + state transitions * - Tools of LLM (no state) = general tools */ general_tools?: Array | null; /** * Whether the Retell LLM Response Engine is published. */ is_published?: boolean; /** * Whether this Retell LLM is used for warm transfer. Can only be set at creation, * and is ignored on update. */ is_transfer_llm?: boolean | null; /** * Knowledge base configuration for RAG retrieval. */ kb_config?: LlmResponse.KBConfig | null; /** * A list of knowledge base ids to use for this resource. */ knowledge_base_ids?: Array | null; /** * A list of MCPs to use for this LLM. */ mcps?: Array | null; /** * Select the underlying text LLM. If not set, would default to gpt-4.1. */ model?: 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-5.1' | 'gpt-5.2' | 'gpt-5.4' | 'gpt-5.4-mini' | 'gpt-5.4-nano' | 'gpt-5.5' | 'gpt-5.6-terra' | 'gpt-5.6-luna' | 'claude-4.5-sonnet' | 'claude-4.6-sonnet' | 'claude-5-sonnet' | 'claude-4.5-haiku' | 'gemini-3.0-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | null; /** * If set to true, will use high priority pool with more dedicated resource to * ensure lower and more consistent latency, default to false. This feature usually * comes with a higher cost. */ model_high_priority?: boolean | null; /** * If set, will control the randomness of the response. Value ranging from [0,1]. * Lower value means more deterministic, while higher value means more random. If * unset, default value 0 will apply. Note that for tool calling, a lower value is * recommended. */ model_temperature?: number; /** * Select the underlying speech to speech model. Can only set this or model, not * both. */ s2s_model?: 'gpt-realtime-2.1' | 'gpt-realtime-2.1-mini' | 'gpt-realtime-2' | 'gpt-realtime-1.5' | 'gpt-realtime' | 'gpt-realtime-mini' | null; /** * The speaker who starts the conversation. Required. Must be either 'user' or * 'agent'. */ start_speaker?: 'user' | 'agent'; /** * Name of the starting state. Required if states is not empty. */ starting_state?: string | null; /** * States of the LLM. This is to help reduce prompt length and tool choices when * the call can be broken into distinct states. With shorter prompts and less * tools, the LLM can better focus and follow the rules, minimizing hallucination. * If this field is not set, the agent would only have general prompt and general * tools (essentially one state). */ states?: Array | null; /** * Whether to use strict mode for tool calls. Only applicable when using certain * supported models. */ tool_call_strict_mode?: boolean | null; /** * Version of the Retell LLM Response Engine. */ version?: number; } export declare namespace LlmResponse { interface EndCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'end_call'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when ending the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface TransferCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; transfer_destination: TransferCallTool.TransferDestinationPredefined | TransferCallTool.TransferDestinationInferred; transfer_option: TransferCallTool.TransferOptionColdTransfer | TransferCallTool.TransferOptionWarmTransfer | TransferCallTool.TransferOptionAgenticWarmTransfer; type: 'transfer_call'; /** * Custom SIP headers to be added to the call. */ custom_sip_headers?: { [key: string]: string; }; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when transferring the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the e.164 validation will be ignored for the from_number. This can be * useful when you want to dial to internal pseudo numbers. This only applies when * you are using custom telephony and does not apply when you are using Retell * Telephony. If omitted, the default value is false. */ ignore_e164_validation?: boolean; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } namespace TransferCallTool { interface TransferDestinationPredefined { /** * The number to transfer to in E.164 format or a dynamic variable like * {{transfer_number}}. */ number: string; /** * The type of transfer destination. */ type: 'predefined'; /** * Extension digits to dial after the main number connects. Sent via DTMF. Allow * digits, '\*', '#', or a dynamic variable like {{extension}}. */ extension?: string; } interface TransferDestinationInferred { /** * The prompt to be used to help infer the transfer destination. The model will * take the global prompt, the call transcript, and this prompt together to deduce * the right number to transfer to. Can contain dynamic variables. */ prompt: string; /** * The type of transfer destination. */ type: 'inferred'; } interface TransferOptionColdTransfer { /** * The type of the transfer. */ type: 'cold_transfer'; /** * The mode of the cold transfer. If set to `sip_refer`, will use SIP REFER to * transfer the call. If set to `sip_invite`, will use SIP INVITE to transfer the * call. */ cold_transfer_mode?: 'sip_refer' | 'sip_invite'; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring. Requires the telephony side to support caller id override. Retell * Twilio numbers support this option. This parameter takes effect only when * `cold_transfer_mode` is set to `sip_invite`. When using `sip_refer`, this option * is not available. Retell Twilio numbers always use user's number as the caller * id when using `sip refer` cold transfer mode. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } interface TransferOptionWarmTransfer { /** * The type of the transfer. */ type: 'warm_transfer'; /** * The time to wait before considering transfer fails. */ agent_detection_timeout_ms?: number; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ ivr_option?: TransferOptionWarmTransfer.IvrOption; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set to true, will not perform human detection for the transfer. Default to * false. */ opt_out_human_detection?: boolean; /** * If set, when transfer is connected, will say the handoff message only to the * agent receiving the transfer. Can leave either a static message or a dynamic one * based on prompt. Set to null to disable warm handoff. */ private_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionWarmTransfer { /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ interface IvrOption { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } interface TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ agentic_transfer_config: TransferOptionAgenticWarmTransfer.AgenticTransferConfig; /** * The type of the transfer. */ type: 'agentic_warm_transfer'; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionAgenticWarmTransfer.WarmTransferPrompt | TransferOptionAgenticWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ interface AgenticTransferConfig { /** * The action to take when the transfer agent times out without making a decision. * Defaults to cancel_transfer. */ action_on_timeout?: 'bridge_transfer' | 'cancel_transfer'; /** * The agent that will mediate the transfer decision. */ transfer_agent?: AgenticTransferConfig.TransferAgent; /** * The maximum time to wait for the transfer agent to make a decision, in * milliseconds. Defaults to 30000 (30 seconds). */ transfer_timeout_ms?: number; } namespace AgenticTransferConfig { /** * The agent that will mediate the transfer decision. */ interface TransferAgent { /** * The agent ID of the transfer agent. This agent must have isTransferAgent set to * true and should use bridge_transfer and cancel_transfer tools (for Retell LLM) * or BridgeTransferNode and CancelTransferNode (for Conversation Flow). */ agent_id: string; /** * The version of the transfer agent to use. */ agent_version: string | number; } } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } } interface CheckAvailabilityCalTool { /** * Cal.com Api key that have access to the cal.com event you want to check * availability for. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to check * availability for. Can be a number or a dynamic variable in the format * `{{variable_name}}` that will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'check_availability_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when checking availability, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface BookAppointmentCalTool { /** * Cal.com Api key that have access to the cal.com event you want to book * appointment. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to book appointment. * Can be a number or a dynamic variable in the format `{{variable_name}}` that * will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'book_appointment_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when booking appointment, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface AgentSwapTool { /** * The id of the agent to swap to. */ agent_id: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; /** * Post call analysis setting for the agent swap. */ post_call_analysis_setting: 'both_agents' | 'only_destination_agent'; type: 'agent_swap'; /** * The version of the agent to swap to. If not specified, will use the latest * version. */ agent_version?: string | number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * The message for the agent to speak when executing agent swap. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, keep the current language when swapping agents. Defaults to false. */ keep_current_language?: boolean; /** * If true, keep the current voice and ambient sound settings when swapping agents. * Otherwise, use the destination agent's voice and ambient sound settings. * Defaults to false. */ keep_current_voice?: boolean; speak_during_execution?: boolean; /** * Webhook setting for the agent swap, defaults to only source. */ webhook_setting?: 'both_agents' | 'only_destination_agent' | 'only_source_agent'; } interface PressDigitTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'press_digit'; /** * Delay in milliseconds before pressing the digit, because a lot of IVR systems * speak very slowly, and a delay can make sure the agent hears the full menu. * Default to 1000 ms (1s). Valid range is 0 to 5000 ms (inclusive). */ delay_ms?: number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; } interface SendSMSTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; sms_content: SendSMSTool.SMSContentPredefined | SendSMSTool.SMSContentInferred | SendSMSTool.SMSContentTemplate; type: 'send_sms'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say before sending the SMS. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the agent will speak a short line before sending the SMS. If omitted, * defaults to true (same as end_call / transfer_call tools). */ speak_during_execution?: boolean; } namespace SendSMSTool { interface SMSContentPredefined { /** * The static message to be sent in the SMS. Can contain dynamic variables. */ text?: string; type?: 'predefined'; } interface SMSContentInferred { /** * The prompt to be used to help infer the SMS content. The model will take the * global prompt, the call transcript, and this prompt together to deduce the right * message to send. Can contain dynamic variables. */ prompt?: string; type?: 'inferred'; } interface SMSContentTemplate { /** * The template to use for the SMS content. "info_collection" sends a predefined * message requesting information from the user. */ template: 'info_collection'; type: 'template'; } } interface CustomTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'custom'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ url: string; /** * If set to true, the parameters will be passed as root level JSON object instead * of nested under "args". */ args_at_root?: boolean; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. Useful when the tool takes a noticeable amount of time to prevent * silence on the call. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * Headers to add to the request. */ headers?: { [key: string]: string; }; /** * Maximum number of times to retry the request after a failed attempt, from 0 (no * retry) to 5. Retries happen on any failure, with exponential backoff between * attempts; the backoff delay is not configurable. `timeout_ms` applies per * attempt rather than as a budget across all attempts, so an attempt that times * out is still retried and the worst-case total duration is `timeout_ms` * multiplied by (`max_retry` + 1) as well as any latency incurred by the * exponential backoff + jitter between each retry. Only the final attempt's result * is reported to the agent. Because retries repeat the request, only set this * above 0 if your endpoint is idempotent — a retried request may be processed more * than once. Defaults to 0 (no retry). */ max_retry?: number; /** * Method to use for the request, default to POST. */ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; /** * How the tool's `parameters` are authored and shown in the dashboard editor — * "form" for the visual parameter builder, "json" for a raw JSON Schema. Both * produce the same `parameters` schema; this does not change how the request body * is encoded (see `args_at_root`). */ parameter_type?: 'json' | 'form'; /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ parameters?: CustomTool.Parameters; /** * Query parameters to append to the request URL. */ query_params?: { [key: string]: string; }; /** * A mapping of variable names to JSON paths in the response body. These values * will be extracted from the response and made available as dynamic variables for * use. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the tool can run before it's considered * timeout. If the tool times out, the agent would have that info. The minimum * value allowed is 1000 ms (1 s), and maximum value allowed is 600,000 ms (10 * min). By default, this is set to 120,000 ms (2 min). */ timeout_ms?: number; } namespace CustomTool { /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ interface Parameters { /** * The value of properties is an object, where each key is the name of a property * and each value is a schema used to validate that property. */ properties: unknown; /** * Type must be "object" for a JSON Schema object. */ type: 'object'; /** * List of names of required property when generating this parameter. LLM will do * its best to generate the required properties in its function arguments. Property * must exist in properties. */ required?: Array; } } interface CodeTool { /** * JavaScript code to execute in the sandbox. */ code: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'code'; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * A mapping of variable names to JSON paths in the code execution result. These * mapped values will be extracted and added as dynamic variables. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the tool. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the code can run before it's considered * timeout. Defaults to 30,000 ms (30 s). */ timeout_ms?: number; } interface ExtractDynamicVariableTool { /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'extract_dynamic_variable'; /** * The variables to be extracted. */ variables: Array; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; } namespace ExtractDynamicVariableTool { interface StringAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'string'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Examples of the variable value to teach model the style and syntax. */ examples?: Array; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface EnumAnalysisData { /** * The possible values of the variable, must be non empty array. */ choices: Array; /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'enum'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface BooleanAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'boolean'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface NumberAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'number'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } } interface BridgeTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'bridge_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it bridges the original caller to the transfer target and ends the * transfer agent call. */ description?: string; /** * Describes what to say to user when bridging the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface CancelTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'cancel_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it cancels the transfer, returns the original caller to the main agent, * and ends the transfer agent call. */ description?: string; /** * Describes what to say to user when cancelling the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface McpTool { /** * Description of the MCP tool. */ description: string; /** * Name of the MCP tool. */ name: string; type: 'mcp'; /** * If true, play a typing sound on the agent audio track while this MCP tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * The input schema of the MCP tool. */ input_schema?: { [key: string]: string; }; /** * Unique id of the MCP. */ mcp_id?: string; /** * Response variables to add to dynamic variables, key is the variable name, value * is the path to the variable in the response */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; } /** * Knowledge base configuration for RAG retrieval. */ interface KBConfig { /** * Similarity threshold for filtering search results */ filter_score?: number; /** * Max number of knowledge base chunks to retrieve */ top_k?: number; } interface Mcp { name: string; /** * The URL of the MCP server. */ url: string; /** * Headers to add to the MCP connection request. */ headers?: { [key: string]: string; }; /** * Query parameters to append to the MCP connection request URL. */ query_params?: { [key: string]: string; }; /** * Maximum time to wait for a connection to be established (in milliseconds). * Default to 120,000 ms (2 minutes). */ timeout_ms?: number; } interface State { /** * Name of the state, must be unique for each state. Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; /** * Edges of the state define how and what state can be reached from this state. */ edges?: Array; /** * Prompt of the state, will be appended to the system prompt of LLM. * * - System prompt = general prompt + state prompt. */ state_prompt?: string; /** * A list of tools specific to this state the model may call (to get external * knowledge, call API, etc). You can select from some common predefined tools like * end call, transfer call, etc; or you can create your own custom tool for the LLM * to use. * * - Tools of LLM = general tools + state tools + state transitions */ tools?: Array; } namespace State { interface Edge { /** * Describes what's the transition and at what time / criteria should this * transition happen. */ description: string; /** * The destination state name when going through transition of state via this edge. * State transition internally is implemented as a tool call of LLM, and a tool * call with name "transition*to*{destination_state_name}" will get created. Feel * free to reference it inside the prompt. */ destination_state_name: string; /** * Describes what parameters you want to extract out when the transition changes. * The parameters extracted here can be referenced in prompts & function * descriptions of later states via dynamic variables. The parameters the functions * accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. */ parameters?: Edge.Parameters; } namespace Edge { /** * Describes what parameters you want to extract out when the transition changes. * The parameters extracted here can be referenced in prompts & function * descriptions of later states via dynamic variables. The parameters the functions * accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. */ interface Parameters { /** * The value of properties is an object, where each key is the name of a property * and each value is a schema used to validate that property. */ properties: unknown; /** * Type must be "object" for a JSON Schema object. */ type: 'object'; /** * List of names of required property when generating this parameter. LLM will do * its best to generate the required properties in its function arguments. Property * must exist in properties. */ required?: Array; } } interface EndCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'end_call'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when ending the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface TransferCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; transfer_destination: TransferCallTool.TransferDestinationPredefined | TransferCallTool.TransferDestinationInferred; transfer_option: TransferCallTool.TransferOptionColdTransfer | TransferCallTool.TransferOptionWarmTransfer | TransferCallTool.TransferOptionAgenticWarmTransfer; type: 'transfer_call'; /** * Custom SIP headers to be added to the call. */ custom_sip_headers?: { [key: string]: string; }; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when transferring the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the e.164 validation will be ignored for the from_number. This can be * useful when you want to dial to internal pseudo numbers. This only applies when * you are using custom telephony and does not apply when you are using Retell * Telephony. If omitted, the default value is false. */ ignore_e164_validation?: boolean; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } namespace TransferCallTool { interface TransferDestinationPredefined { /** * The number to transfer to in E.164 format or a dynamic variable like * {{transfer_number}}. */ number: string; /** * The type of transfer destination. */ type: 'predefined'; /** * Extension digits to dial after the main number connects. Sent via DTMF. Allow * digits, '\*', '#', or a dynamic variable like {{extension}}. */ extension?: string; } interface TransferDestinationInferred { /** * The prompt to be used to help infer the transfer destination. The model will * take the global prompt, the call transcript, and this prompt together to deduce * the right number to transfer to. Can contain dynamic variables. */ prompt: string; /** * The type of transfer destination. */ type: 'inferred'; } interface TransferOptionColdTransfer { /** * The type of the transfer. */ type: 'cold_transfer'; /** * The mode of the cold transfer. If set to `sip_refer`, will use SIP REFER to * transfer the call. If set to `sip_invite`, will use SIP INVITE to transfer the * call. */ cold_transfer_mode?: 'sip_refer' | 'sip_invite'; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring. Requires the telephony side to support caller id override. Retell * Twilio numbers support this option. This parameter takes effect only when * `cold_transfer_mode` is set to `sip_invite`. When using `sip_refer`, this option * is not available. Retell Twilio numbers always use user's number as the caller * id when using `sip refer` cold transfer mode. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } interface TransferOptionWarmTransfer { /** * The type of the transfer. */ type: 'warm_transfer'; /** * The time to wait before considering transfer fails. */ agent_detection_timeout_ms?: number; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ ivr_option?: TransferOptionWarmTransfer.IvrOption; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set to true, will not perform human detection for the transfer. Default to * false. */ opt_out_human_detection?: boolean; /** * If set, when transfer is connected, will say the handoff message only to the * agent receiving the transfer. Can leave either a static message or a dynamic one * based on prompt. Set to null to disable warm handoff. */ private_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionWarmTransfer { /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ interface IvrOption { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } interface TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ agentic_transfer_config: TransferOptionAgenticWarmTransfer.AgenticTransferConfig; /** * The type of the transfer. */ type: 'agentic_warm_transfer'; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionAgenticWarmTransfer.WarmTransferPrompt | TransferOptionAgenticWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ interface AgenticTransferConfig { /** * The action to take when the transfer agent times out without making a decision. * Defaults to cancel_transfer. */ action_on_timeout?: 'bridge_transfer' | 'cancel_transfer'; /** * The agent that will mediate the transfer decision. */ transfer_agent?: AgenticTransferConfig.TransferAgent; /** * The maximum time to wait for the transfer agent to make a decision, in * milliseconds. Defaults to 30000 (30 seconds). */ transfer_timeout_ms?: number; } namespace AgenticTransferConfig { /** * The agent that will mediate the transfer decision. */ interface TransferAgent { /** * The agent ID of the transfer agent. This agent must have isTransferAgent set to * true and should use bridge_transfer and cancel_transfer tools (for Retell LLM) * or BridgeTransferNode and CancelTransferNode (for Conversation Flow). */ agent_id: string; /** * The version of the transfer agent to use. */ agent_version: string | number; } } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } } interface CheckAvailabilityCalTool { /** * Cal.com Api key that have access to the cal.com event you want to check * availability for. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to check * availability for. Can be a number or a dynamic variable in the format * `{{variable_name}}` that will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'check_availability_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when checking availability, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface BookAppointmentCalTool { /** * Cal.com Api key that have access to the cal.com event you want to book * appointment. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to book appointment. * Can be a number or a dynamic variable in the format `{{variable_name}}` that * will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'book_appointment_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when booking appointment, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface AgentSwapTool { /** * The id of the agent to swap to. */ agent_id: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; /** * Post call analysis setting for the agent swap. */ post_call_analysis_setting: 'both_agents' | 'only_destination_agent'; type: 'agent_swap'; /** * The version of the agent to swap to. If not specified, will use the latest * version. */ agent_version?: string | number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * The message for the agent to speak when executing agent swap. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, keep the current language when swapping agents. Defaults to false. */ keep_current_language?: boolean; /** * If true, keep the current voice and ambient sound settings when swapping agents. * Otherwise, use the destination agent's voice and ambient sound settings. * Defaults to false. */ keep_current_voice?: boolean; speak_during_execution?: boolean; /** * Webhook setting for the agent swap, defaults to only source. */ webhook_setting?: 'both_agents' | 'only_destination_agent' | 'only_source_agent'; } interface PressDigitTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'press_digit'; /** * Delay in milliseconds before pressing the digit, because a lot of IVR systems * speak very slowly, and a delay can make sure the agent hears the full menu. * Default to 1000 ms (1s). Valid range is 0 to 5000 ms (inclusive). */ delay_ms?: number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; } interface SendSMSTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; sms_content: SendSMSTool.SMSContentPredefined | SendSMSTool.SMSContentInferred | SendSMSTool.SMSContentTemplate; type: 'send_sms'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say before sending the SMS. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the agent will speak a short line before sending the SMS. If omitted, * defaults to true (same as end_call / transfer_call tools). */ speak_during_execution?: boolean; } namespace SendSMSTool { interface SMSContentPredefined { /** * The static message to be sent in the SMS. Can contain dynamic variables. */ text?: string; type?: 'predefined'; } interface SMSContentInferred { /** * The prompt to be used to help infer the SMS content. The model will take the * global prompt, the call transcript, and this prompt together to deduce the right * message to send. Can contain dynamic variables. */ prompt?: string; type?: 'inferred'; } interface SMSContentTemplate { /** * The template to use for the SMS content. "info_collection" sends a predefined * message requesting information from the user. */ template: 'info_collection'; type: 'template'; } } interface CustomTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'custom'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ url: string; /** * If set to true, the parameters will be passed as root level JSON object instead * of nested under "args". */ args_at_root?: boolean; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. Useful when the tool takes a noticeable amount of time to prevent * silence on the call. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * Headers to add to the request. */ headers?: { [key: string]: string; }; /** * Maximum number of times to retry the request after a failed attempt, from 0 (no * retry) to 5. Retries happen on any failure, with exponential backoff between * attempts; the backoff delay is not configurable. `timeout_ms` applies per * attempt rather than as a budget across all attempts, so an attempt that times * out is still retried and the worst-case total duration is `timeout_ms` * multiplied by (`max_retry` + 1) as well as any latency incurred by the * exponential backoff + jitter between each retry. Only the final attempt's result * is reported to the agent. Because retries repeat the request, only set this * above 0 if your endpoint is idempotent — a retried request may be processed more * than once. Defaults to 0 (no retry). */ max_retry?: number; /** * Method to use for the request, default to POST. */ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; /** * How the tool's `parameters` are authored and shown in the dashboard editor — * "form" for the visual parameter builder, "json" for a raw JSON Schema. Both * produce the same `parameters` schema; this does not change how the request body * is encoded (see `args_at_root`). */ parameter_type?: 'json' | 'form'; /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ parameters?: CustomTool.Parameters; /** * Query parameters to append to the request URL. */ query_params?: { [key: string]: string; }; /** * A mapping of variable names to JSON paths in the response body. These values * will be extracted from the response and made available as dynamic variables for * use. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the tool can run before it's considered * timeout. If the tool times out, the agent would have that info. The minimum * value allowed is 1000 ms (1 s), and maximum value allowed is 600,000 ms (10 * min). By default, this is set to 120,000 ms (2 min). */ timeout_ms?: number; } namespace CustomTool { /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ interface Parameters { /** * The value of properties is an object, where each key is the name of a property * and each value is a schema used to validate that property. */ properties: unknown; /** * Type must be "object" for a JSON Schema object. */ type: 'object'; /** * List of names of required property when generating this parameter. LLM will do * its best to generate the required properties in its function arguments. Property * must exist in properties. */ required?: Array; } } interface CodeTool { /** * JavaScript code to execute in the sandbox. */ code: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'code'; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * A mapping of variable names to JSON paths in the code execution result. These * mapped values will be extracted and added as dynamic variables. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the tool. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the code can run before it's considered * timeout. Defaults to 30,000 ms (30 s). */ timeout_ms?: number; } interface ExtractDynamicVariableTool { /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'extract_dynamic_variable'; /** * The variables to be extracted. */ variables: Array; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; } namespace ExtractDynamicVariableTool { interface StringAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'string'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Examples of the variable value to teach model the style and syntax. */ examples?: Array; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface EnumAnalysisData { /** * The possible values of the variable, must be non empty array. */ choices: Array; /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'enum'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface BooleanAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'boolean'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface NumberAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'number'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } } interface BridgeTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'bridge_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it bridges the original caller to the transfer target and ends the * transfer agent call. */ description?: string; /** * Describes what to say to user when bridging the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface CancelTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'cancel_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it cancels the transfer, returns the original caller to the main agent, * and ends the transfer agent call. */ description?: string; /** * Describes what to say to user when cancelling the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface McpTool { /** * Description of the MCP tool. */ description: string; /** * Name of the MCP tool. */ name: string; type: 'mcp'; /** * If true, play a typing sound on the agent audio track while this MCP tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * The input schema of the MCP tool. */ input_schema?: { [key: string]: string; }; /** * Unique id of the MCP. */ mcp_id?: string; /** * Response variables to add to dynamic variables, key is the variable name, value * is the path to the variable in the response */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; } } } export interface LlmListResponse { /** * Whether more results are available. */ has_more?: boolean; items?: Array; /** * Pagination key for the next page. */ pagination_key?: string; } export interface LlmCreateParams { /** * If set, the AI will begin the conversation after waiting for the user for the * duration (in milliseconds) specified by this attribute. This only applies if the * agent is configured to wait for the user to speak first. If not set, the agent * will wait indefinitely for the user to speak. */ begin_after_user_silence_ms?: number | null; /** * First utterance said by the agent in the call. If not set, LLM will dynamically * generate a message. If set to "", agent will wait for user to speak first. */ begin_message?: string | null; /** * Default dynamic variables represented as key-value pairs of strings. These are * injected into your Retell LLM prompt and tool description when specific values * are not provided in a request. Only applicable for Retell LLM. */ default_dynamic_variables?: { [key: string]: string; } | null; /** * General prompt appended to system prompt no matter what state the agent is in. * * - System prompt (with state) = general prompt + state prompt. * - System prompt (no state) = general prompt. */ general_prompt?: string | null; /** * A list of tools the model may call (to get external knowledge, call API, etc). * You can select from some common predefined tools like end call, transfer call, * etc; or you can create your own custom tool for the LLM to use. * * - Tools of LLM (with state) = general tools + state tools + state transitions * - Tools of LLM (no state) = general tools */ general_tools?: Array | null; /** * Whether this Retell LLM is used for warm transfer. Can only be set at creation, * and is ignored on update. */ is_transfer_llm?: boolean | null; /** * Knowledge base configuration for RAG retrieval. */ kb_config?: LlmCreateParams.KBConfig | null; /** * A list of knowledge base ids to use for this resource. */ knowledge_base_ids?: Array | null; /** * A list of MCPs to use for this LLM. */ mcps?: Array | null; /** * Select the underlying text LLM. If not set, would default to gpt-4.1. */ model?: 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-5.1' | 'gpt-5.2' | 'gpt-5.4' | 'gpt-5.4-mini' | 'gpt-5.4-nano' | 'gpt-5.5' | 'gpt-5.6-terra' | 'gpt-5.6-luna' | 'claude-4.5-sonnet' | 'claude-4.6-sonnet' | 'claude-5-sonnet' | 'claude-4.5-haiku' | 'gemini-3.0-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | null; /** * If set to true, will use high priority pool with more dedicated resource to * ensure lower and more consistent latency, default to false. This feature usually * comes with a higher cost. */ model_high_priority?: boolean | null; /** * If set, will control the randomness of the response. Value ranging from [0,1]. * Lower value means more deterministic, while higher value means more random. If * unset, default value 0 will apply. Note that for tool calling, a lower value is * recommended. */ model_temperature?: number; /** * Select the underlying speech to speech model. Can only set this or model, not * both. */ s2s_model?: 'gpt-realtime-2.1' | 'gpt-realtime-2.1-mini' | 'gpt-realtime-2' | 'gpt-realtime-1.5' | 'gpt-realtime' | 'gpt-realtime-mini' | null; /** * The speaker who starts the conversation. Required. Must be either 'user' or * 'agent'. */ start_speaker?: 'user' | 'agent'; /** * Name of the starting state. Required if states is not empty. */ starting_state?: string | null; /** * States of the LLM. This is to help reduce prompt length and tool choices when * the call can be broken into distinct states. With shorter prompts and less * tools, the LLM can better focus and follow the rules, minimizing hallucination. * If this field is not set, the agent would only have general prompt and general * tools (essentially one state). */ states?: Array | null; /** * Whether to use strict mode for tool calls. Only applicable when using certain * supported models. */ tool_call_strict_mode?: boolean | null; } export declare namespace LlmCreateParams { interface EndCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'end_call'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when ending the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface TransferCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; transfer_destination: TransferCallTool.TransferDestinationPredefined | TransferCallTool.TransferDestinationInferred; transfer_option: TransferCallTool.TransferOptionColdTransfer | TransferCallTool.TransferOptionWarmTransfer | TransferCallTool.TransferOptionAgenticWarmTransfer; type: 'transfer_call'; /** * Custom SIP headers to be added to the call. */ custom_sip_headers?: { [key: string]: string; }; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when transferring the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the e.164 validation will be ignored for the from_number. This can be * useful when you want to dial to internal pseudo numbers. This only applies when * you are using custom telephony and does not apply when you are using Retell * Telephony. If omitted, the default value is false. */ ignore_e164_validation?: boolean; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } namespace TransferCallTool { interface TransferDestinationPredefined { /** * The number to transfer to in E.164 format or a dynamic variable like * {{transfer_number}}. */ number: string; /** * The type of transfer destination. */ type: 'predefined'; /** * Extension digits to dial after the main number connects. Sent via DTMF. Allow * digits, '\*', '#', or a dynamic variable like {{extension}}. */ extension?: string; } interface TransferDestinationInferred { /** * The prompt to be used to help infer the transfer destination. The model will * take the global prompt, the call transcript, and this prompt together to deduce * the right number to transfer to. Can contain dynamic variables. */ prompt: string; /** * The type of transfer destination. */ type: 'inferred'; } interface TransferOptionColdTransfer { /** * The type of the transfer. */ type: 'cold_transfer'; /** * The mode of the cold transfer. If set to `sip_refer`, will use SIP REFER to * transfer the call. If set to `sip_invite`, will use SIP INVITE to transfer the * call. */ cold_transfer_mode?: 'sip_refer' | 'sip_invite'; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring. Requires the telephony side to support caller id override. Retell * Twilio numbers support this option. This parameter takes effect only when * `cold_transfer_mode` is set to `sip_invite`. When using `sip_refer`, this option * is not available. Retell Twilio numbers always use user's number as the caller * id when using `sip refer` cold transfer mode. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } interface TransferOptionWarmTransfer { /** * The type of the transfer. */ type: 'warm_transfer'; /** * The time to wait before considering transfer fails. */ agent_detection_timeout_ms?: number; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ ivr_option?: TransferOptionWarmTransfer.IvrOption; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set to true, will not perform human detection for the transfer. Default to * false. */ opt_out_human_detection?: boolean; /** * If set, when transfer is connected, will say the handoff message only to the * agent receiving the transfer. Can leave either a static message or a dynamic one * based on prompt. Set to null to disable warm handoff. */ private_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionWarmTransfer { /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ interface IvrOption { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } interface TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ agentic_transfer_config: TransferOptionAgenticWarmTransfer.AgenticTransferConfig; /** * The type of the transfer. */ type: 'agentic_warm_transfer'; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionAgenticWarmTransfer.WarmTransferPrompt | TransferOptionAgenticWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ interface AgenticTransferConfig { /** * The action to take when the transfer agent times out without making a decision. * Defaults to cancel_transfer. */ action_on_timeout?: 'bridge_transfer' | 'cancel_transfer'; /** * The agent that will mediate the transfer decision. */ transfer_agent?: AgenticTransferConfig.TransferAgent; /** * The maximum time to wait for the transfer agent to make a decision, in * milliseconds. Defaults to 30000 (30 seconds). */ transfer_timeout_ms?: number; } namespace AgenticTransferConfig { /** * The agent that will mediate the transfer decision. */ interface TransferAgent { /** * The agent ID of the transfer agent. This agent must have isTransferAgent set to * true and should use bridge_transfer and cancel_transfer tools (for Retell LLM) * or BridgeTransferNode and CancelTransferNode (for Conversation Flow). */ agent_id: string; /** * The version of the transfer agent to use. */ agent_version: string | number; } } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } } interface CheckAvailabilityCalTool { /** * Cal.com Api key that have access to the cal.com event you want to check * availability for. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to check * availability for. Can be a number or a dynamic variable in the format * `{{variable_name}}` that will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'check_availability_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when checking availability, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface BookAppointmentCalTool { /** * Cal.com Api key that have access to the cal.com event you want to book * appointment. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to book appointment. * Can be a number or a dynamic variable in the format `{{variable_name}}` that * will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'book_appointment_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when booking appointment, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface AgentSwapTool { /** * The id of the agent to swap to. */ agent_id: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; /** * Post call analysis setting for the agent swap. */ post_call_analysis_setting: 'both_agents' | 'only_destination_agent'; type: 'agent_swap'; /** * The version of the agent to swap to. If not specified, will use the latest * version. */ agent_version?: string | number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * The message for the agent to speak when executing agent swap. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, keep the current language when swapping agents. Defaults to false. */ keep_current_language?: boolean; /** * If true, keep the current voice and ambient sound settings when swapping agents. * Otherwise, use the destination agent's voice and ambient sound settings. * Defaults to false. */ keep_current_voice?: boolean; speak_during_execution?: boolean; /** * Webhook setting for the agent swap, defaults to only source. */ webhook_setting?: 'both_agents' | 'only_destination_agent' | 'only_source_agent'; } interface PressDigitTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'press_digit'; /** * Delay in milliseconds before pressing the digit, because a lot of IVR systems * speak very slowly, and a delay can make sure the agent hears the full menu. * Default to 1000 ms (1s). Valid range is 0 to 5000 ms (inclusive). */ delay_ms?: number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; } interface SendSMSTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; sms_content: SendSMSTool.SMSContentPredefined | SendSMSTool.SMSContentInferred | SendSMSTool.SMSContentTemplate; type: 'send_sms'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say before sending the SMS. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the agent will speak a short line before sending the SMS. If omitted, * defaults to true (same as end_call / transfer_call tools). */ speak_during_execution?: boolean; } namespace SendSMSTool { interface SMSContentPredefined { /** * The static message to be sent in the SMS. Can contain dynamic variables. */ text?: string; type?: 'predefined'; } interface SMSContentInferred { /** * The prompt to be used to help infer the SMS content. The model will take the * global prompt, the call transcript, and this prompt together to deduce the right * message to send. Can contain dynamic variables. */ prompt?: string; type?: 'inferred'; } interface SMSContentTemplate { /** * The template to use for the SMS content. "info_collection" sends a predefined * message requesting information from the user. */ template: 'info_collection'; type: 'template'; } } interface CustomTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'custom'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ url: string; /** * If set to true, the parameters will be passed as root level JSON object instead * of nested under "args". */ args_at_root?: boolean; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. Useful when the tool takes a noticeable amount of time to prevent * silence on the call. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * Headers to add to the request. */ headers?: { [key: string]: string; }; /** * Maximum number of times to retry the request after a failed attempt, from 0 (no * retry) to 5. Retries happen on any failure, with exponential backoff between * attempts; the backoff delay is not configurable. `timeout_ms` applies per * attempt rather than as a budget across all attempts, so an attempt that times * out is still retried and the worst-case total duration is `timeout_ms` * multiplied by (`max_retry` + 1) as well as any latency incurred by the * exponential backoff + jitter between each retry. Only the final attempt's result * is reported to the agent. Because retries repeat the request, only set this * above 0 if your endpoint is idempotent — a retried request may be processed more * than once. Defaults to 0 (no retry). */ max_retry?: number; /** * Method to use for the request, default to POST. */ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; /** * How the tool's `parameters` are authored and shown in the dashboard editor — * "form" for the visual parameter builder, "json" for a raw JSON Schema. Both * produce the same `parameters` schema; this does not change how the request body * is encoded (see `args_at_root`). */ parameter_type?: 'json' | 'form'; /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ parameters?: CustomTool.Parameters; /** * Query parameters to append to the request URL. */ query_params?: { [key: string]: string; }; /** * A mapping of variable names to JSON paths in the response body. These values * will be extracted from the response and made available as dynamic variables for * use. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the tool can run before it's considered * timeout. If the tool times out, the agent would have that info. The minimum * value allowed is 1000 ms (1 s), and maximum value allowed is 600,000 ms (10 * min). By default, this is set to 120,000 ms (2 min). */ timeout_ms?: number; } namespace CustomTool { /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ interface Parameters { /** * The value of properties is an object, where each key is the name of a property * and each value is a schema used to validate that property. */ properties: unknown; /** * Type must be "object" for a JSON Schema object. */ type: 'object'; /** * List of names of required property when generating this parameter. LLM will do * its best to generate the required properties in its function arguments. Property * must exist in properties. */ required?: Array; } } interface CodeTool { /** * JavaScript code to execute in the sandbox. */ code: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'code'; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * A mapping of variable names to JSON paths in the code execution result. These * mapped values will be extracted and added as dynamic variables. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the tool. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the code can run before it's considered * timeout. Defaults to 30,000 ms (30 s). */ timeout_ms?: number; } interface ExtractDynamicVariableTool { /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'extract_dynamic_variable'; /** * The variables to be extracted. */ variables: Array; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; } namespace ExtractDynamicVariableTool { interface StringAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'string'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Examples of the variable value to teach model the style and syntax. */ examples?: Array; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface EnumAnalysisData { /** * The possible values of the variable, must be non empty array. */ choices: Array; /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'enum'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface BooleanAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'boolean'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface NumberAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'number'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } } interface BridgeTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'bridge_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it bridges the original caller to the transfer target and ends the * transfer agent call. */ description?: string; /** * Describes what to say to user when bridging the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface CancelTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'cancel_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it cancels the transfer, returns the original caller to the main agent, * and ends the transfer agent call. */ description?: string; /** * Describes what to say to user when cancelling the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface McpTool { /** * Description of the MCP tool. */ description: string; /** * Name of the MCP tool. */ name: string; type: 'mcp'; /** * If true, play a typing sound on the agent audio track while this MCP tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * The input schema of the MCP tool. */ input_schema?: { [key: string]: string; }; /** * Unique id of the MCP. */ mcp_id?: string; /** * Response variables to add to dynamic variables, key is the variable name, value * is the path to the variable in the response */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; } /** * Knowledge base configuration for RAG retrieval. */ interface KBConfig { /** * Similarity threshold for filtering search results */ filter_score?: number; /** * Max number of knowledge base chunks to retrieve */ top_k?: number; } interface Mcp { name: string; /** * The URL of the MCP server. */ url: string; /** * Headers to add to the MCP connection request. */ headers?: { [key: string]: string; }; /** * Query parameters to append to the MCP connection request URL. */ query_params?: { [key: string]: string; }; /** * Maximum time to wait for a connection to be established (in milliseconds). * Default to 120,000 ms (2 minutes). */ timeout_ms?: number; } interface State { /** * Name of the state, must be unique for each state. Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; /** * Edges of the state define how and what state can be reached from this state. */ edges?: Array; /** * Prompt of the state, will be appended to the system prompt of LLM. * * - System prompt = general prompt + state prompt. */ state_prompt?: string; /** * A list of tools specific to this state the model may call (to get external * knowledge, call API, etc). You can select from some common predefined tools like * end call, transfer call, etc; or you can create your own custom tool for the LLM * to use. * * - Tools of LLM = general tools + state tools + state transitions */ tools?: Array; } namespace State { interface Edge { /** * Describes what's the transition and at what time / criteria should this * transition happen. */ description: string; /** * The destination state name when going through transition of state via this edge. * State transition internally is implemented as a tool call of LLM, and a tool * call with name "transition*to*{destination_state_name}" will get created. Feel * free to reference it inside the prompt. */ destination_state_name: string; /** * Describes what parameters you want to extract out when the transition changes. * The parameters extracted here can be referenced in prompts & function * descriptions of later states via dynamic variables. The parameters the functions * accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. */ parameters?: Edge.Parameters; } namespace Edge { /** * Describes what parameters you want to extract out when the transition changes. * The parameters extracted here can be referenced in prompts & function * descriptions of later states via dynamic variables. The parameters the functions * accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. */ interface Parameters { /** * The value of properties is an object, where each key is the name of a property * and each value is a schema used to validate that property. */ properties: unknown; /** * Type must be "object" for a JSON Schema object. */ type: 'object'; /** * List of names of required property when generating this parameter. LLM will do * its best to generate the required properties in its function arguments. Property * must exist in properties. */ required?: Array; } } interface EndCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'end_call'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when ending the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface TransferCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; transfer_destination: TransferCallTool.TransferDestinationPredefined | TransferCallTool.TransferDestinationInferred; transfer_option: TransferCallTool.TransferOptionColdTransfer | TransferCallTool.TransferOptionWarmTransfer | TransferCallTool.TransferOptionAgenticWarmTransfer; type: 'transfer_call'; /** * Custom SIP headers to be added to the call. */ custom_sip_headers?: { [key: string]: string; }; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when transferring the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the e.164 validation will be ignored for the from_number. This can be * useful when you want to dial to internal pseudo numbers. This only applies when * you are using custom telephony and does not apply when you are using Retell * Telephony. If omitted, the default value is false. */ ignore_e164_validation?: boolean; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } namespace TransferCallTool { interface TransferDestinationPredefined { /** * The number to transfer to in E.164 format or a dynamic variable like * {{transfer_number}}. */ number: string; /** * The type of transfer destination. */ type: 'predefined'; /** * Extension digits to dial after the main number connects. Sent via DTMF. Allow * digits, '\*', '#', or a dynamic variable like {{extension}}. */ extension?: string; } interface TransferDestinationInferred { /** * The prompt to be used to help infer the transfer destination. The model will * take the global prompt, the call transcript, and this prompt together to deduce * the right number to transfer to. Can contain dynamic variables. */ prompt: string; /** * The type of transfer destination. */ type: 'inferred'; } interface TransferOptionColdTransfer { /** * The type of the transfer. */ type: 'cold_transfer'; /** * The mode of the cold transfer. If set to `sip_refer`, will use SIP REFER to * transfer the call. If set to `sip_invite`, will use SIP INVITE to transfer the * call. */ cold_transfer_mode?: 'sip_refer' | 'sip_invite'; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring. Requires the telephony side to support caller id override. Retell * Twilio numbers support this option. This parameter takes effect only when * `cold_transfer_mode` is set to `sip_invite`. When using `sip_refer`, this option * is not available. Retell Twilio numbers always use user's number as the caller * id when using `sip refer` cold transfer mode. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } interface TransferOptionWarmTransfer { /** * The type of the transfer. */ type: 'warm_transfer'; /** * The time to wait before considering transfer fails. */ agent_detection_timeout_ms?: number; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ ivr_option?: TransferOptionWarmTransfer.IvrOption; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set to true, will not perform human detection for the transfer. Default to * false. */ opt_out_human_detection?: boolean; /** * If set, when transfer is connected, will say the handoff message only to the * agent receiving the transfer. Can leave either a static message or a dynamic one * based on prompt. Set to null to disable warm handoff. */ private_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionWarmTransfer { /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ interface IvrOption { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } interface TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ agentic_transfer_config: TransferOptionAgenticWarmTransfer.AgenticTransferConfig; /** * The type of the transfer. */ type: 'agentic_warm_transfer'; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionAgenticWarmTransfer.WarmTransferPrompt | TransferOptionAgenticWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ interface AgenticTransferConfig { /** * The action to take when the transfer agent times out without making a decision. * Defaults to cancel_transfer. */ action_on_timeout?: 'bridge_transfer' | 'cancel_transfer'; /** * The agent that will mediate the transfer decision. */ transfer_agent?: AgenticTransferConfig.TransferAgent; /** * The maximum time to wait for the transfer agent to make a decision, in * milliseconds. Defaults to 30000 (30 seconds). */ transfer_timeout_ms?: number; } namespace AgenticTransferConfig { /** * The agent that will mediate the transfer decision. */ interface TransferAgent { /** * The agent ID of the transfer agent. This agent must have isTransferAgent set to * true and should use bridge_transfer and cancel_transfer tools (for Retell LLM) * or BridgeTransferNode and CancelTransferNode (for Conversation Flow). */ agent_id: string; /** * The version of the transfer agent to use. */ agent_version: string | number; } } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } } interface CheckAvailabilityCalTool { /** * Cal.com Api key that have access to the cal.com event you want to check * availability for. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to check * availability for. Can be a number or a dynamic variable in the format * `{{variable_name}}` that will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'check_availability_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when checking availability, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface BookAppointmentCalTool { /** * Cal.com Api key that have access to the cal.com event you want to book * appointment. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to book appointment. * Can be a number or a dynamic variable in the format `{{variable_name}}` that * will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'book_appointment_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when booking appointment, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface AgentSwapTool { /** * The id of the agent to swap to. */ agent_id: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; /** * Post call analysis setting for the agent swap. */ post_call_analysis_setting: 'both_agents' | 'only_destination_agent'; type: 'agent_swap'; /** * The version of the agent to swap to. If not specified, will use the latest * version. */ agent_version?: string | number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * The message for the agent to speak when executing agent swap. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, keep the current language when swapping agents. Defaults to false. */ keep_current_language?: boolean; /** * If true, keep the current voice and ambient sound settings when swapping agents. * Otherwise, use the destination agent's voice and ambient sound settings. * Defaults to false. */ keep_current_voice?: boolean; speak_during_execution?: boolean; /** * Webhook setting for the agent swap, defaults to only source. */ webhook_setting?: 'both_agents' | 'only_destination_agent' | 'only_source_agent'; } interface PressDigitTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'press_digit'; /** * Delay in milliseconds before pressing the digit, because a lot of IVR systems * speak very slowly, and a delay can make sure the agent hears the full menu. * Default to 1000 ms (1s). Valid range is 0 to 5000 ms (inclusive). */ delay_ms?: number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; } interface SendSMSTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; sms_content: SendSMSTool.SMSContentPredefined | SendSMSTool.SMSContentInferred | SendSMSTool.SMSContentTemplate; type: 'send_sms'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say before sending the SMS. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the agent will speak a short line before sending the SMS. If omitted, * defaults to true (same as end_call / transfer_call tools). */ speak_during_execution?: boolean; } namespace SendSMSTool { interface SMSContentPredefined { /** * The static message to be sent in the SMS. Can contain dynamic variables. */ text?: string; type?: 'predefined'; } interface SMSContentInferred { /** * The prompt to be used to help infer the SMS content. The model will take the * global prompt, the call transcript, and this prompt together to deduce the right * message to send. Can contain dynamic variables. */ prompt?: string; type?: 'inferred'; } interface SMSContentTemplate { /** * The template to use for the SMS content. "info_collection" sends a predefined * message requesting information from the user. */ template: 'info_collection'; type: 'template'; } } interface CustomTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'custom'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ url: string; /** * If set to true, the parameters will be passed as root level JSON object instead * of nested under "args". */ args_at_root?: boolean; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. Useful when the tool takes a noticeable amount of time to prevent * silence on the call. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * Headers to add to the request. */ headers?: { [key: string]: string; }; /** * Maximum number of times to retry the request after a failed attempt, from 0 (no * retry) to 5. Retries happen on any failure, with exponential backoff between * attempts; the backoff delay is not configurable. `timeout_ms` applies per * attempt rather than as a budget across all attempts, so an attempt that times * out is still retried and the worst-case total duration is `timeout_ms` * multiplied by (`max_retry` + 1) as well as any latency incurred by the * exponential backoff + jitter between each retry. Only the final attempt's result * is reported to the agent. Because retries repeat the request, only set this * above 0 if your endpoint is idempotent — a retried request may be processed more * than once. Defaults to 0 (no retry). */ max_retry?: number; /** * Method to use for the request, default to POST. */ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; /** * How the tool's `parameters` are authored and shown in the dashboard editor — * "form" for the visual parameter builder, "json" for a raw JSON Schema. Both * produce the same `parameters` schema; this does not change how the request body * is encoded (see `args_at_root`). */ parameter_type?: 'json' | 'form'; /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ parameters?: CustomTool.Parameters; /** * Query parameters to append to the request URL. */ query_params?: { [key: string]: string; }; /** * A mapping of variable names to JSON paths in the response body. These values * will be extracted from the response and made available as dynamic variables for * use. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the tool can run before it's considered * timeout. If the tool times out, the agent would have that info. The minimum * value allowed is 1000 ms (1 s), and maximum value allowed is 600,000 ms (10 * min). By default, this is set to 120,000 ms (2 min). */ timeout_ms?: number; } namespace CustomTool { /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ interface Parameters { /** * The value of properties is an object, where each key is the name of a property * and each value is a schema used to validate that property. */ properties: unknown; /** * Type must be "object" for a JSON Schema object. */ type: 'object'; /** * List of names of required property when generating this parameter. LLM will do * its best to generate the required properties in its function arguments. Property * must exist in properties. */ required?: Array; } } interface CodeTool { /** * JavaScript code to execute in the sandbox. */ code: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'code'; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * A mapping of variable names to JSON paths in the code execution result. These * mapped values will be extracted and added as dynamic variables. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the tool. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the code can run before it's considered * timeout. Defaults to 30,000 ms (30 s). */ timeout_ms?: number; } interface ExtractDynamicVariableTool { /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'extract_dynamic_variable'; /** * The variables to be extracted. */ variables: Array; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; } namespace ExtractDynamicVariableTool { interface StringAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'string'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Examples of the variable value to teach model the style and syntax. */ examples?: Array; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface EnumAnalysisData { /** * The possible values of the variable, must be non empty array. */ choices: Array; /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'enum'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface BooleanAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'boolean'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface NumberAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'number'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } } interface BridgeTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'bridge_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it bridges the original caller to the transfer target and ends the * transfer agent call. */ description?: string; /** * Describes what to say to user when bridging the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface CancelTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'cancel_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it cancels the transfer, returns the original caller to the main agent, * and ends the transfer agent call. */ description?: string; /** * Describes what to say to user when cancelling the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface McpTool { /** * Description of the MCP tool. */ description: string; /** * Name of the MCP tool. */ name: string; type: 'mcp'; /** * If true, play a typing sound on the agent audio track while this MCP tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * The input schema of the MCP tool. */ input_schema?: { [key: string]: string; }; /** * Unique id of the MCP. */ mcp_id?: string; /** * Response variables to add to dynamic variables, key is the variable name, value * is the path to the variable in the response */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; } } } export interface LlmRetrieveParams { /** * Optional version of the API to use for this request. Default to latest version. */ version?: number; } export interface LlmUpdateParams { /** * Query param: Optional version of the API to use for this request. Default to * latest version. */ version?: number; /** * Body param: If set, the AI will begin the conversation after waiting for the * user for the duration (in milliseconds) specified by this attribute. This only * applies if the agent is configured to wait for the user to speak first. If not * set, the agent will wait indefinitely for the user to speak. */ begin_after_user_silence_ms?: number | null; /** * Body param: First utterance said by the agent in the call. If not set, LLM will * dynamically generate a message. If set to "", agent will wait for user to speak * first. */ begin_message?: string | null; /** * Body param: Default dynamic variables represented as key-value pairs of strings. * These are injected into your Retell LLM prompt and tool description when * specific values are not provided in a request. Only applicable for Retell LLM. */ default_dynamic_variables?: { [key: string]: string; } | null; /** * Body param: General prompt appended to system prompt no matter what state the * agent is in. * * - System prompt (with state) = general prompt + state prompt. * - System prompt (no state) = general prompt. */ general_prompt?: string | null; /** * Body param: A list of tools the model may call (to get external knowledge, call * API, etc). You can select from some common predefined tools like end call, * transfer call, etc; or you can create your own custom tool for the LLM to use. * * - Tools of LLM (with state) = general tools + state tools + state transitions * - Tools of LLM (no state) = general tools */ general_tools?: Array | null; /** * Body param: Whether this Retell LLM is used for warm transfer. Can only be set * at creation, and is ignored on update. */ is_transfer_llm?: boolean | null; /** * Body param: Knowledge base configuration for RAG retrieval. */ kb_config?: LlmUpdateParams.KBConfig | null; /** * Body param: A list of knowledge base ids to use for this resource. */ knowledge_base_ids?: Array | null; /** * Body param: A list of MCPs to use for this LLM. */ mcps?: Array | null; /** * Body param: Select the underlying text LLM. If not set, would default to * gpt-4.1. */ model?: 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano' | 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-5.1' | 'gpt-5.2' | 'gpt-5.4' | 'gpt-5.4-mini' | 'gpt-5.4-nano' | 'gpt-5.5' | 'gpt-5.6-terra' | 'gpt-5.6-luna' | 'claude-4.5-sonnet' | 'claude-4.6-sonnet' | 'claude-5-sonnet' | 'claude-4.5-haiku' | 'gemini-3.0-flash' | 'gemini-3.1-flash-lite' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | null; /** * Body param: If set to true, will use high priority pool with more dedicated * resource to ensure lower and more consistent latency, default to false. This * feature usually comes with a higher cost. */ model_high_priority?: boolean | null; /** * Body param: If set, will control the randomness of the response. Value ranging * from [0,1]. Lower value means more deterministic, while higher value means more * random. If unset, default value 0 will apply. Note that for tool calling, a * lower value is recommended. */ model_temperature?: number; /** * Body param: Select the underlying speech to speech model. Can only set this or * model, not both. */ s2s_model?: 'gpt-realtime-2.1' | 'gpt-realtime-2.1-mini' | 'gpt-realtime-2' | 'gpt-realtime-1.5' | 'gpt-realtime' | 'gpt-realtime-mini' | null; /** * Body param: The speaker who starts the conversation. Required. Must be either * 'user' or 'agent'. */ start_speaker?: 'user' | 'agent'; /** * Body param: Name of the starting state. Required if states is not empty. */ starting_state?: string | null; /** * Body param: States of the LLM. This is to help reduce prompt length and tool * choices when the call can be broken into distinct states. With shorter prompts * and less tools, the LLM can better focus and follow the rules, minimizing * hallucination. If this field is not set, the agent would only have general * prompt and general tools (essentially one state). */ states?: Array | null; /** * Body param: Whether to use strict mode for tool calls. Only applicable when * using certain supported models. */ tool_call_strict_mode?: boolean | null; } export declare namespace LlmUpdateParams { interface EndCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'end_call'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when ending the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface TransferCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; transfer_destination: TransferCallTool.TransferDestinationPredefined | TransferCallTool.TransferDestinationInferred; transfer_option: TransferCallTool.TransferOptionColdTransfer | TransferCallTool.TransferOptionWarmTransfer | TransferCallTool.TransferOptionAgenticWarmTransfer; type: 'transfer_call'; /** * Custom SIP headers to be added to the call. */ custom_sip_headers?: { [key: string]: string; }; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when transferring the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the e.164 validation will be ignored for the from_number. This can be * useful when you want to dial to internal pseudo numbers. This only applies when * you are using custom telephony and does not apply when you are using Retell * Telephony. If omitted, the default value is false. */ ignore_e164_validation?: boolean; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } namespace TransferCallTool { interface TransferDestinationPredefined { /** * The number to transfer to in E.164 format or a dynamic variable like * {{transfer_number}}. */ number: string; /** * The type of transfer destination. */ type: 'predefined'; /** * Extension digits to dial after the main number connects. Sent via DTMF. Allow * digits, '\*', '#', or a dynamic variable like {{extension}}. */ extension?: string; } interface TransferDestinationInferred { /** * The prompt to be used to help infer the transfer destination. The model will * take the global prompt, the call transcript, and this prompt together to deduce * the right number to transfer to. Can contain dynamic variables. */ prompt: string; /** * The type of transfer destination. */ type: 'inferred'; } interface TransferOptionColdTransfer { /** * The type of the transfer. */ type: 'cold_transfer'; /** * The mode of the cold transfer. If set to `sip_refer`, will use SIP REFER to * transfer the call. If set to `sip_invite`, will use SIP INVITE to transfer the * call. */ cold_transfer_mode?: 'sip_refer' | 'sip_invite'; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring. Requires the telephony side to support caller id override. Retell * Twilio numbers support this option. This parameter takes effect only when * `cold_transfer_mode` is set to `sip_invite`. When using `sip_refer`, this option * is not available. Retell Twilio numbers always use user's number as the caller * id when using `sip refer` cold transfer mode. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } interface TransferOptionWarmTransfer { /** * The type of the transfer. */ type: 'warm_transfer'; /** * The time to wait before considering transfer fails. */ agent_detection_timeout_ms?: number; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ ivr_option?: TransferOptionWarmTransfer.IvrOption; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set to true, will not perform human detection for the transfer. Default to * false. */ opt_out_human_detection?: boolean; /** * If set, when transfer is connected, will say the handoff message only to the * agent receiving the transfer. Can leave either a static message or a dynamic one * based on prompt. Set to null to disable warm handoff. */ private_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionWarmTransfer { /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ interface IvrOption { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } interface TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ agentic_transfer_config: TransferOptionAgenticWarmTransfer.AgenticTransferConfig; /** * The type of the transfer. */ type: 'agentic_warm_transfer'; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionAgenticWarmTransfer.WarmTransferPrompt | TransferOptionAgenticWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ interface AgenticTransferConfig { /** * The action to take when the transfer agent times out without making a decision. * Defaults to cancel_transfer. */ action_on_timeout?: 'bridge_transfer' | 'cancel_transfer'; /** * The agent that will mediate the transfer decision. */ transfer_agent?: AgenticTransferConfig.TransferAgent; /** * The maximum time to wait for the transfer agent to make a decision, in * milliseconds. Defaults to 30000 (30 seconds). */ transfer_timeout_ms?: number; } namespace AgenticTransferConfig { /** * The agent that will mediate the transfer decision. */ interface TransferAgent { /** * The agent ID of the transfer agent. This agent must have isTransferAgent set to * true and should use bridge_transfer and cancel_transfer tools (for Retell LLM) * or BridgeTransferNode and CancelTransferNode (for Conversation Flow). */ agent_id: string; /** * The version of the transfer agent to use. */ agent_version: string | number; } } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } } interface CheckAvailabilityCalTool { /** * Cal.com Api key that have access to the cal.com event you want to check * availability for. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to check * availability for. Can be a number or a dynamic variable in the format * `{{variable_name}}` that will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'check_availability_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when checking availability, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface BookAppointmentCalTool { /** * Cal.com Api key that have access to the cal.com event you want to book * appointment. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to book appointment. * Can be a number or a dynamic variable in the format `{{variable_name}}` that * will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'book_appointment_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when booking appointment, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface AgentSwapTool { /** * The id of the agent to swap to. */ agent_id: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; /** * Post call analysis setting for the agent swap. */ post_call_analysis_setting: 'both_agents' | 'only_destination_agent'; type: 'agent_swap'; /** * The version of the agent to swap to. If not specified, will use the latest * version. */ agent_version?: string | number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * The message for the agent to speak when executing agent swap. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, keep the current language when swapping agents. Defaults to false. */ keep_current_language?: boolean; /** * If true, keep the current voice and ambient sound settings when swapping agents. * Otherwise, use the destination agent's voice and ambient sound settings. * Defaults to false. */ keep_current_voice?: boolean; speak_during_execution?: boolean; /** * Webhook setting for the agent swap, defaults to only source. */ webhook_setting?: 'both_agents' | 'only_destination_agent' | 'only_source_agent'; } interface PressDigitTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'press_digit'; /** * Delay in milliseconds before pressing the digit, because a lot of IVR systems * speak very slowly, and a delay can make sure the agent hears the full menu. * Default to 1000 ms (1s). Valid range is 0 to 5000 ms (inclusive). */ delay_ms?: number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; } interface SendSMSTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; sms_content: SendSMSTool.SMSContentPredefined | SendSMSTool.SMSContentInferred | SendSMSTool.SMSContentTemplate; type: 'send_sms'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say before sending the SMS. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the agent will speak a short line before sending the SMS. If omitted, * defaults to true (same as end_call / transfer_call tools). */ speak_during_execution?: boolean; } namespace SendSMSTool { interface SMSContentPredefined { /** * The static message to be sent in the SMS. Can contain dynamic variables. */ text?: string; type?: 'predefined'; } interface SMSContentInferred { /** * The prompt to be used to help infer the SMS content. The model will take the * global prompt, the call transcript, and this prompt together to deduce the right * message to send. Can contain dynamic variables. */ prompt?: string; type?: 'inferred'; } interface SMSContentTemplate { /** * The template to use for the SMS content. "info_collection" sends a predefined * message requesting information from the user. */ template: 'info_collection'; type: 'template'; } } interface CustomTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'custom'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ url: string; /** * If set to true, the parameters will be passed as root level JSON object instead * of nested under "args". */ args_at_root?: boolean; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. Useful when the tool takes a noticeable amount of time to prevent * silence on the call. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * Headers to add to the request. */ headers?: { [key: string]: string; }; /** * Maximum number of times to retry the request after a failed attempt, from 0 (no * retry) to 5. Retries happen on any failure, with exponential backoff between * attempts; the backoff delay is not configurable. `timeout_ms` applies per * attempt rather than as a budget across all attempts, so an attempt that times * out is still retried and the worst-case total duration is `timeout_ms` * multiplied by (`max_retry` + 1) as well as any latency incurred by the * exponential backoff + jitter between each retry. Only the final attempt's result * is reported to the agent. Because retries repeat the request, only set this * above 0 if your endpoint is idempotent — a retried request may be processed more * than once. Defaults to 0 (no retry). */ max_retry?: number; /** * Method to use for the request, default to POST. */ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; /** * How the tool's `parameters` are authored and shown in the dashboard editor — * "form" for the visual parameter builder, "json" for a raw JSON Schema. Both * produce the same `parameters` schema; this does not change how the request body * is encoded (see `args_at_root`). */ parameter_type?: 'json' | 'form'; /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ parameters?: CustomTool.Parameters; /** * Query parameters to append to the request URL. */ query_params?: { [key: string]: string; }; /** * A mapping of variable names to JSON paths in the response body. These values * will be extracted from the response and made available as dynamic variables for * use. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the tool can run before it's considered * timeout. If the tool times out, the agent would have that info. The minimum * value allowed is 1000 ms (1 s), and maximum value allowed is 600,000 ms (10 * min). By default, this is set to 120,000 ms (2 min). */ timeout_ms?: number; } namespace CustomTool { /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ interface Parameters { /** * The value of properties is an object, where each key is the name of a property * and each value is a schema used to validate that property. */ properties: unknown; /** * Type must be "object" for a JSON Schema object. */ type: 'object'; /** * List of names of required property when generating this parameter. LLM will do * its best to generate the required properties in its function arguments. Property * must exist in properties. */ required?: Array; } } interface CodeTool { /** * JavaScript code to execute in the sandbox. */ code: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'code'; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * A mapping of variable names to JSON paths in the code execution result. These * mapped values will be extracted and added as dynamic variables. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the tool. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the code can run before it's considered * timeout. Defaults to 30,000 ms (30 s). */ timeout_ms?: number; } interface ExtractDynamicVariableTool { /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'extract_dynamic_variable'; /** * The variables to be extracted. */ variables: Array; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; } namespace ExtractDynamicVariableTool { interface StringAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'string'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Examples of the variable value to teach model the style and syntax. */ examples?: Array; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface EnumAnalysisData { /** * The possible values of the variable, must be non empty array. */ choices: Array; /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'enum'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface BooleanAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'boolean'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface NumberAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'number'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } } interface BridgeTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'bridge_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it bridges the original caller to the transfer target and ends the * transfer agent call. */ description?: string; /** * Describes what to say to user when bridging the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface CancelTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'cancel_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it cancels the transfer, returns the original caller to the main agent, * and ends the transfer agent call. */ description?: string; /** * Describes what to say to user when cancelling the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface McpTool { /** * Description of the MCP tool. */ description: string; /** * Name of the MCP tool. */ name: string; type: 'mcp'; /** * If true, play a typing sound on the agent audio track while this MCP tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * The input schema of the MCP tool. */ input_schema?: { [key: string]: string; }; /** * Unique id of the MCP. */ mcp_id?: string; /** * Response variables to add to dynamic variables, key is the variable name, value * is the path to the variable in the response */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; } /** * Knowledge base configuration for RAG retrieval. */ interface KBConfig { /** * Similarity threshold for filtering search results */ filter_score?: number; /** * Max number of knowledge base chunks to retrieve */ top_k?: number; } interface Mcp { name: string; /** * The URL of the MCP server. */ url: string; /** * Headers to add to the MCP connection request. */ headers?: { [key: string]: string; }; /** * Query parameters to append to the MCP connection request URL. */ query_params?: { [key: string]: string; }; /** * Maximum time to wait for a connection to be established (in milliseconds). * Default to 120,000 ms (2 minutes). */ timeout_ms?: number; } interface State { /** * Name of the state, must be unique for each state. Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; /** * Edges of the state define how and what state can be reached from this state. */ edges?: Array; /** * Prompt of the state, will be appended to the system prompt of LLM. * * - System prompt = general prompt + state prompt. */ state_prompt?: string; /** * A list of tools specific to this state the model may call (to get external * knowledge, call API, etc). You can select from some common predefined tools like * end call, transfer call, etc; or you can create your own custom tool for the LLM * to use. * * - Tools of LLM = general tools + state tools + state transitions */ tools?: Array; } namespace State { interface Edge { /** * Describes what's the transition and at what time / criteria should this * transition happen. */ description: string; /** * The destination state name when going through transition of state via this edge. * State transition internally is implemented as a tool call of LLM, and a tool * call with name "transition*to*{destination_state_name}" will get created. Feel * free to reference it inside the prompt. */ destination_state_name: string; /** * Describes what parameters you want to extract out when the transition changes. * The parameters extracted here can be referenced in prompts & function * descriptions of later states via dynamic variables. The parameters the functions * accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. */ parameters?: Edge.Parameters; } namespace Edge { /** * Describes what parameters you want to extract out when the transition changes. * The parameters extracted here can be referenced in prompts & function * descriptions of later states via dynamic variables. The parameters the functions * accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. */ interface Parameters { /** * The value of properties is an object, where each key is the name of a property * and each value is a schema used to validate that property. */ properties: unknown; /** * Type must be "object" for a JSON Schema object. */ type: 'object'; /** * List of names of required property when generating this parameter. LLM will do * its best to generate the required properties in its function arguments. Property * must exist in properties. */ required?: Array; } } interface EndCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'end_call'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when ending the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface TransferCallTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; transfer_destination: TransferCallTool.TransferDestinationPredefined | TransferCallTool.TransferDestinationInferred; transfer_option: TransferCallTool.TransferOptionColdTransfer | TransferCallTool.TransferOptionWarmTransfer | TransferCallTool.TransferOptionAgenticWarmTransfer; type: 'transfer_call'; /** * Custom SIP headers to be added to the call. */ custom_sip_headers?: { [key: string]: string; }; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say to user when transferring the call. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the e.164 validation will be ignored for the from_number. This can be * useful when you want to dial to internal pseudo numbers. This only applies when * you are using custom telephony and does not apply when you are using Retell * Telephony. If omitted, the default value is false. */ ignore_e164_validation?: boolean; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } namespace TransferCallTool { interface TransferDestinationPredefined { /** * The number to transfer to in E.164 format or a dynamic variable like * {{transfer_number}}. */ number: string; /** * The type of transfer destination. */ type: 'predefined'; /** * Extension digits to dial after the main number connects. Sent via DTMF. Allow * digits, '\*', '#', or a dynamic variable like {{extension}}. */ extension?: string; } interface TransferDestinationInferred { /** * The prompt to be used to help infer the transfer destination. The model will * take the global prompt, the call transcript, and this prompt together to deduce * the right number to transfer to. Can contain dynamic variables. */ prompt: string; /** * The type of transfer destination. */ type: 'inferred'; } interface TransferOptionColdTransfer { /** * The type of the transfer. */ type: 'cold_transfer'; /** * The mode of the cold transfer. If set to `sip_refer`, will use SIP REFER to * transfer the call. If set to `sip_invite`, will use SIP INVITE to transfer the * call. */ cold_transfer_mode?: 'sip_refer' | 'sip_invite'; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring. Requires the telephony side to support caller id override. Retell * Twilio numbers support this option. This parameter takes effect only when * `cold_transfer_mode` is set to `sip_invite`. When using `sip_refer`, this option * is not available. Retell Twilio numbers always use user's number as the caller * id when using `sip refer` cold transfer mode. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } interface TransferOptionWarmTransfer { /** * The type of the transfer. */ type: 'warm_transfer'; /** * The time to wait before considering transfer fails. */ agent_detection_timeout_ms?: number; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ ivr_option?: TransferOptionWarmTransfer.IvrOption; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set to true, will not perform human detection for the transfer. Default to * false. */ opt_out_human_detection?: boolean; /** * If set, when transfer is connected, will say the handoff message only to the * agent receiving the transfer. Can leave either a static message or a dynamic one * based on prompt. Set to null to disable warm handoff. */ private_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionWarmTransfer.WarmTransferPrompt | TransferOptionWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionWarmTransfer { /** * IVR navigation option to run when doing human detection. This prompt will guide * the AI on how to navigate the IVR system. */ interface IvrOption { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } interface TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ agentic_transfer_config: TransferOptionAgenticWarmTransfer.AgenticTransferConfig; /** * The type of the transfer. */ type: 'agentic_warm_transfer'; /** * Asset ID of the uploaded hold music to play. Required when `on_hold_music` is * `custom`. Must reference an audio asset owned by the organization (see * create-asset). */ custom_on_hold_music_asset_id?: string; /** * Whether to play an audio cue when bridging the call. Defaults to true. */ enable_bridge_audio_cue?: boolean; /** * The music to play while the caller is being transferred. Use `custom` together * with `custom_on_hold_music_asset_id` to play an uploaded audio asset. */ on_hold_music?: 'none' | 'relaxing_sound' | 'uplifting_beats' | 'ringtone' | 'custom'; /** * If set, when transfer is successful, will say the handoff message to both the * transferee and the agent receiving the transfer. Can leave either a static * message or a dynamic one based on prompt. Set to null to disable warm handoff. */ public_handoff_option?: TransferOptionAgenticWarmTransfer.WarmTransferPrompt | TransferOptionAgenticWarmTransfer.WarmTransferStaticMessage; /** * If set to true, will show transferee (the user, not the AI agent) as caller when * transferring, requires the telephony side to support caller id override. Retell * Twilio numbers support this option. */ show_transferee_as_caller?: boolean; /** * Override the ring duration for this specific transfer, in milliseconds. If not * set, falls back to the agent-level `ring_duration_ms`. */ transfer_ring_duration_ms?: number; } namespace TransferOptionAgenticWarmTransfer { /** * Configuration for agentic warm transfer. Required for agentic warm transfer. */ interface AgenticTransferConfig { /** * The action to take when the transfer agent times out without making a decision. * Defaults to cancel_transfer. */ action_on_timeout?: 'bridge_transfer' | 'cancel_transfer'; /** * The agent that will mediate the transfer decision. */ transfer_agent?: AgenticTransferConfig.TransferAgent; /** * The maximum time to wait for the transfer agent to make a decision, in * milliseconds. Defaults to 30000 (30 seconds). */ transfer_timeout_ms?: number; } namespace AgenticTransferConfig { /** * The agent that will mediate the transfer decision. */ interface TransferAgent { /** * The agent ID of the transfer agent. This agent must have isTransferAgent set to * true and should use bridge_transfer and cancel_transfer tools (for Retell LLM) * or BridgeTransferNode and CancelTransferNode (for Conversation Flow). */ agent_id: string; /** * The version of the transfer agent to use. */ agent_version: string | number; } } interface WarmTransferPrompt { /** * The prompt to be used for warm handoff. Can contain dynamic variables. */ prompt?: string; type?: 'prompt'; } interface WarmTransferStaticMessage { /** * The static message to be used for warm handoff. Can contain dynamic variables. */ message?: string; type?: 'static_message'; } } } interface CheckAvailabilityCalTool { /** * Cal.com Api key that have access to the cal.com event you want to check * availability for. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to check * availability for. Can be a number or a dynamic variable in the format * `{{variable_name}}` that will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'check_availability_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when checking availability, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface BookAppointmentCalTool { /** * Cal.com Api key that have access to the cal.com event you want to book * appointment. */ cal_api_key: string; /** * Cal.com event type id number for the cal.com event you want to book appointment. * Can be a number or a dynamic variable in the format `{{variable_name}}` that * will be resolved at runtime. */ event_type_id: number | string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'book_appointment_cal'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Timezone to be used when booking appointment, must be in * [IANA timezone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). * Can also be a dynamic variable in the format `{{variable_name}}` that will be * resolved at runtime. If not specified, will check if user specified timezone in * call, and if not, will use the timezone of the Retell servers. */ timezone?: string; } interface AgentSwapTool { /** * The id of the agent to swap to. */ agent_id: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; /** * Post call analysis setting for the agent swap. */ post_call_analysis_setting: 'both_agents' | 'only_destination_agent'; type: 'agent_swap'; /** * The version of the agent to swap to. If not specified, will use the latest * version. */ agent_version?: string | number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * The message for the agent to speak when executing agent swap. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, keep the current language when swapping agents. Defaults to false. */ keep_current_language?: boolean; /** * If true, keep the current voice and ambient sound settings when swapping agents. * Otherwise, use the destination agent's voice and ambient sound settings. * Defaults to false. */ keep_current_voice?: boolean; speak_during_execution?: boolean; /** * Webhook setting for the agent swap, defaults to only source. */ webhook_setting?: 'both_agents' | 'only_destination_agent' | 'only_source_agent'; } interface PressDigitTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'press_digit'; /** * Delay in milliseconds before pressing the digit, because a lot of IVR systems * speak very slowly, and a delay can make sure the agent hears the full menu. * Default to 1000 ms (1s). Valid range is 0 to 5000 ms (inclusive). */ delay_ms?: number; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; } interface SendSMSTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). */ name: string; sms_content: SendSMSTool.SMSContentPredefined | SendSMSTool.SMSContentInferred | SendSMSTool.SMSContentTemplate; type: 'send_sms'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description?: string; /** * Describes what to say before sending the SMS. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, the agent will speak a short line before sending the SMS. If omitted, * defaults to true (same as end_call / transfer_call tools). */ speak_during_execution?: boolean; } namespace SendSMSTool { interface SMSContentPredefined { /** * The static message to be sent in the SMS. Can contain dynamic variables. */ text?: string; type?: 'predefined'; } interface SMSContentInferred { /** * The prompt to be used to help infer the SMS content. The model will take the * global prompt, the call transcript, and this prompt together to deduce the right * message to send. Can contain dynamic variables. */ prompt?: string; type?: 'inferred'; } interface SMSContentTemplate { /** * The template to use for the SMS content. "info_collection" sends a predefined * message requesting information from the user. */ template: 'info_collection'; type: 'template'; } } interface CustomTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'custom'; /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ url: string; /** * If set to true, the parameters will be passed as root level JSON object instead * of nested under "args". */ args_at_root?: boolean; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. Useful when the tool takes a noticeable amount of time to prevent * silence on the call. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * Headers to add to the request. */ headers?: { [key: string]: string; }; /** * Maximum number of times to retry the request after a failed attempt, from 0 (no * retry) to 5. Retries happen on any failure, with exponential backoff between * attempts; the backoff delay is not configurable. `timeout_ms` applies per * attempt rather than as a budget across all attempts, so an attempt that times * out is still retried and the worst-case total duration is `timeout_ms` * multiplied by (`max_retry` + 1) as well as any latency incurred by the * exponential backoff + jitter between each retry. Only the final attempt's result * is reported to the agent. Because retries repeat the request, only set this * above 0 if your endpoint is idempotent — a retried request may be processed more * than once. Defaults to 0 (no retry). */ max_retry?: number; /** * Method to use for the request, default to POST. */ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; /** * How the tool's `parameters` are authored and shown in the dashboard editor — * "form" for the visual parameter builder, "json" for a raw JSON Schema. Both * produce the same `parameters` schema; this does not change how the request body * is encoded (see `args_at_root`). */ parameter_type?: 'json' | 'form'; /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ parameters?: CustomTool.Parameters; /** * Query parameters to append to the request URL. */ query_params?: { [key: string]: string; }; /** * A mapping of variable names to JSON paths in the response body. These values * will be extracted from the response and made available as dynamic variables for * use. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the tool can run before it's considered * timeout. If the tool times out, the agent would have that info. The minimum * value allowed is 1000 ms (1 s), and maximum value allowed is 600,000 ms (10 * min). By default, this is set to 120,000 ms (2 min). */ timeout_ms?: number; } namespace CustomTool { /** * The parameters the functions accepts, described as a JSON Schema object. See * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for * documentation about the format. Omitting parameters defines a function with an * empty parameter list. */ interface Parameters { /** * The value of properties is an object, where each key is the name of a property * and each value is a schema used to validate that property. */ properties: unknown; /** * Type must be "object" for a JSON Schema object. */ type: 'object'; /** * List of names of required property when generating this parameter. LLM will do * its best to generate the required properties in its function arguments. Property * must exist in properties. */ required?: Array; } } interface CodeTool { /** * JavaScript code to execute in the sandbox. */ code: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'code'; /** * Describes what this tool does and when to call this tool. */ description?: string; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * A mapping of variable names to JSON paths in the code execution result. These * mapped values will be extracted and added as dynamic variables. */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the tool. */ speak_during_execution?: boolean; /** * The maximum time in milliseconds the code can run before it's considered * timeout. Defaults to 30,000 ms (30 s). */ timeout_ms?: number; } interface ExtractDynamicVariableTool { /** * Describes what the tool does, sometimes can also include information about when * to call the tool. */ description: string; /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state edges). Must be consisted of a-z, A-Z, * 0-9, or contain underscores and dashes, with a maximum length of 64 (no space * allowed). */ name: string; type: 'extract_dynamic_variable'; /** * The variables to be extracted. */ variables: Array; /** * If true, play a typing sound on the agent audio track while this tool is * executing. */ enable_typing_sound?: boolean; } namespace ExtractDynamicVariableTool { interface StringAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'string'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Examples of the variable value to teach model the style and syntax. */ examples?: Array; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface EnumAnalysisData { /** * The possible values of the variable, must be non empty array. */ choices: Array; /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'enum'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface BooleanAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'boolean'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } interface NumberAnalysisData { /** * Description of the variable. */ description: string; /** * Name of the variable. */ name: string; /** * Type of the variable to extract. */ type: 'number'; /** * Optional instruction to help decide whether this field needs to be populated in * the analysis. If not set, the field is always included. If required is true, * this is ignored. */ conditional_prompt?: string; /** * Whether this data is required. If true and the data is not extracted, the call * will be marked as unsuccessful. */ required?: boolean; } } interface BridgeTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'bridge_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it bridges the original caller to the transfer target and ends the * transfer agent call. */ description?: string; /** * Describes what to say to user when bridging the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface CancelTransferTool { /** * Name of the tool. Must be unique within all tools available to LLM at any given * time (general tools + state tools + state transitions). Must be consisted of * a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64 * (no space allowed). */ name: string; type: 'cancel_transfer'; /** * Describes what the tool does. This tool is only available to transfer agents * (agents with isTransferAgent set to true) in agentic warm transfer mode. When * invoked, it cancels the transfer, returns the original caller to the main agent, * and ends the transfer agent call. */ description?: string; /** * Describes what to say to user when cancelling the transfer. Only applicable when * speak_during_execution is true. */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * If true, will speak during execution. */ speak_during_execution?: boolean; } interface McpTool { /** * Description of the MCP tool. */ description: string; /** * Name of the MCP tool. */ name: string; type: 'mcp'; /** * If true, play a typing sound on the agent audio track while this MCP tool is * executing. */ enable_typing_sound?: boolean; /** * The description for the sentence agent say during execution. Only applicable * when speak_during_execution is true. Can write what to say or even provide * examples. The default is "The message you will say to callee when calling this * tool. Make sure it fits into the conversation smoothly.". */ execution_message_description?: string; /** * Type of execution message. "prompt" means the agent will use * execution_message_description as a prompt to generate the message. "static_text" * means the agent will speak the execution_message_description directly. Defaults * to "prompt". */ execution_message_type?: 'prompt' | 'static_text'; /** * The input schema of the MCP tool. */ input_schema?: { [key: string]: string; }; /** * Unique id of the MCP. */ mcp_id?: string; /** * Response variables to add to dynamic variables, key is the variable name, value * is the path to the variable in the response */ response_variables?: { [key: string]: string; }; /** * Determines whether the agent would call LLM another time and speak when the * result of function is obtained. Usually this needs to get turned on so user can * get update for the function call. */ speak_after_execution?: boolean; /** * Determines whether the agent would say sentence like "One moment, let me check * that." when executing the function. Recommend to turn on if your function call * takes over 1s (including network) to complete, so that your agent remains * responsive. */ speak_during_execution?: boolean; } } } export interface LlmListParams { /** * Maximum number of items to return. */ limit?: number; /** * Pagination key for fetching the next page. */ pagination_key?: string; /** * Sort order for results. */ sort_order?: 'ascending' | 'descending'; } export interface LlmDeleteParams { /** * By default the deletion is rejected with a 400 if any agent still uses this * Retell LLM as its response engine. Set to true to delete it anyway, which leaves * those agents pointing at a Retell LLM that no longer exists. */ force_delete?: boolean; } export declare namespace Llm { export { type LlmResponse as LlmResponse, type LlmListResponse as LlmListResponse, type LlmCreateParams as LlmCreateParams, type LlmRetrieveParams as LlmRetrieveParams, type LlmUpdateParams as LlmUpdateParams, type LlmListParams as LlmListParams, type LlmDeleteParams as LlmDeleteParams, }; } //# sourceMappingURL=llm.d.ts.map