# Conversational AI — Preview > Only Preview documentation is included in this export. # Conversational AI Platform overview (/en/ai/platform) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). The Conversational AI Platform lets you build voice agents that talk to your users in apps and over the phone. You save an agent's configuration once in your project, then run it in as many conversations as you need. > **Info** > > The Conversational AI Platform is in Preview. During the Preview, agent sessions run in North America (US). Geofencing isn't supported. ## How the Platform works The Platform separates setting up an agent from when and where you run it. In your project, you save agent configurations and the secrets they use, such as API keys for your ASR, LLM, and TTS providers. You also import the phone numbers that agents call from and answer. Then you start sessions and campaigns that run your agents. The Platform has five building blocks, each scoped to a single Agora project: - **[Agents](/en/api-reference/api-ref/conversational-ai/platform/create-agent)**: An agent is a saved configuration that defines how your voice agent behaves: its instructions, greeting, variables, and the models that power it. A project can have many agents, for example one for support and one for sales. You create an agent once, then use it to start sessions and campaigns, and to answer calls to your phone numbers. - **[Secrets](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set)**: A secret set stores provider API keys and other credentials. Instead of embedding a key in an agent's configuration, you refer to it by name. The API never returns secret values. - **[Sessions](/en/api-reference/api-ref/conversational-ai/platform/start-session)**: A session is a single conversation. It runs an agent in an RTC channel in your app, or in a phone call. To test a configuration without saving it, you can start an [ephemeral session](/en/api-reference/api-ref/conversational-ai/platform/start-ephemeral-session) with the agent configuration in the request. - **[Phone numbers](/en/api-reference/api-ref/conversational-ai/platform/create-number)**: A phone number connects your agents to the phone network. Agents place calls from your numbers and answer calls made to them. You import numbers that your carrier assigned to you, with their SIP trunk settings, and choose which agent answers each number. - **[Campaigns](/en/api-reference/api-ref/conversational-ai/platform/create-campaign)**: You create a campaign to call a list of contacts with a saved agent, right away or on a schedule. Each call starts a phone session. Together, these building blocks let one agent handle conversations across your app and the phone network. For example, a support team might store its LLM key in a secret set, create a support agent that references it, and assign the agent to its support phone number. The same agent then answers inbound calls, talks to customers in the team's app through RTC sessions, and calls customers back through a campaign. ## Key capabilities With the Platform, you can: - **Personalize every conversation**: Declare variables in an agent, such as a customer's name, and use them in its instructions and greeting. You pass the values when you start a session, or for each contact in a campaign. - **Use managed mode or BYOK**: Use managed mode to let Agora provide access to supported ASR, LLM, and TTS models, or bring your own key to use your provider account. Store your keys in secret sets. - **Update agents safely**: When you update an agent, every subsequent session uses the new configuration. Sessions that are already running keep the configuration they started with. - **Control conversation data**: For each session, choose whether Agora retains its conversation data or discards it. ## Choose your path Choose the path that matches where your users talk to your agent: **[In apps](/en/ai/platform/get-started/start-stop-agent)** Create an agent, then start and stop sessions that run it in an RTC channel or in telephony. **[Phone calls](/en/ai/platform/build/phone-calls/import-phone-numbers)** Import a phone number, route inbound calls to an agent, and place outbound calls and campaigns. **[Python SDK reference](/en/api-reference/api-ref/server-sdk/platform/python)** Save agents and run sessions from Python, and manage secrets, phone numbers, and campaigns. **[TypeScript SDK reference](/en/api-reference/api-ref/server-sdk/platform/typescript)** Save agents and run sessions from Node.js, and manage secrets, phone numbers, and campaigns. **[Go SDK reference](/en/api-reference/api-ref/server-sdk/platform/go)** Save agents and run sessions from Go, and manage secrets, phone numbers, and campaigns. **[REST API reference](/en/api-reference/api-ref/conversational-ai/platform)** Explore every Platform endpoint, with request and response examples. # Optimize audio quality (/en/ai/platform/best-practices/audio-setup) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). In real-time audio interactions, the rhythm, continuity, and intonation of conversations between humans and AI often differ from those between humans. To improve the AI–human conversation experience, it's important to optimize audio settings. When users talk to a Conversational AI Platform agent from an Android, iOS, or Web app built with the RTC SDK, follow the best practices in this guide to improve conversation fluency and reliability, especially in complex network environments. ## Server configuration When you [start a session](/en/ai/platform/get-started/start-stop-agent#start-a-session), the session's audio scenario sets how the agent's audio is processed in the channel. Keep the default, `aiserver`, which is optimized for latency and network resilience in conversations with an agent. Use `chorus` only when participants have good network conditions and need ultra-low latency, or when you record the conversation with Cloud Recording. For details, see [Record agent conversations](/en/ai/platform/best-practices/record-agent-conversation). For other audio-related settings, use the default values. ## Client configuration To configure the client app, implement the following: ### Integrate the required dynamic libraries For the best audio experience with an agent, integrate and load the following dynamic libraries in your project: **Android** - AI noise suppression plugin: `libagora_ai_noise_suppression_extension.so` - AI echo cancellation plug-in: `libagora_ai_echo_cancellation_extension.so` For integration details, refer to [App size optimization](/en/realtime-media/rtc/build/optimize-and-operate/app-size-optimization/android). **iOS** - AI noise suppression plugin: `AgoraAiNoiseSuppressionExtension.xcframework` - AI echo cancellation plug-in: `AgoraAiEchoCancellationExtension.xcframework` For integration details, refer to [App size optimization](/en/realtime-media/rtc/build/optimize-and-operate/app-size-optimization/ios). **Web** - Integrate the `agora-extension-ai-denoiser` extension. Refer to [AI Noise Suppression](/en/realtime-media/rtc/build/enhance-the-audio-experience/ai-noise-suppression/web). > **Info** > > Optimizing audio uses AI Noise Suppression, which is a paid feature. ## Optimize audio for optimal performance You can optimize audio settings in the following ways: - **(Recommended) Use the Toolkit APIs** Supported in Video/Voice SDK version 4.5.1 and above. - **Use the Video/Voice SDK APIs directly** Supported in SDK version 4.3.1 and above. ### Use the toolkit APIs In this solution, you use the toolkit APIs to optimize audio settings. **Android** 1. **Integrate the toolkit** Add the toolkit to your project using Maven or source code. See [Install the Android toolkit](/en/api-reference/api-ref/conversational-ai/client-toolkit/android#installation). 2. **Create a toolkit instance** ```kotlin val config = ConversationalAIAPIConfig( rtcEngine = rtcEngine, rtmClient = rtmClient, renderMode = TranscriptRenderMode.Word, enableLog = true, enableRenderModeFallback = true ) val api = ConversationalAIAPIImpl(config) ``` 3. **Set optimal audio settings** Before joining the RTC channel, call `loadAudioSettings()` to apply the optimal audio parameters. ```kotlin api.loadAudioSettings() rtcEngine.joinChannel(token, channelName, null, userId) ``` 4. **Release resources** ```kotlin api.destroy() ``` **iOS** 1. **Integrate the toolkit** Add the toolkit to your project using CocoaPods, Swift Package Manager, or source code. See [Install the iOS toolkit](/en/api-reference/api-ref/conversational-ai/client-toolkit/ios#installation). 2. **Create a toolkit instance** ```swift let config = ConversationalAIAPIConfig( rtcEngine: rtcEngine, rtmEngine: rtmEngine, renderMode: .words, enableLog: true, enableRenderModeFallback: true ) convoAIAPI = ConversationalAIAPIImpl(config: config) ``` 3. **Set optimal audio settings** Before joining the RTC channel, call `loadAudioSettings()` to apply the optimal audio parameters. ```swift convoAIAPI.loadAudioSettings() rtcEngine.joinChannel(rtcToken: token, channelName: channelName, uid: uid, isIndependent: independent) ``` 4. **Release resources** ```swift convoAIAPI.destroy() ``` **Web** - **Integrate the transcript processing toolkit** Add the toolkit to your project using a package manager or source code. See [Install the Web toolkit](/en/api-reference/api-ref/conversational-ai/client-toolkit/web#installation). Refer to [Folder structure](#folder-structure) to understand the role of each file. ### Use the SDK APIs In this solution, you use the RTC SDK to optimize audio settings. #### Set audio parameters The settings in this section apply to Video/Voice SDK versions 4.3.1 and above. If you are using an earlier version, upgrade to version 4.5.1 or above or [Contact Technical Support](mailto:support@agora.io). **Android** For the best conversational AI audio experience, apply the following settings: 1. **Set the audio scenario**: When initializing the engine, set the audio scenario to the AI client scenario. You can also set the scenario before joining a channel by calling the `setAudioScenario` method. 2. **Configure audio parameters**: Call `setParameters` before joining a channel and whenever the `onAudioRouteChanged` callback is triggered. This configuration sets audio 3A plug-ins (acoustic echo cancellation, noise suppression, and automatic gain control), the audio sampling rate, the audio processing mode, and other settings. For recommended parameter values, refer to the sample code. > **Info** > > Since Video/Voice SDK versions 4.3.1 to 4.5.0 do not support the AI client audio scenario, set the scenario to `AUDIO_SCENARIO_CHORUS` to improve the audio experience. However, the audio experience cannot be aligned with versions 4.5.1 and above. To get the best audio experience, upgrade the SDK to version 4.5.1 or higher. The following sample code defines a `setAudioConfigParameters` function to configure audio parameters. Call this function before joining a channel and whenever the audio route changes. ```kotlin private var rtcEngine: RtcEngineEx? = null private var mAudioRouting = Constants.AUDIO_ROUTE_DEFAULT // highlight-start // Set audio configuration parameters private fun setAudioConfigParameters(routing: Int) { mAudioRouting = routing rtcEngine?.apply { setParameters("{\"che.audio.aec.split_srate_for_48k\":16000}") setParameters("{\"che.audio.sf.enabled\":true}") setParameters("{\"che.audio.sf.stftType\":6}") setParameters("{\"che.audio.sf.ainlpLowLatencyFlag\":1}") setParameters("{\"che.audio.sf.ainsLowLatencyFlag\":1}") setParameters("{\"che.audio.sf.procChainMode\":1}") setParameters("{\"che.audio.sf.nlpDynamicMode\":1}") if (routing == Constants.AUDIO_ROUTE_HEADSET // 0 || routing == Constants.AUDIO_ROUTE_EARPIECE // 1 || routing == Constants.AUDIO_ROUTE_HEADSETNOMIC // 2 || routing == Constants.AUDIO_ROUTE_BLUETOOTH_DEVICE_HFP // 5 || routing == Constants.AUDIO_ROUTE_BLUETOOTH_DEVICE_A2DP) { // 10 setParameters("{\"che.audio.sf.nlpAlgRoute\":0}") } else { setParameters("{\"che.audio.sf.nlpAlgRoute\":1}") } setParameters("{\"che.audio.sf.ainlpModelPref\":10}") setParameters("{\"che.audio.sf.nsngAlgRoute\":12}") setParameters("{\"che.audio.sf.ainsModelPref\":10}") setParameters("{\"che.audio.sf.nsngPredefAgg\":11}") setParameters("{\"che.audio.agc.enable\":false}") } } // highlight-end // Create and initialize the RTC engine fun createRtcEngine(rtcCallback: IRtcEngineEventHandler): RtcEngineEx { val config = RtcEngineConfig() config.mContext = AgentApp.instance() config.mAppId = ServerConfig.rtcAppId config.mChannelProfile = Constants.CHANNEL_PROFILE_LIVE_BROADCASTING // highlight-start // Set the audio scene to AI dialogue scene (supported by 4.5.1 and above) // Version 4.3.1 ~ 4.5.0 is set to chorus scene AUDIO_SCENARIO_CHORUS config.mAudioScenario = Constants.AUDIO_SCENARIO_AI_CLIENT // Register audio route change callback config.mEventHandler = object : IRtcEngineEventHandler() { override fun onAudioRouteChanged(routing: Int) { super.onAudioRouteChanged(routing) // Set audio related parameters setAudioConfigParameters(routing) } } // highlight-end try { rtcEngine = (RtcEngine.create(config) as RtcEngineEx).apply { // highlight-start // Load the audio plugin loadExtensionProvider("ai_echo_cancellation_extension") loadExtensionProvider("ai_noise_suppression_extension") // highlight-end } } catch (e: Exception) { Log.e("CovAgoraManager", "createRtcEngine error: $e") } return rtcEngine!! } // Join the channel fun joinChannel(rtcToken: String, channelName: String, uid: Int, isIndependent: Boolean = false) { // highlight-start // Initialize audio configuration parameters setAudioConfigParameters(mAudioRouting) // highlight-end // Configure channel options and join the channel val options = ChannelMediaOptions() options.clientRoleType = CLIENT_ROLE_BROADCASTER options.publishMicrophoneTrack = true options.publishCameraTrack = false options.autoSubscribeAudio = true options.autoSubscribeVideo = false val ret = rtcEngine?.joinChannel(rtcToken, channelName, uid, options) } ``` **iOS** For the best conversational AI audio experience, apply the following settings: 1. **Set the audio scenario**: When initializing the engine, set the audio scenario to the AI client scenario. You can also set the scenario before joining a channel by calling the `setAudioScenario` method. 2. **Configure audio parameters**: Call `setParameters` before joining a channel and whenever the `rtcEngine:didAudioRouteChanged:` callback is triggered. This configuration sets audio 3A plug-ins (acoustic echo cancellation, noise suppression, and automatic gain control), the audio sampling rate, the audio processing mode, and other settings. For recommended parameter values, refer to the sample code. > **Info** > > Since Video/Voice SDK versions 4.3.1 to 4.5.0 do not support the AI client audio scenario, set the scenario to `AgoraAudioScenarioChorus` to improve the audio experience. However, the audio experience cannot be aligned with versions 4.5.1 and above. To get the best audio experience, upgrade the SDK to version 4.5.1 or higher. The following sample code defines a `setAudioConfigParameters` function to configure audio parameters. Call this function before joining a channel and whenever the audio route changes. ```swift class RTCManager: NSObject { private var rtcEngine: AgoraRtcEngineKit! private var audioDumpEnabled: Bool = false private var audioRouting = AgoraAudioOutputRouting.default // highlight-start // Set audio related parameters private func setAudioConfigParameters(routing: AgoraAudioOutputRouting) { audioRouting = routing rtcEngine.setParameters("{\"che.audio.aec.split_srate_for_48k\":16000}") rtcEngine.setParameters("{\"che.audio.sf.enabled\":true}") rtcEngine.setParameters("{\"che.audio.sf.stftType\":6}") rtcEngine.setParameters("{\"che.audio.sf.ainlpLowLatencyFlag\":1}") rtcEngine.setParameters("{\"che.audio.sf.ainsLowLatencyFlag\":1}") rtcEngine.setParameters("{\"che.audio.sf.procChainMode\":1}") rtcEngine.setParameters("{\"che.audio.sf.nlpDynamicMode\":1}") if routing == .headset || routing == .earpiece || routing == .headsetNoMic || routing == .bluetoothDeviceHfp || routing == .bluetoothDeviceA2dp { rtcEngine.setParameters("{\"che.audio.sf.nlpAlgRoute\":0}") } else { rtcEngine.setParameters("{\"che.audio.sf.nlpAlgRoute\":1}") } rtcEngine.setParameters("{\"che.audio.sf.ainlpModelPref\":10}") rtcEngine.setParameters("{\"che.audio.sf.nsngAlgRoute\":12}") rtcEngine.setParameters("{\"che.audio.sf.ainsModelPref\":10}") rtcEngine.setParameters("{\"che.audio.sf.nsngPredefAgg\":11}") rtcEngine.setParameters("{\"che.audio.agc.enable\":false}") } // highlight-end } extension RTCManager: RTCManagerProtocol { func createRtcEngine(delegate: AgoraRtcEngineDelegate) -> AgoraRtcEngineKit { let config = AgoraRtcEngineConfig() config.appId = AppContext.shared.appId config.channelProfile = .liveBroadcasting // highlight-start // Set the audio scene to AI dialogue scene (supported by 4.5.1 and above) // Versions 4.3.1 ~ 4.5.0 support chorus scenes .chorus config.audioScenario = .aiClient rtcEngine = AgoraRtcEngineKit.sharedEngine(with: config, delegate: delegate) // Register audio route change callback rtcEngine.addDelegate(self) // highlight-end return rtcEngine } func joinChannel(rtcToken: String, channelName: String, uid: String) { // highlight-start // Initialize audio configuration parameters setAudioConfigParameters(routing: audioRouting) // highlight-end // Configure channel options and join the channel let options = AgoraRtcChannelMediaOptions() options.clientRoleType = .broadcaster options.publishMicrophoneTrack = true options.publishCameraTrack = false options.autoSubscribeAudio = true options.autoSubscribeVideo = false let ret = rtcEngine.joinChannel(byToken: rtcToken, channelId: channelName, uid: UInt(uid) ?? 0, mediaOptions: options) } } // highlight-start // Implement the AgoraRtcEngineDelegate interface to handle audio route change callbacks extension RTCManager: AgoraRtcEngineDelegate { public func rtcEngine(_ engine: AgoraRtcEngineKit, didAudioRouteChanged routing: AgoraAudioOutputRouting) { setAudioConfigParameters(routing: routing) } } // highlight-end ``` **Web** Integrate the `agora-extension-ai-denoiser` extension. Refer to [AI Noise Suppression](/en/realtime-media/rtc/build/enhance-the-audio-experience/ai-noise-suppression/web). > **Info** > > Use Web SDK version 4.15.0 or later. ## Reference This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product. ### Sample project Refer to the following open-source sample code to set audio-related parameters. **Android** - [`CovRtcManager.kt`](https://github.com/AgoraIO-Community/Conversational-AI-Demo/blob/main/Android/scenes/convoai/src/main/java/io/agora/scene/convoai/rtc/CovRtcManager.kt) **iOS** - [`RTCManager.swift`](https://github.com/AgoraIO-Community/Conversational-AI-Demo/blob/main/iOS/Scenes/ConvoAI/ConvoAI/ConvoAI/Classes/Manager/RTCManager.swift) ### Folder structure **Android** - `IConversationalAIAPI.kt`: API interface and related data structures and enumerations - `ConversationalAIAPIImpl.kt`: ConversationalAI API main implementation logic - `ConversationalAIUtils.kt`: Tool functions and event callback management - `subRender/` - `v3/`: Transcript module - `TranscriptionController.kt`: Transcript Controller - `MessageParser.kt`: Message Parser **iOS** - `ConversationalAIAPI.swift`: API interface and related data structures and enumerations - `ConversationalAIAPIImpl.swift`: ConversationalAI API main implementation logic - `Transcription/` - `TranscriptionController.swift`: Transcript Controller **Web** - `index.ts`: API Class - `type.ts`: API interface and related data structures and enumerations - `utils/` - `index.ts`: API utility functions - `events.ts`: Event management class, which can be extended to easily implement event monitoring and broadcasting - `sub-render.ts`: Transcript module ### API reference **Android** - SDK - `setAudioScenario` - `setParameters` - `onAudioRouteChanged` - Toolkit - [`loadAudioSettings`](/en/api-reference/api-ref/conversational-ai/client-toolkit/android#loadaudiosettings) - [`destroy`](/en/api-reference/api-ref/conversational-ai/client-toolkit/android#destroy) **iOS** - SDK - `setAudioScenario` - `setParameters` - `rtcEngine:didAudioRouteChanged:` - Toolkit - [`loadAudioSettings`](/en/api-reference/api-ref/conversational-ai/client-toolkit/ios#loadaudiosettings12) - [`destroy`](/en/api-reference/api-ref/conversational-ai/client-toolkit/ios#destroy) **web** - Toolkit - [`IConversationalAIAPIEventHandlers interface`](/en/api-reference/api-ref/conversational-ai/client-toolkit/web#iconversationalaiapieventhandlers-interface) - [`EConversationalAIAPIEvents`](/en/api-reference/api-ref/conversational-ai/client-toolkit/web#econversationalaiapievents) - [`subscribeMessage`](/en/api-reference/api-ref/conversational-ai/client-toolkit/web#subscribemessage) - [`unsubscribeMessage`](/en/api-reference/api-ref/conversational-ai/client-toolkit/web#unsubscribe) - [`destroy`](/en/api-reference/api-ref/conversational-ai/client-toolkit/web#destroy) # Record agent conversations (/en/ai/platform/best-practices/record-agent-conversation) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). This guide explains how to record conversations with a Conversational AI Platform agent using Agora [Cloud Recording](/en/api-reference/api-ref/cloud-recording), and how to avoid audio interruptions when recording starts. ## Why this needs special handling When an agent and Cloud Recording are in the same channel, recording startup can briefly interrupt the audio. The issue is usually caused by the agent's audio scenario falling back to a default mode when Cloud Recording joins the channel. To keep the audio stable, set the agent's audio scenario to `chorus` when you start the session. ## Start the session with the chorus audio scenario When you [start a session](/en/ai/platform/get-started/start-stop-agent#start-a-session), set its audio scenario to `chorus`. The SDK examples use the saved agent from [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent). **Python SDK** ```python session = saved_agent.create_session( channel="", token="", agent_uid="1002", remote_uids=["1001"], values={"customer_name": "Ada"}, audio_scenario="chorus", ) session_id = session.start() ``` **TypeScript SDK** ```ts const session = savedAgent.createSession({ channel: '', token: '', agentUid: '1002', remoteUids: ['1001'], values: { customer_name: 'Ada' }, audioScenario: 'chorus', }); const sessionId = await session.start(); ``` **Go SDK** ```go session := savedAgent.CreateSession(agentkit.CreateSessionOptions{ Channel: "", Token: "", AgentUID: "1002", RemoteUIDs: []string{"1001"}, Values: map[string]any{"customer_name": "Ada"}, AudioScenario: "chorus", }) sessionID, err := session.Start(ctx) if err != nil { log.Fatal(err) } ``` **REST API** In the request to [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session), set `transport.audio_scenario`: ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//sessions \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "values": { "customer_name": "Ada" }, "transport": { "type": "rtc", "channel": "", "token": "", "uid": "1002", "subscribe_uids": ["1001"], "audio_scenario": "chorus" } }' ``` The audio scenario is a session setting, not part of the agent. Set it only for the sessions you record. Other sessions keep the default, `aiserver`. For details, see [Optimize audio quality](/en/ai/platform/best-practices/audio-setup). ## Start recording After the session is running, call the [Start Cloud Recording](/en/api-reference/api-ref/cloud-recording/start) API to begin recording. Use a recording UID that's different from the agent's and the user's UIDs. The following example shows a Cloud Recording request body: ```json { "cname": "", "uid": "", "clientRequest": { "token": "", "recordingConfig": { "maxIdleTime": 120, "streamTypes": 0, "audioProfile": 1, "channelType": 1 }, "recordingFileConfig": { "avFileType": [ "hls", "mp4" ] }, "storageConfig": { "vendor": "", "region": "", "bucket": "", "accessKey": "", "secretKey": "" } } } ``` ## Reference For more information, see the following pages: - [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent) - [Optimize audio quality](/en/ai/platform/best-practices/audio-setup) ### API reference - [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session) - [Cloud Recording API reference](/en/api-reference/api-ref/cloud-recording) # Use managed mode (/en/ai/platform/build/managed-mode) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Managed mode lets your agent use supported ASR, LLM, and TTS models without your own provider accounts or API keys. Agora provides access to the models. You choose the vendor and model to use for ASR, LLM, and TTS, or let the Platform select them. To use your own provider accounts instead, see [Use your own provider keys (BYOK)](/en/ai/platform/build/use-your-own-keys). ## Understand the tech An agent has ASR, LLM, and TTS models. To use managed mode for a model, choose a vendor and model from [Supported vendors and models](#supported-vendors-and-models), and don't provide a provider API key. You choose the credential mode for each model. For example, an agent can use managed ASR and TTS with your own LLM key. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). For a complete agent example, see [Create an agent](/en/ai/platform/get-started/start-stop-agent#create-an-agent). ## Choose managed models Set the managed models when you create an agent. This example uses Deepgram Nova 3 for ASR, OpenAI GPT-4.1 Mini for the LLM, and OpenAI TTS-1 for TTS. The SDK examples use the `client` that you create in [Prerequisites](/en/ai/platform/get-started/start-stop-agent#prerequisites). **Python SDK** Create each model without an API key: ```python from agora_agent import Agent, DeepgramSTT, OpenAI, OpenAITTS agent = ( Agent(client=client) .with_stt(DeepgramSTT(model="nova-3", language="en-US")) .with_llm( OpenAI( model="gpt-4.1-mini", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(OpenAITTS(model="tts-1", voice="alloy")) ) saved_agent = agent.save(name="Support agent") ``` **TypeScript SDK** Create each model without an API key: ```ts import { Agent, DeepgramSTT, OpenAI, OpenAITTS } from 'agora-agents'; const agent = new Agent({ client }) .withStt(new DeepgramSTT({ model: 'nova-3', language: 'en-US' })) .withLlm( new OpenAI({ model: 'gpt-4.1-mini', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(new OpenAITTS({ model: 'tts-1', voice: 'alloy' })); const savedAgent = await agent.save({ name: 'Support agent' }); ``` **Go SDK** Create each model without an API key: ```go agent := agentkit.NewAgent(client). WithStt(vendors.NewDeepgramSTT(vendors.DeepgramSTTOptions{Model: "nova-3", Language: "en-US"})). WithLlm(vendors.NewOpenAI(vendors.OpenAIOptions{ Model: "gpt-4.1-mini", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, })). WithTts(vendors.NewOpenAITTS(vendors.OpenAITTSOptions{Model: "tts-1", Voice: "alloy"})) savedAgent, err := agent.Save(ctx, agentkit.SaveOptions{Name: "Support agent"}) if err != nil { log.Fatal(err) } ``` **REST API** Send a request to [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) with a `pipeline`: ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//agents \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "agent_name": "Support agent", "instructions": "You are a friendly support agent for Acme. Keep your answers short.", "pipeline": { "mode": "cascaded", "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US" }, "llm": { "credential": { "mode": "managed" }, "vendor": "openai", "style": "openai", "model": "gpt-4.1-mini" }, "tts": { "credential": { "mode": "managed" }, "vendor": "openai", "params": { "model": "tts-1", "voice": "alloy" } } } }' ``` In this example: - Each block sets `credential.mode` to `managed`. A managed block doesn't accept `fields` or a custom provider endpoint `url`. - The `asr` block uses Deepgram Nova 3 for US English. - The `llm` block uses OpenAI GPT-4.1 Mini. - The `tts` block uses OpenAI TTS-1, with the voice in `params`. You then start sessions with the agent as usual. For details, see [Start a session](/en/ai/platform/get-started/start-stop-agent#start-a-session). ## Supported vendors and models The following vendors and models are available in managed mode. ### ASR | Vendor | Models | | ----------------------------------------------- | ------------------- | | [ARES](/en/ai/platform/models/asr/ares) | Built-in ASR engine | | [Deepgram](/en/ai/platform/models/asr/deepgram) | `nova-2`, `nova-3` | ### LLM | Vendor | Models | | ------------------------------------------- | ------------------------------------------------------------------------- | | [OpenAI](/en/ai/platform/models/llm/openai) | `gpt-4o-mini`, `gpt-4.1-mini`, `gpt-5-nano`, `gpt-5-mini`, `gpt-5.6-luna` | ### TTS | Vendor | Models | | --------------------------------------------- | -------------------------------------- | | [MiniMax](/en/ai/platform/models/tts/minimax) | `speech-2.6-turbo`, `speech-2.8-turbo` | | [OpenAI](/en/ai/platform/models/tts/openai) | `tts-1` | ## Reference For more information, see the following pages: - [Use your own provider keys](/en/ai/platform/build/use-your-own-keys) - [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent) - For the settings each vendor supports, see the vendor pages under Models, for example [Deepgram](/en/ai/platform/models/asr/deepgram), [OpenAI](/en/ai/platform/models/llm/openai), and [MiniMax](/en/ai/platform/models/tts/minimax). ### API reference - [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) - [Update an agent](/en/api-reference/api-ref/conversational-ai/platform/update-agent) # Import phone numbers (/en/ai/platform/build/phone-calls/import-phone-numbers) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). To let your agents make and receive phone calls, import the phone numbers your carrier assigned to you. Each number connects to the phone network through your SIP trunk. Importing a number doesn't purchase one. ## Understand the tech After you import a number, you can use it in both directions: - **Inbound calls**: When someone calls the number, the Platform starts a session with the routed agent, and the agent answers the call. For details, see [Route inbound calls to an agent](/en/ai/platform/build/phone-calls/route-inbound-calls). - **Outbound calls**: Sessions and campaigns use the number as their caller ID. For details, see [Make outbound calls and run campaigns](/en/ai/platform/build/phone-calls/outbound-calls-campaigns). ## Prerequisites Before you begin, make sure that you have: - An Agora project, and REST API credentials or an SDK client. For details, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#prerequisites). - A phone number from a carrier that supports SIP trunking, in E.164 format, for example `+14155550100`. - Your SIP trunk's hostname, transport protocol, username, and password. ## Import a number Import the number with its SIP trunk. To have an agent answer calls to the number, also set the inbound agent and a call policy, as in the following example. For details, see [Route inbound calls to an agent](/en/ai/platform/build/phone-calls/route-inbound-calls). **Python SDK** ```python number = client.numbers.create( number="+14155550100", description="Customer support line", sip_trunk={ "name": "support-line", "hostname": "acme.pstn.example.com", "transport": "tls", "auth": {"username": "acme", "password": ""}, }, inbound={ "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": {"max_call_duration_seconds": 1800}, }, ) print(number["number_id"]) # The number ID ``` **TypeScript SDK** ```ts const number = await client.numbers.create({ number: '+14155550100', description: 'Customer support line', sip_trunk: { name: 'support-line', hostname: 'acme.pstn.example.com', transport: 'tls', auth: { username: 'acme', password: '' }, }, inbound: { agent: '3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10', call_policy: { max_call_duration_seconds: 1800 }, }, }); console.log(number.number_id); // The number ID ``` **Go SDK** The last argument is an idempotency key. Number creation doesn't support one, so pass an empty string. ```go description := "Customer support line" trunkName := "support-line" agentID := "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10" number, err := client.Numbers.Create(ctx, agentkit.NumberCreate{ Number: "+14155550100", Description: &description, SipTrunk: agentkit.SipTrunk{ Name: &trunkName, Hostname: "acme.pstn.example.com", Transport: "tls", Auth: &agentkit.SipAuth{Username: "acme", Password: ""}, }, Inbound: &agentkit.Inbound{ Agent: &agentID, CallPolicy: map[string]any{"max_call_duration_seconds": 1800}, }, }, "") if err != nil { log.Fatal(err) } fmt.Println(number.Body.NumberID) // The number ID ``` **REST API** Send a request to [Create a phone number](/en/api-reference/api-ref/conversational-ai/platform/create-number): ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//numbers \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "number": "+14155550100", "description": "Customer support line", "sip_trunk": { "name": "support-line", "hostname": "acme.pstn.example.com", "transport": "tls", "auth": { "username": "acme", "password": "" } }, "inbound": { "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": { "max_call_duration_seconds": 1800 } } }' ``` If the request is successful, the response contains the number's ID and its configuration. The `auth` credentials aren't returned. ```json // 201 Created { "number_id": "92e68758-3d3a-4f27-8b93-3fd8d834467c", "number": "+14155550100", "description": "Customer support line", "sip_trunk": { "name": "support-line", "hostname": "acme.pstn.example.com", "port": 5061, "transport": "tls" }, "inbound": { "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": { "max_call_duration_seconds": 1800 } }, "create_ts": 1786543331 } ``` In `sip_trunk`, set the following fields: | Field | Description | | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `hostname` | Required. Your carrier's SIP hostname, without a scheme or port, for example `acme.pstn.example.com`. | | `transport` | The transport protocol: `tls`, `tcp`, or `udp`. The default is `tls`. | | `port` | The SIP signaling port. The default is `5061` for `tls`, and `5060` for `udp` and `tcp`. | | `auth` | Your SIP username and password. The API never returns them. Referring to a secret set for the password isn't supported in the Preview. | | `allowed_ips` | The addresses allowed to send inbound SIP traffic, as IPv4 addresses such as `54.172.60.1` or IPv4 CIDR ranges such as `54.172.60.0/23`. If you omit it, inbound SIP traffic is accepted from any address, so set it to your carrier's signaling addresses. | | `name` | A name that helps you identify the carrier connection. | Store the number ID. You use it to place outbound calls from the number and to update it. You can't change the phone number itself. To use a different number, import it. ## Reference For more information, see the following pages: - [Route inbound calls to an agent](/en/ai/platform/build/phone-calls/route-inbound-calls) - [Make outbound calls and run campaigns](/en/ai/platform/build/phone-calls/outbound-calls-campaigns) ### API reference - [Create a phone number](/en/api-reference/api-ref/conversational-ai/platform/create-number) - [Retrieve a phone number](/en/api-reference/api-ref/conversational-ai/platform/retrieve-number) - [Update a phone number](/en/api-reference/api-ref/conversational-ai/platform/update-number) - [List phone numbers](/en/api-reference/api-ref/conversational-ai/platform/list-numbers) - [Delete a phone number](/en/api-reference/api-ref/conversational-ai/platform/delete-number) # Make outbound calls and run campaigns (/en/ai/platform/build/phone-calls/outbound-calls-campaigns) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Your agent can call people from a phone number in your project. To place a single call, start a session that dials the number. To call a list of contacts, create a campaign that dials each contact on a schedule you set. ## Understand the tech An outbound call is a session that uses `telephony` transport instead of an RTC channel. The Platform dials the number from your phone number, and the agent talks to whoever answers. The session ends when the call ends, or when you stop it. A campaign starts these sessions for you. You give it an agent, the number to call from, and a list of contacts. The campaign dials each contact as a separate session, within its schedule and pacing limits. It calls each contact once. ## Prerequisites Before you begin, make sure that you have: - An agent in your project. For details, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent). - A phone number in your project. For details, see [Import phone numbers](/en/ai/platform/build/phone-calls/import-phone-numbers). ## Make an outbound call Start a session with telephony transport. Set the number to call from, by its ID, and the number to call, in E.164 format. Pass the values for the agent's variables, as for any session. **Python SDK** The SDK's session helpers start RTC sessions only. To place a call, use the low-level `client.v3.sessions.start()`: ```python session = client.v3.sessions.start( agent_id="3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", values={"customer_name": "Ada"}, transport={ "type": "telephony", "from": "92e68758-3d3a-4f27-8b93-3fd8d834467c", "to": "+14155550123", "call_policy": { "max_ring_duration_ms": 30000, "max_call_duration_seconds": 600, "end_call": {"on_voicemail": True}, }, }, ) print(session["agent_session_id"]) # The agent_session_id ``` **TypeScript SDK** The SDK's session helpers start RTC sessions only. To place a call, use the low-level `client.v3.sessions.start()`: ```ts const session = await client.v3.sessions.start({ agent_id: '3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10', values: { customer_name: 'Ada' }, transport: { type: 'telephony', from: '92e68758-3d3a-4f27-8b93-3fd8d834467c', to: '+14155550123', call_policy: { max_ring_duration_ms: 30000, max_call_duration_seconds: 600, end_call: { on_voicemail: true }, }, }, }); console.log(session.agent_session_id); // The agent_session_id ``` **Go SDK** The SDK's session helpers start RTC sessions only. To place a call, use the low-level `client.V3.Sessions.Start()`: This example also imports `github.com/AgoraIO/agora-agents-go/v2/v3`. ```go maxRing, maxCall := 30000, 600 session, err := client.V3.Sessions.Start(ctx, v3.SessionStartRequest{ AgentID: "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", Values: map[string]any{"customer_name": "Ada"}, Transport: v3.SessionTransport{ Type: "telephony", From: "92e68758-3d3a-4f27-8b93-3fd8d834467c", To: "+14155550123", CallPolicy: &v3.CampaignCallPolicy{ MaxRingDurationMS: &maxRing, MaxCallDurationSeconds: &maxCall, EndCall: &v3.CampaignEndCallPolicy{OnVoicemail: true}, }, }, }) if err != nil { log.Fatal(err) } fmt.Println(session.Body.AgentSessionID) // The agent_session_id ``` **REST API** Send a request to [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session). In `transport`, set `type` to `telephony`, `from` to your number's `number_id`, and `to` to the number to call. `from` doesn't accept a phone number: ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//sessions \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "values": { "customer_name": "Ada" }, "transport": { "type": "telephony", "from": "92e68758-3d3a-4f27-8b93-3fd8d834467c", "to": "+14155550123", "call_policy": { "max_ring_duration_ms": 30000, "max_call_duration_seconds": 600, "end_call": { "on_voicemail": true } } } }' ``` The response contains the session ID and its status, as for an RTC session. A session status of `RUNNING` doesn't mean that the call was answered. To end the call, [stop the session](/en/ai/platform/get-started/start-stop-agent#stop-the-session). ### Set call limits and behavior In the call policy, set limits and behavior for the call. If you omit a limit, it doesn't apply. | Field | Description | | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `max_ring_duration_ms` | The maximum time in milliseconds from starting the dial until the call is answered. If nobody answers in time, the dial attempt ends. | | `max_call_duration_seconds` | The maximum length of the call in seconds, from when it's answered. The session's `lifecycle` limits can end the call earlier. | | `max_silence_duration_ms` | Hang up when nobody on the call has spoken for this many milliseconds. In a campaign, the minimum is `30000`. | | `end_call` | The conditions under which the agent can end the call itself. Each condition is off unless you set it to `true`. `on_user_request`: the caller clearly says goodbye or asks to hang up. `on_voicemail`: the call reaches voicemail. `on_ai_assistant`: an AI assistant or another automated system answers. | ## Run a campaign Create a campaign with the agent, the number to call from, the contacts, and a schedule. For each contact, pass the phone number and the values for the agent's variables. The following example calls customers on weekday mornings and afternoons in New York time for two weeks: **Python SDK** Pass the number to call from as a list. ```python ranges = [{"start": "09:00", "end": "12:00"}, {"start": "13:00", "end": "17:00"}] campaign = client.campaigns.create( name="november-appointments", agent_id="3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", transport={ "type": "telephony", "from": ["92e68758-3d3a-4f27-8b93-3fd8d834467c"], "call_policy": {"max_ring_duration_ms": 30000, "end_call": {"on_voicemail": True}}, }, contacts=[ {"phone": "+12025550123", "values": {"customer_name": "Ava", "plan": "pro"}}, {"phone": "+12025550124", "values": {"customer_name": "Ben", "plan": "basic"}}, ], schedule={ "mode": "scheduled", "timezone": "America/New_York", "start": "2026-11-02T09:00", "end": "2026-11-13T17:00", "days": [{"weekday": day, "ranges": ranges} for day in ("mon", "tue", "wed", "thu", "fri")], }, pacing={"max_concurrent": 10}, ) print(campaign["campaign_id"], campaign["status"]) ``` **TypeScript SDK** Pass the number to call from as a list. ```ts const ranges = [ { start: '09:00', end: '12:00' }, { start: '13:00', end: '17:00' }, ]; const campaign = await client.campaigns.create({ name: 'november-appointments', agent_id: '3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10', transport: { type: 'telephony', from: ['92e68758-3d3a-4f27-8b93-3fd8d834467c'], call_policy: { max_ring_duration_ms: 30000, end_call: { on_voicemail: true } }, }, contacts: [ { phone: '+12025550123', values: { customer_name: 'Ava', plan: 'pro' } }, { phone: '+12025550124', values: { customer_name: 'Ben', plan: 'basic' } }, ], schedule: { mode: 'scheduled', timezone: 'America/New_York', start: '2026-11-02T09:00', end: '2026-11-13T17:00', days: (['mon', 'tue', 'wed', 'thu', 'fri'] as const).map((weekday) => ({ weekday, ranges })), }, pacing: { max_concurrent: 10 }, }); console.log(campaign.campaign_id, campaign.status); ``` **Go SDK** Pass the number to call from as a list. This example also imports `github.com/AgoraIO/agora-agents-go/v2/v3`. ```go ranges := []v3.CampaignTimeRange{{Start: "09:00", End: "12:00"}, {Start: "13:00", End: "17:00"}} var days []v3.CampaignCallingDay for _, weekday := range []string{"mon", "tue", "wed", "thu", "fri"} { days = append(days, v3.CampaignCallingDay{Weekday: weekday, Ranges: ranges}) } maxRing, maxConcurrent := 30000, 10 campaign, err := client.Campaigns.Create(ctx, v3.CampaignCreate{ Name: "november-appointments", AgentID: "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", Transport: v3.CampaignTransport{ Type: "telephony", From: []string{"92e68758-3d3a-4f27-8b93-3fd8d834467c"}, CallPolicy: &v3.CampaignCallPolicy{ MaxRingDurationMS: &maxRing, EndCall: &v3.CampaignEndCallPolicy{OnVoicemail: true}, }, }, Contacts: []v3.CampaignContact{ {Phone: "+12025550123", Values: map[string]any{"customer_name": "Ava", "plan": "pro"}}, {Phone: "+12025550124", Values: map[string]any{"customer_name": "Ben", "plan": "basic"}}, }, Schedule: v3.CampaignSchedule{ Mode: "scheduled", Timezone: "America/New_York", Start: "2026-11-02T09:00", End: "2026-11-13T17:00", Days: days, }, Pacing: &v3.CampaignPacing{MaxConcurrent: &maxConcurrent}, }, v3.CampaignWriteOptions{}) if err != nil { log.Fatal(err) } fmt.Println(campaign.Body.CampaignID, campaign.Body.Status) ``` **REST API** Send a request to [Create a campaign](/en/api-reference/api-ref/conversational-ai/platform/create-campaign): ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//campaigns \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "name": "november-appointments", "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "transport": { "type": "telephony", "from": "92e68758-3d3a-4f27-8b93-3fd8d834467c", "call_policy": { "max_ring_duration_ms": 30000, "end_call": { "on_voicemail": true } } }, "contacts": [ { "phone": "+12025550123", "values": { "customer_name": "Ava", "plan": "pro" } }, { "phone": "+12025550124", "values": { "customer_name": "Ben", "plan": "basic" } } ], "schedule": { "mode": "scheduled", "timezone": "America/New_York", "start": "2026-11-02T09:00", "end": "2026-11-13T17:00", "days": [ { "weekday": "mon", "ranges": [{ "start": "09:00", "end": "12:00" }, { "start": "13:00", "end": "17:00" }] }, { "weekday": "tue", "ranges": [{ "start": "09:00", "end": "12:00" }, { "start": "13:00", "end": "17:00" }] }, { "weekday": "wed", "ranges": [{ "start": "09:00", "end": "12:00" }, { "start": "13:00", "end": "17:00" }] }, { "weekday": "thu", "ranges": [{ "start": "09:00", "end": "12:00" }, { "start": "13:00", "end": "17:00" }] }, { "weekday": "fri", "ranges": [{ "start": "09:00", "end": "12:00" }, { "start": "13:00", "end": "17:00" }] } ] }, "pacing": { "max_concurrent": 10 } }' ``` You can pass up to 50,000 contacts, and the whole request body can be at most 10 MiB. You can't change the contacts after you create the campaign. A phone number that appears more than once is called once for each entry. If any contact is missing a value for a `required` variable, or has a value that doesn't match the variable's `type` or `options`, the whole request fails with `400`, and no campaign is created. If the request is successful, the response contains the campaign, including its ID and status: ```json // 201 Created { "campaign_id": "b4f0581e-f138-43a2-851c-a8f8d228bb37", "name": "november-appointments", "status": "scheduled", "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "transport": { "type": "telephony", "from": ["92e68758-3d3a-4f27-8b93-3fd8d834467c"], "call_policy": { "max_ring_duration_ms": 30000, "end_call": { "on_voicemail": true } } }, "lifecycle": { "idle_timeout_ms": 30000, "max_duration_ms": 300000, "graceful_stop": { "enabled": false, "timeout_ms": 30000 } }, "schedule": { ... }, // The schedule you set in the request. "counts": { "contacts": 2, "pending": 2, "calling": 0, "completed": 0, "failed": 0, "canceled": 0 }, "create_ts": 1787673602, "start_ts": null, "complete_ts": null, "failure": null } ``` The response returns `transport.from` as a list, and fills in the default `lifecycle` values for the settings you didn't pass. You can't change the contacts after you create the campaign. A phone number that appears more than once is called once for each entry. If any contact is missing a value for a `required` variable, or has a value that doesn't match the variable's `type` or `options`, the whole request fails with `400`, and no campaign is created. Store the campaign ID. You use it to check and control the campaign. ### Set the schedule In the schedule, set `mode` to one of the following: - `immediate`: The campaign starts dialing as soon as you create it. Don't pass `start` or `end`. - `scheduled`: The campaign dials from `start` until `end`. Pass both as local dates and times in `YYYY-MM-DDTHH:MM` format, and set `timezone` to an IANA time zone, such as `America/New_York`. To limit dialing to certain hours, add `days`. For each weekday, pass up to 10 time ranges in 24-hour `HH:MM` format. Outside these hours, no new calls start. A day you don't list has no dialing. If you omit `days`, the campaign dials at any time between `start` and `end`. ### Set the pacing In the pacing settings, control how fast the campaign dials. The campaign calls each contact once. Automatic retries aren't available in the Preview. | Field | Description | | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | `max_concurrent` | The maximum number of calls in progress at the same time, from 1 to 10,000. The default is `10`. | | `max_calls_per_second` | The maximum number of new dials in any one-second window, up to 1,000. If you omit it, the campaign uses your project's default dial rate. | ## Monitor and control a campaign To check a campaign's progress, retrieve it. The response contains its `status` and `counts`, the number of contacts that are pending, calling, completed, failed, or canceled. **Python SDK** ```python campaign = client.campaigns.get(campaign_id="") print(campaign["status"], campaign["counts"]) ``` **TypeScript SDK** ```ts const campaign = await client.campaigns.get({ id: '' }); console.log(campaign.status, campaign.counts); ``` **Go SDK** ```go campaign, err := client.Campaigns.Get(ctx, "") if err != nil { log.Fatal(err) } fmt.Println(campaign.Body.Status, campaign.Body.Counts) ``` **REST API** Send a request to [Retrieve a campaign](/en/api-reference/api-ref/conversational-ai/platform/retrieve-campaign): ```bash curl --request GET \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//campaigns/ \ --header 'Authorization: Basic ' ``` A campaign has one of the following statuses: | Status | Description | | ----------- | --------------------------------------------------------- | | `scheduled` | The campaign is waiting for its start time. | | `running` | The campaign is dialing, or can dial during its schedule. | | `paused` | You paused the campaign. | | `completed` | The campaign has finished. | | `canceled` | You canceled the campaign. | | `failed` | The campaign failed. The details are in `failure`. | To control a running campaign, use one of the following operations: - [Pause a campaign](/en/api-reference/api-ref/conversational-ai/platform/pause-campaign): Stops new calls. Calls in progress continue. - [Resume a campaign](/en/api-reference/api-ref/conversational-ai/platform/resume-campaign): Continues dialing a paused campaign. - [Cancel a campaign](/en/api-reference/api-ref/conversational-ai/platform/cancel-campaign): Ends the campaign permanently. Contacts that haven't been called change to `canceled`, and you can't resume the campaign. For example, to pause a campaign: **Python SDK** ```python client.campaigns.pause(campaign_id="") ``` **TypeScript SDK** ```ts await client.campaigns.pause({ id: '' }); ``` **Go SDK** ```go if _, err := client.Campaigns.Pause(ctx, ""); err != nil { log.Fatal(err) } ``` **REST API** ```bash curl --request POST \ --url 'https://preview.ai.agora.io/conversational-ai/v1/projects//campaigns/:pause' \ --header 'Authorization: Basic ' ``` To change a campaign, [update it](/en/api-reference/api-ref/conversational-ai/platform/update-campaign). Before the campaign starts dialing, you can change `pacing`, `schedule`, `lifecycle`, and `transport.call_policy`. After it starts, you can change only `pacing`. ## Reference For more information, see the following pages: - [Import phone numbers](/en/ai/platform/build/phone-calls/import-phone-numbers) - [Route inbound calls to an agent](/en/ai/platform/build/phone-calls/route-inbound-calls) - [Personalize conversations](/en/ai/platform/build/shape-the-conversation/personalize-conversations) ### API reference - [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session) - [Create a campaign](/en/api-reference/api-ref/conversational-ai/platform/create-campaign) - [Retrieve a campaign](/en/api-reference/api-ref/conversational-ai/platform/retrieve-campaign) - [Update a campaign](/en/api-reference/api-ref/conversational-ai/platform/update-campaign) - [Pause a campaign](/en/api-reference/api-ref/conversational-ai/platform/pause-campaign) - [Resume a campaign](/en/api-reference/api-ref/conversational-ai/platform/resume-campaign) - [Cancel a campaign](/en/api-reference/api-ref/conversational-ai/platform/cancel-campaign) # Route inbound calls to an agent (/en/ai/platform/build/phone-calls/route-inbound-calls) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). When someone calls one of your phone numbers, the Platform starts a session with the agent you route the number to, and the agent answers the call. You assign an agent to each number, and set limits and behavior for its calls. ## Prerequisites Before you begin, make sure that you have: - An agent to answer the calls. For details, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent). - A phone number in your project. For details, see [Import phone numbers](/en/ai/platform/build/phone-calls/import-phone-numbers). ## Route a number to an agent Assign the agent that answers calls to the number, and set a call policy. A call policy is required whenever you assign an agent. For its fields, see [Set limits and behavior for inbound calls](#set-limits-and-behavior-for-inbound-calls). You can set both when you [import the number](/en/ai/platform/build/phone-calls/import-phone-numbers#import-a-number), or later by updating the number. **Python SDK** Load the agent and call `assign_number()` with the number's ID or its E.164 number. The SDK reads the number's ETag for you, and retries once if the number changed in the meantime. ```python from agora_agent import SavedAgent saved_agent = SavedAgent.get(client, "c8a1e5d2-6f3b-4a9c-b7e0-2d4f6a8c1e3b") saved_agent.assign_number("92e68758-3d3a-4f27-8b93-3fd8d834467c", max_call_duration_seconds=1800) ``` **TypeScript SDK** Load the agent and call `assignNumber()` with the number's ID or its E.164 number. The SDK reads the number's ETag for you, and retries once if the number changed in the meantime. ```ts import { SavedAgent } from 'agora-agents'; const savedAgent = await SavedAgent.get(client, 'c8a1e5d2-6f3b-4a9c-b7e0-2d4f6a8c1e3b'); await savedAgent.assignNumber('92e68758-3d3a-4f27-8b93-3fd8d834467c', { maxCallDurationSeconds: 1800 }); ``` **Go SDK** Load the agent and call `AssignNumber()` with the number's ID or its E.164 number. The SDK reads the number's ETag for you, and retries once if the number changed in the meantime. ```go savedAgent, err := agentkit.GetSavedAgent(ctx, client, "c8a1e5d2-6f3b-4a9c-b7e0-2d4f6a8c1e3b") if err != nil { log.Fatal(err) } maxCallDuration := 1800 _, err = savedAgent.AssignNumber(ctx, "92e68758-3d3a-4f27-8b93-3fd8d834467c", agentkit.AssignNumberOptions{ MaxCallDurationSeconds: &maxCallDuration, }) if err != nil { log.Fatal(err) } ``` **REST API** In the number's `inbound` object, set `agent` to the agent ID, and set a `call_policy`. To update a number, send a request to [Update a phone number](/en/api-reference/api-ref/conversational-ai/platform/update-number), and pass its `ETag` from your last create or retrieve request in the `If-Match` header: ```bash curl --request PATCH \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//numbers/ \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --header 'If-Match: ' \ --data ' { "inbound": { "agent": "c8a1e5d2-6f3b-4a9c-b7e0-2d4f6a8c1e3b", "call_policy": { "max_call_duration_seconds": 1800 } } }' ``` If the number has changed since you read its `ETag`, the request fails with `412 PreconditionFailed`. Retrieve the number again, and retry with its current `ETag`. The `inbound` object you pass replaces the saved one as a whole, so include the complete `call_policy` each time. The same applies to `sip_trunk`: if you update it, pass every field you want to keep, including `auth`. To reject inbound calls to a number, remove its agent. A number without inbound routing also rejects inbound calls. **Python SDK** ```python saved_agent.unassign_number("92e68758-3d3a-4f27-8b93-3fd8d834467c") ``` **TypeScript SDK** ```ts await savedAgent.unassignNumber('92e68758-3d3a-4f27-8b93-3fd8d834467c'); ``` **Go SDK** ```go _, err = savedAgent.UnassignNumber(ctx, "92e68758-3d3a-4f27-8b93-3fd8d834467c") if err != nil { log.Fatal(err) } ``` **REST API** Set `inbound.agent` to `null` in a request to [Update a phone number](/en/api-reference/api-ref/conversational-ai/platform/update-number). ## Set limits and behavior for inbound calls The call policy sets limits and behavior for inbound calls: **Python SDK** `assign_number()` sets only the duration limits. To set `end_call`, update the number with the low-level API, and pass its current ETag: ```python current = client.v3.numbers.with_raw_response.get(number_id="92e68758-3d3a-4f27-8b93-3fd8d834467c") client.v3.numbers.update( number_id="92e68758-3d3a-4f27-8b93-3fd8d834467c", if_match=current.etag, inbound={ "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": { "max_call_duration_seconds": 1800, "max_silence_duration_ms": 60000, "end_call": {"on_user_request": True}, }, }, ) ``` **TypeScript SDK** `assignNumber()` sets only the duration limits. To set `end_call`, update the number with the low-level API, and pass its current ETag: ```ts const { rawResponse } = await client.v3.numbers.get({ id: '92e68758-3d3a-4f27-8b93-3fd8d834467c' }).withRawResponse(); await client.v3.numbers.update({ id: '92e68758-3d3a-4f27-8b93-3fd8d834467c', ifMatch: rawResponse.headers.get('etag') ?? '', inbound: { agent: '3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10', call_policy: { max_call_duration_seconds: 1800, max_silence_duration_ms: 60000, end_call: { on_user_request: true }, }, }, }); ``` **Go SDK** `AssignNumber()` sets only the duration limits. To set `end_call`, update the number with the low-level API, and pass its current ETag. This example also imports `github.com/AgoraIO/agora-agents-go/v2/v3`. ```go callPolicy := map[string]any{ "max_call_duration_seconds": 1800, "max_silence_duration_ms": 60000, "end_call": map[string]any{ "on_user_request": true, }, } current, err := client.V3.Numbers.Get(ctx, "92e68758-3d3a-4f27-8b93-3fd8d834467c") if err != nil { log.Fatal(err) } _, err = client.V3.Numbers.Update(ctx, "92e68758-3d3a-4f27-8b93-3fd8d834467c", current.ETag, v3.NumberPatch{ "inbound": map[string]any{ "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": callPolicy, }, }) if err != nil { log.Fatal(err) } ``` **REST API** Set `call_policy` in the number's `inbound` object: ```json "inbound": { "agent": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "call_policy": { "max_call_duration_seconds": 1800, "max_silence_duration_ms": 60000, "end_call": { "on_user_request": true } } } ``` | Field | Description | | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `max_call_duration_seconds` | The maximum length of a call in seconds, from when it's answered. | | `max_silence_duration_ms` | Hang up when nobody on the call has spoken for this many milliseconds. | | `end_call` | The conditions under which the agent can end the call itself. Each condition is off unless you set it to `true`. `on_user_request`: the caller clearly says goodbye or asks to hang up. `on_voicemail`: the call reaches voicemail. `on_ai_assistant`: an AI assistant or another automated system answers. | If you omit a limit, it doesn't apply. ## Reference For more information, see the following pages: - [Import phone numbers](/en/ai/platform/build/phone-calls/import-phone-numbers) - [Make outbound calls and run campaigns](/en/ai/platform/build/phone-calls/outbound-calls-campaigns) ### API reference - [Update a phone number](/en/api-reference/api-ref/conversational-ai/platform/update-number) - [Retrieve a phone number](/en/api-reference/api-ref/conversational-ai/platform/retrieve-number) # Improve ASR accuracy with keywords (/en/ai/platform/build/shape-the-conversation/asr-keywords) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). In a conversational AI scenario, users may say non-dictionary words such as brand names, product names, personal names, place names, or industry-specific terms. To improve recognition accuracy for these terms, configure ASR keywords in the agent's `asr` block. > **Info** > > The ASR `keywords` described on this page apply only to [ARES](/en/ai/platform/models/asr/ares). Other ASR vendors have their own settings for this, for example `keyterm` for [Deepgram](/en/ai/platform/models/asr/deepgram). ## Prerequisites Before you begin, make sure that you have created an agent and started a session as described in [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent). ## Configure ASR keywords When you [create](/en/api-reference/api-ref/conversational-ai/platform/create-agent) or [update](/en/api-reference/api-ref/conversational-ai/platform/update-agent) an agent, pass the keywords in its ARES configuration. The following example adds three product terms as ARES keywords: **Python SDK** Pass the keywords to `AresSTT`: ```python from agora_agent import Agent, AresSTT # client is your configured Agora client agent = ( Agent(client=client) .with_stt(AresSTT(keywords=["Agora", "Conversational AI", "RTC"])) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** Pass the keywords to `AresSTT`: ```ts import { Agent, AresSTT } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(new AresSTT({ keywords: ['Agora', 'Conversational AI', 'RTC'] })) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** Pass the keywords to `NewAresSTT`: ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewAresSTT(vendors.AresSTTOptions{ Keywords: []string{"Agora", "Conversational AI", "RTC"}, })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Pass the keywords in `params.keywords` of the agent's `asr` block: ```json "pipeline": { "asr": { "credential": { "mode": "managed" }, "vendor": "ares", "language": "en-US", "params": { "keywords": [ "Agora", "Conversational AI", "RTC" ] } } } ``` You can configure up to 128 keywords. ## ASR keywords versus keyword interruption ASR keywords and keyword interruption are separate features, and each uses its own list of keywords: | Feature | Configuration field | Purpose | | :------------------- | :---------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ASR keywords | `pipeline.asr.params.keywords` | Improves speech recognition accuracy for specific terms. | | Keyword interruption | `pipeline.turn_detection.interruption.keywords` | Interrupts the agent only when the user says one of the keywords. For details, see [Interrupt only on keywords](/en/ai/platform/build/shape-the-conversation/interrupt-agent#interrupt-only-on-keywords). | ## Best practices Keep the following tips in mind when choosing keywords: - Prioritize brand names, product names, personal names, place names, model numbers, and abbreviations that are prone to misrecognition. - Avoid configuring too many common words, short words, or generic terms, such as "okay" or "start". - For mixed-language scenarios, you can configure terms in multiple languages together, such as a product's name in its local language, its English name, and its abbreviation. - Before going live, validate recognition results with real production audio, and check both the target keywords and similar-sounding words. ## Reference For more information, see the following pages: - [ARES](/en/ai/platform/models/asr/ares) - [Interrupt the agent mid-response](/en/ai/platform/build/shape-the-conversation/interrupt-agent) ### API reference - [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) - [Update an agent](/en/api-reference/api-ref/conversational-ai/platform/update-agent) # Talking while waiting (/en/ai/platform/build/shape-the-conversation/filler-words) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). In conversational AI, delays in LLM responses may cause users to wonder if the agent is still processing, repeat their question, or disengage entirely. Filler words address this by playing short phrases while the agent waits for the LLM to generate a response. Common use cases for filler words include: - **Tool calls**: When the agent calls tools, response times can increase significantly. Filler words bridge this gap while the agent waits for tool results. - **Complex queries**: Queries that require more LLM processing time benefit from a brief acknowledgment to signal that the agent is working on a response. - **Customer service scenarios**: In support interactions, filler words such as "Let me look into that for you" reassure users that their request is being handled. ## Understand the tech You configure filler words on the agent. When the LLM hasn't responded within a wait threshold, the agent plays a filler word. The filler word comes from one of the following sources: - **Static**: The agent picks a phrase from a list you provide. - **Generated**: Agora generates a short phrase that fits the conversation, based on instructions you provide. If a generated phrase isn't ready in time, the agent falls back to a static phrase. Generated mode requires the agent's LLM to use your own provider key with OpenAI, Groq, or xAI. Playing a filler word doesn't cancel or restart the LLM request. The agent continues with its reply once the LLM responds. The agent plays at most one filler word per turn, and if the LLM responds before the wait threshold, the agent doesn't play a filler word. ## Prerequisites Before you begin, make sure that you have created an agent and started a session as described in [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent). ## Configure static filler words Configure filler words when you [create](/en/api-reference/api-ref/conversational-ai/platform/create-agent) or [update](/en/api-reference/api-ref/conversational-ai/platform/update-agent) the agent. In the following example, the agent plays a phrase from the list when the LLM hasn't responded within 1.5 seconds. The SDK examples start from the `agent` builder in [Create an agent](/en/ai/platform/get-started/start-stop-agent#create-an-agent). **Python SDK** Set the wait time in `fixed_time_config`, and the phrases and selection rule in `static_config`: ```python filler_agent = agent.with_filler_words( { "enable": True, "trigger": { "mode": "fixed_time", "fixed_time_config": {"response_wait_ms": 1500}, }, "content": { "mode": "static", "static_config": { "phrases": [ "Please wait.", "Okay.", "Uh-huh.", "Let me look into that.", "One moment.", ], "selection_rule": "shuffle", }, }, } ) ``` **TypeScript SDK** Set the wait time in `fixed_time_config`, and the phrases and selection rule in `static_config`: ```ts const fillerAgent = agent.withFillerWords({ enable: true, trigger: { mode: 'fixed_time', fixed_time_config: { response_wait_ms: 1500 }, }, content: { mode: 'static', static_config: { phrases: [ 'Please wait.', 'Okay.', 'Uh-huh.', 'Let me look into that.', 'One moment.', ], selection_rule: 'shuffle', }, }, }); ``` **Go SDK** Set the wait time in `FixedTimeConfig`, and the phrases and selection rule in `StaticConfig`. The Go examples on this page also import the SDK's root package as `Agora "github.com/AgoraIO/agora-agents-go/v2"`. ```go fillerAgent := agent.WithFillerWords(&agentkit.FillerWordsConfig{ Enable: Agora.Bool(true), Trigger: &agentkit.FillerWordsTrigger{ Mode: Agora.String("fixed_time"), FixedTimeConfig: &agentkit.FillerWordsTriggerFixedTimeConfig{ ResponseWaitMs: Agora.Int(1500), }, }, Content: &agentkit.FillerWordsContent{ Mode: agentkit.FillerWordsContentModeStatic.Ptr(), StaticConfig: &agentkit.FillerWordsContentStaticConfig{ Phrases: []string{ "Please wait.", "Okay.", "Uh-huh.", "Let me look into that.", "One moment.", }, SelectionRule: agentkit.FillerWordsSelectionRuleShuffle.Ptr(), }, }, }) ``` **REST API** Add a `filler_words` object to the agent configuration, at the same level as `instructions` and `pipeline`: ```json "filler_words": { "enable": true, "trigger": { "mode": "fixed_time", "response_wait_ms": 1500 }, "content": { "mode": "static", "phrases": [ "Please wait.", "Okay.", "Uh-huh.", "Let me look into that.", "One moment." ], "selection_rule": "shuffle" } } ``` | Field | Description | | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `enable` | Whether to play filler words. | | `trigger.mode` | When to play a filler word. Set to `fixed_time`. | | `trigger.response_wait_ms` | How long in milliseconds to wait for the LLM before playing a filler word, from `100` to `10000`. Required. | | `content.mode` | Set to `static`. | | `content.phrases` | The filler phrases, 1 to 100 non-empty strings. | | `content.selection_rule` | How the agent picks the next phrase: `shuffle` (random order, the default) or `round_robin` (list order, starting over after the last phrase). | ## Configure generated filler words To have Agora generate a phrase that fits the conversation, use the same settings with the content mode set to `generated`. Generated mode requires the agent's LLM to use your own key with OpenAI, Groq, or xAI. With a managed LLM, the request is rejected. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). In the instructions, describe the kind of phrase to generate. Set the fallback strategy to `static` to use a static phrase when a generated one isn't ready in time. **Python SDK** Put the instructions in `generated_config.prompt`. This example assumes that `agent` uses your own OpenAI key, as in [Use the key in an agent](/en/ai/platform/build/use-your-own-keys#use-the-key-in-an-agent). ```python generated_filler_agent = agent.with_filler_words( { "enable": True, "trigger": { "mode": "fixed_time", "fixed_time_config": {"response_wait_ms": 1500}, }, "content": { "mode": "generated", "generated_config": { "prompt": "Generate a short, natural filler phrase that shows you're working on the request. Don't answer the question.", "fallback_strategy": "static", }, }, } ) ``` **TypeScript SDK** Put the instructions in `generated_config.prompt`. This example assumes that `agent` uses your own OpenAI key, as in [Use the key in an agent](/en/ai/platform/build/use-your-own-keys#use-the-key-in-an-agent). ```ts const generatedFillerAgent = agent.withFillerWords({ enable: true, trigger: { mode: 'fixed_time', fixed_time_config: { response_wait_ms: 1500 }, }, content: { mode: 'generated', generated_config: { prompt: "Generate a short, natural filler phrase that shows you're working on the request. Don't answer the question.", fallback_strategy: 'static', }, }, }); ``` **Go SDK** Put the instructions in `GeneratedConfig.Prompt`. This example assumes that `agent` uses your own OpenAI key, as in [Use the key in an agent](/en/ai/platform/build/use-your-own-keys#use-the-key-in-an-agent). ```go generatedFillerAgent := agent.WithFillerWords(&agentkit.FillerWordsConfig{ Enable: Agora.Bool(true), Trigger: &agentkit.FillerWordsTrigger{ Mode: Agora.String("fixed_time"), FixedTimeConfig: &agentkit.FillerWordsTriggerFixedTimeConfig{ ResponseWaitMs: Agora.Int(1500), }, }, Content: &agentkit.FillerWordsContent{ Mode: agentkit.FillerWordsContentModeGenerated.Ptr(), GeneratedConfig: &agentkit.FillerWordsContentGeneratedConfig{ Prompt: Agora.String("Generate a short, natural filler phrase that shows you're working on the request. Don't answer the question."), FallbackStrategy: agentkit.FillerWordsFallbackStrategyStatic.Ptr(), }, }, }) ``` **REST API** ```json "filler_words": { "enable": true, "trigger": { "mode": "fixed_time", "response_wait_ms": 1500 }, "content": { "mode": "generated", "instructions": "Generate a short, natural filler phrase that shows you're working on the request. Don't answer the question.", "fallback_strategy": "static" } } ``` | Field | Description | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `content.mode` | Set to `generated`. | | `content.instructions` | Required. The instructions used to generate filler phrases. You can use the agent's variables in them, for example `{{customer_name}}`. For details, see [Personalize conversations](/en/ai/platform/build/shape-the-conversation/personalize-conversations). | | `content.fallback_strategy` | What to use when a generated phrase isn't available. Set to `static`. | The `enable` and `trigger` fields work the same way as for static filler words. ## Best practices Keep the following tips in mind when configuring filler words: - **Keep phrases short and natural**: Use brief, conversational phrases that sound like something a person would say. - **Match phrasing to your use case**: For customer support agents, use reassuring phrases like "Let me look into that for you." For casual assistants, use informal phrases like "Hmm, one sec." - **Tune the trigger threshold**: Start with a `response_wait_ms` of 1500 ms, and adjust it based on your LLM's typical response time. If your agent often calls tools, consider a lower threshold to cover the longer waits. - **Provide enough variety**: Include at least 4 to 6 phrases to avoid sounding repetitive. Use `shuffle` to vary the phrases across turns. ## Reference For more information, see the following pages: - [Personalize conversations](/en/ai/platform/build/shape-the-conversation/personalize-conversations) ### API reference - [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) - [Update an agent](/en/api-reference/api-ref/conversational-ai/platform/update-agent) # Interrupt the agent mid-response (/en/ai/platform/build/shape-the-conversation/interrupt-agent) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). When the agent is speaking or thinking, a user may want to cut in to start a new round of conversation. The Platform supports two kinds of interruption: - **Voice interruption**: The user starts speaking, and the agent stops its response. You choose which speech can interrupt the agent, or turn interruption off. - **Manual interruption**: Your server stops the agent with a REST API request, for example when the user taps a button in your app. ## Choose how users interrupt the agent By default, any user speech interrupts the agent. To change this, set the agent's interruption mode when you create or update an agent. For a complete example, see [Create an agent](/en/ai/platform/get-started/start-stop-agent#create-an-agent). The SDK examples on this page start from the `agent` builder in that example. The interruption mode is one of the following: | Mode | Behavior | | ----------------- | -------------------------------------------------------------------------------------- | | `start_of_speech` | Any user speech interrupts the agent. This is the default. | | `keywords` | Only the phrases in `keywords` interrupt the agent. Other speech doesn't. | | `off` | The user can't interrupt the agent. `when_off` sets what happens to the user's speech. | ### Interrupt only on keywords Use `keywords` mode when background speech or short acknowledgments, such as "uh-huh", shouldn't stop the agent. Pass up to 128 phrases. **Python SDK** ```python keyword_agent = agent.with_interruption( { "mode": "keywords", "keywords_config": {"trigger_keywords": ["stop", "wait", "hold on"]}, } ) ``` **TypeScript SDK** ```ts const keywordAgent = agent.withInterruption({ mode: 'keywords', keywords_config: { trigger_keywords: ['stop', 'wait', 'hold on'] }, }); ``` **Go SDK** The Go examples on this page also import the SDK's root package as `Agora "github.com/AgoraIO/agora-agents-go/v2"`. ```go keywordAgent := agent.WithInterruption(&agentkit.InterruptionConfig{ Mode: agentkit.InterruptionModeKeywords.Ptr(), KeywordsConfig: &Agora.StartAgentsRequestPropertiesInterruptionKeywordsConfig{ TriggerKeywords: []string{"stop", "wait", "hold on"}, }, }) ``` **REST API** In the agent's `pipeline`, set `turn_detection.interruption`: ```json "pipeline": { "turn_detection": { "interruption": { "mode": "keywords", "keywords": ["stop", "wait", "hold on"] } } } ``` ### Turn interruption off Use `off` mode when the agent must finish what it's saying, for example when it reads out a legal disclaimer. Set `when_off` to choose what happens to speech that arrives while the agent speaks or thinks: - `append`: The agent responds to the speech after its current reply. This is the default. - `ignore`: The agent discards the speech. **Python SDK** To turn interruption off, set `enable` to `False`, and set the strategy for the user's speech in `disabled_config`: ```python quiet_agent = agent.with_interruption( { "enable": False, "disabled_config": {"strategy": "ignore"}, } ) ``` **TypeScript SDK** To turn interruption off, set `enable` to `false`, and set the strategy for the user's speech in `disabled_config`: ```ts const quietAgent = agent.withInterruption({ enable: false, disabled_config: { strategy: 'ignore' }, }); ``` **Go SDK** To turn interruption off, set `Enable` to `false`, and set the strategy for the user's speech in `DisabledConfig`: ```go quietAgent := agent.WithInterruption(&agentkit.InterruptionConfig{ Enable: Agora.Bool(false), DisabledConfig: &Agora.StartAgentsRequestPropertiesInterruptionDisabledConfig{ Strategy: agentkit.InterruptionDisabledStrategyIgnore.Ptr(), }, }) ``` **REST API** ```json "pipeline": { "turn_detection": { "interruption": { "mode": "off", "when_off": "ignore" } } } ``` ## Tune when speech counts as an interruption In `start_of_speech` mode, the start-of-speech settings control how quickly user speech interrupts the agent. Choose one of the following detection types: - `semantic`: Detects a meaningful start of speech. This is the default. - `vad`: Uses voice activity detection (VAD) on the audio signal. **Python SDK** Set the detection type in `start_of_speech.mode`, and the durations in `vad_config`: ```python vad_agent = agent.with_turn_detection( { "config": { "speech_threshold": 0.5, "start_of_speech": { "mode": "vad", "vad_config": { "speaking_interrupt_duration_ms": 320, "interrupt_duration_ms": 160, "prefix_padding_ms": 800, }, }, } } ) ``` **TypeScript SDK** Set the detection type in `start_of_speech.mode`, and the durations in `vad_config`: ```ts const vadAgent = agent.withTurnDetection({ config: { speech_threshold: 0.5, start_of_speech: { mode: 'vad', vad_config: { speaking_interrupt_duration_ms: 320, interrupt_duration_ms: 160, prefix_padding_ms: 800, }, }, }, }); ``` **Go SDK** Set the detection type in `StartOfSpeech.Mode`, and the durations in `VadConfig`: ```go vadAgent := agent.WithTurnDetection(&agentkit.TurnDetectionConfig{ Config: &agentkit.TurnDetectionNestedConfig{ SpeechThreshold: Agora.Float64(0.5), StartOfSpeech: &agentkit.StartOfSpeechConfig{ Mode: Agora.StartAgentsRequestPropertiesTurnDetectionConfigStartOfSpeechModeVad, VadConfig: &agentkit.StartOfSpeechVadConfig{ SpeakingInterruptDurationMs: Agora.Int(320), InterruptDurationMs: Agora.Int(160), PrefixPaddingMs: Agora.Int(800), }, }, }, }) ``` **REST API** ```json "pipeline": { "turn_detection": { "speech_threshold": 0.5, "start_of_speech": { "type": "vad", "speaking_interrupt_duration_ms": 320, "interrupt_duration_ms": 160, "prefix_padding_ms": 800 } } } ``` | Field | Description | | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `speaking_interrupt_duration_ms` | How long in milliseconds the user must speak to interrupt the agent while it's speaking. The default is `160`. Increase it to make the agent harder to interrupt. Applies to `semantic` and `vad`. With `vad`, the range is 120 to 1,200. | | `interrupt_duration_ms` | Speech shorter than this, in milliseconds, is ignored. The range is 120 to 1,200, and the default is `160`. Applies to `vad`. | | `prefix_padding_ms` | How many milliseconds of audio to keep from before the detected start of speech. This keeps the beginning of the speech from being clipped. The range is 0 to 5,000, and the default is `800`. Applies to `vad`. | | `speech_threshold` | The speech detection threshold, between `0` and `1`. Lower values detect speech more easily, and higher values ignore weak speech. The default is `0.5`. Set it in `turn_detection`, not in `start_of_speech`. | ## Reference For more information, see the following pages: - [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent) ### API reference - [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) - [Update an agent](/en/api-reference/api-ref/conversational-ai/platform/update-agent) # Personalize conversations (/en/ai/platform/build/shape-the-conversation/personalize-conversations) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Variables let you customize an agent for each conversation and capture its key outcomes. You declare variables when you create an agent and pass their values when you start a session. You can also choose whether Agora retains each session's conversation data. ## Understand the tech A variable is a named value that the agent declares. Each variable has a type, and you use it in one or both of the following ways: - **Personalize the conversation**: Refer to the variable as `{{variable_name}}` in the agent's `instructions`, `messages`, or `greeting.text`. When you start a session, you pass its value in `values`, and the Platform replaces each placeholder with that value. The agent doesn't store values. You pass them for every session. - **Extract outcomes**: In the variable declaration, set `extract` to `true` and describe what the variable means. After the session ends, the Platform extracts the value from the conversation transcript. The Preview API doesn't return the extracted values yet. You can also use variables in the LLM's failure message, the silence message, and generated filler word instructions. ## Prerequisites Before you begin, make sure that you have created an agent and started a session as described in [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent). The SDK examples use the `client` you create there. ## Declare variables When you create or update an agent, declare every variable the agent uses. A variable name starts with a lowercase letter and contains up to 64 lowercase letters, digits, and underscores. In the following example, `customer_name` and `plan` personalize the conversation, and `appointment_confirmed` and `follow_up_date` are extracted after it ends: **Python SDK** Declare each variable with `with_variable()`: ```python from agora_agent import Agent, DeepgramSTT, OpenAI, OpenAITTS agent = ( Agent(client=client) .with_stt(DeepgramSTT(model="nova-3", language="en-US")) .with_llm( OpenAI( model="gpt-4.1-mini", system_messages=[ { "role": "system", "content": "You confirm appointments for Acme customers. The customer is {{customer_name}}, on the {{plan}} plan. Ask whether they can attend their appointment, and if not, when they want to reschedule.", } ], greeting_message="Hi {{customer_name}}, I am calling about your upcoming appointment.", greeting_configs={"on": "each_join"}, ) ) .with_tts(OpenAITTS(model="tts-1", voice="alloy")) # [!code highlight:14] .with_variable("customer_name", type="str", required=True) .with_variable("plan", type="str", options=["basic", "pro"]) .with_variable( "appointment_confirmed", type="bool", extract=True, description="Whether the customer confirmed that they can attend the appointment.", ) .with_variable( "follow_up_date", type="date", extract=True, description="The date the customer wants to reschedule to, if they can't attend.", ) ) saved_agent = agent.save(name="Appointment agent") ``` **TypeScript SDK** Declare each variable with `withVariable()`: ```ts import { Agent, DeepgramSTT, OpenAI, OpenAITTS } from 'agora-agents'; const agent = new Agent({ client }) .withStt(new DeepgramSTT({ model: 'nova-3', language: 'en-US' })) .withLlm( new OpenAI({ model: 'gpt-4.1-mini', systemMessages: [ { role: 'system', content: 'You confirm appointments for Acme customers. The customer is {{customer_name}}, on the {{plan}} plan. Ask whether they can attend their appointment, and if not, when they want to reschedule.', }, ], greetingMessage: 'Hi {{customer_name}}, I am calling about your upcoming appointment.', greetingConfigs: { on: 'each_join' }, }), ) .withTts(new OpenAITTS({ model: 'tts-1', voice: 'alloy' })) // [!code highlight:12] .withVariable('customer_name', { type: 'str', required: true }) .withVariable('plan', { type: 'str', options: ['basic', 'pro'] }) .withVariable('appointment_confirmed', { type: 'bool', extract: true, description: 'Whether the customer confirmed that they can attend the appointment.', }) .withVariable('follow_up_date', { type: 'date', extract: true, description: "The date the customer wants to reschedule to, if they can't attend.", }); const savedAgent = await agent.save({ name: 'Appointment agent' }); ``` **Go SDK** Declare each variable with `WithVariable()`: ```go agent := agentkit.NewAgent(client). WithStt(vendors.NewDeepgramSTT(vendors.DeepgramSTTOptions{Model: "nova-3", Language: "en-US"})). WithLlm(vendors.NewOpenAI(vendors.OpenAIOptions{ Model: "gpt-4.1-mini", SystemMessages: []map[string]interface{}{ { "role": "system", "content": "You confirm appointments for Acme customers. The customer is {{customer_name}}, on the {{plan}} plan. Ask whether they can attend their appointment, and if not, when they want to reschedule.", }, }, GreetingMessage: "Hi {{customer_name}}, I am calling about your upcoming appointment.", GreetingConfigs: map[string]interface{}{"on": "each_join"}, })). WithTts(vendors.NewOpenAITTS(vendors.OpenAITTSOptions{Model: "tts-1", Voice: "alloy"})). // [!code highlight:12] WithVariable("customer_name", agentkit.VariableDefinition{Type: "str", Required: true}). WithVariable("plan", agentkit.VariableDefinition{Type: "str", Options: []any{"basic", "pro"}}). WithVariable("appointment_confirmed", agentkit.VariableDefinition{ Type: "bool", Extract: true, Description: "Whether the customer confirmed that they can attend the appointment.", }). WithVariable("follow_up_date", agentkit.VariableDefinition{ Type: "date", Extract: true, Description: "The date the customer wants to reschedule to, if they can't attend.", }) savedAgent, err := agent.Save(ctx, agentkit.SaveOptions{Name: "Appointment agent"}) if err != nil { log.Fatal(err) } ``` **REST API** Send a request to [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) or [Update an agent](/en/api-reference/api-ref/conversational-ai/platform/update-agent) with the variables in `variables`, keyed by name: ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//agents \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "agent_name": "Appointment agent", "instructions": "You confirm appointments for Acme customers. The customer is {{customer_name}}, on the {{plan}} plan. Ask whether they can attend their appointment, and if not, when they want to reschedule.", "greeting": { "mode": "text", "on": "each_join", "text": "Hi {{customer_name}}, I am calling about your upcoming appointment." }, # [!code highlight:20] "variables": { "customer_name": { "type": "str", "required": true }, "plan": { "type": "str", "options": ["basic", "pro"] }, "appointment_confirmed": { "type": "bool", "extract": true, "description": "Whether the customer confirmed that they can attend the appointment." }, "follow_up_date": { "type": "date", "extract": true, "description": "The date the customer wants to reschedule to, if they can't attend." } }, "pipeline": { "mode": "cascaded", "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US" }, "llm": { "credential": { "mode": "managed" }, "vendor": "openai", "style": "openai", "model": "gpt-4.1-mini" }, "tts": { "credential": { "mode": "managed" }, "vendor": "minimax", "params": { "model": "speech-2.6-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1 } } } } }' ``` Each variable takes the following fields: | Field | Description | | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `type` | Required. The data type: `str`, `int`, `float`, `bool`, `date`, or `datetime`. Pass `date` and `datetime` values as ISO 8601 strings, for example `"2026-09-30"` and `"2026-09-30T14:00:00Z"`. | | `required` | Whether you must pass a value when you start a session. The default is `false`. | | `options` | The allowed values, 1 to 100 unique items of the declared type. Values you pass must be one of them, and extraction chooses one of them. | | `extract` | Whether to extract the variable from the conversation after the session ends. The default is `false`. An agent can have up to 50 extract variables. | | `description` | Required when `extract` is `true`. Up to 2,000 characters. Describe what the variable means as a clear extraction instruction, such as "Whether the customer confirmed that they can attend the appointment." | ## Pass values when you start a session When you start a session, pass the values, keyed by variable name. The values apply to this session only. **Python SDK** ```python session = saved_agent.create_session( channel="", token="", agent_uid="1002", remote_uids=["1001"], # [!code highlight] values={"customer_name": "Ada", "plan": "pro"}, ) session_id = session.start() ``` **TypeScript SDK** ```ts const session = savedAgent.createSession({ channel: '', token: '', agentUid: '1002', remoteUids: ['1001'], // [!code highlight] values: { customer_name: 'Ada', plan: 'pro' }, }); const sessionId = await session.start(); ``` **Go SDK** ```go session := savedAgent.CreateSession(agentkit.CreateSessionOptions{ Channel: "", Token: "", AgentUID: "1002", RemoteUIDs: []string{"1001"}, // [!code highlight] Values: map[string]any{"customer_name": "Ada", "plan": "pro"}, }) sessionID, err := session.Start(ctx) if err != nil { log.Fatal(err) } ``` **REST API** Send a request to [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session) with the values in `values`: ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//sessions \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", # [!code highlight:4] "values": { "customer_name": "Ada", "plan": "pro" }, "transport": { "type": "rtc", "channel": "", "token": "", "uid": "1002", "subscribe_uids": ["1001"] } }' ``` The Platform checks the values when the session starts: - Each key must be a variable that the agent declares. - Each value must match the variable's `type`, and one of its `options` if it has any. - You must pass a value for every variable with `required` set to `true`. If one is missing, the request fails with `400 MissingRequiredField`, and no session starts. - `null` values are rejected. Expansion runs once. A value that contains a placeholder isn't expanded again. When you [create a campaign](/en/api-reference/api-ref/conversational-ai/platform/create-campaign), you pass `values` for each contact instead. An [ephemeral session](/en/api-reference/api-ref/conversational-ai/platform/start-ephemeral-session) takes `values` in the same way, for the variables declared in its `agent`. ## Choose whether Agora retains conversation data When you start a session, set the data retention to choose how Agora handles the session's conversation data: - `30_days`: Agora retains the data for 30 days. This is the default. - `none`: Agora doesn't retain the data, and extraction doesn't run. For example, use `none` when a caller declines to have the conversation recorded: **Python SDK** ```python session = saved_agent.create_session( channel="", token="", agent_uid="1002", remote_uids=["1001"], values={"customer_name": "Ada", "plan": "pro"}, # [!code highlight] data_policy={"retention": "none"}, ) ``` **TypeScript SDK** ```ts const session = savedAgent.createSession({ channel: '', token: '', agentUid: '1002', remoteUids: ['1001'], values: { customer_name: 'Ada', plan: 'pro' }, // [!code highlight] dataPolicy: { retention: 'none' }, }); ``` **Go SDK** ```go session := savedAgent.CreateSession(agentkit.CreateSessionOptions{ Channel: "", Token: "", AgentUID: "1002", RemoteUIDs: []string{"1001"}, Values: map[string]any{"customer_name": "Ada", "plan": "pro"}, // [!code highlight] DataPolicy: &agentkit.SessionDataPolicy{Retention: "none"}, }) ``` **REST API** Set `data_policy.retention` in the request to [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session): ```json "data_policy": { "retention": "none" } ``` You set the data policy when the session starts, and you can't change it afterward. ## Reference For more information, see the following pages: - [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent) ### API reference - [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) - [Update an agent](/en/api-reference/api-ref/conversational-ai/platform/update-agent) - [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session) - [Retrieve a session](/en/api-reference/api-ref/conversational-ai/platform/retrieve-session) - [Create a campaign](/en/api-reference/api-ref/conversational-ai/platform/create-campaign) # Memory for multi-turn conversations (/en/ai/platform/build/shape-the-conversation/short-term-memory) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Short-term memory lets your agent respond coherently across a conversation. During a session, the agent keeps the history of what the user and the agent said, and passes recent messages to the LLM with each request. This page shows how to control that history, seed a conversation with messages, and carry context from one session into the next. The SDK examples start from the `agent` builder and saved agent in [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent). ## Understand the tech With each LLM request, the agent sends the following, in order: 1. The agent's `instructions`. 2. The agent's `messages`, if any. They seed the conversation history. 3. The most recent messages of the conversation, up to the LLM's maximum history. Short-term memory lasts for one session. When the session ends, the agent doesn't keep the conversation. To use it later, save it and pass it to a new session, as described in [Carry context into later sessions](#carry-context-into-later-sessions). ## Prerequisites Before you begin, make sure that you have created an agent and started a session as described in [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent). ## Control how much history the LLM receives Set the LLM's maximum history to the number of recent messages the LLM receives with each request. It counts messages, not pairs of user and agent messages, and the agent's instructions don't count toward it. It accepts `1` to `1024`, and the default is `32`. **Python SDK** Set `max_history` on the LLM that you pass to `with_llm()`: ```python llm = OpenAI( model="gpt-4.1-mini", max_history=12, ) ``` **TypeScript SDK** Set `maxHistory` on the LLM that you pass to `withLlm()`: ```ts const llm = new OpenAI({ model: 'gpt-4.1-mini', maxHistory: 12, }); ``` **Go SDK** Set `MaxHistory` on the LLM that you pass to `WithLlm()`: ```go maxHistory := 12 llm := vendors.NewOpenAI(vendors.OpenAIOptions{ Model: "gpt-4.1-mini", MaxHistory: &maxHistory, }) ``` **REST API** In the agent's `llm` block, set `max_history`: ```json "pipeline": { "llm": { "max_history": 12 } } ``` A lower value keeps each request smaller and faster, but the agent may forget earlier parts of a long conversation. A higher value preserves more context. ## Seed the conversation with messages To start each conversation with context, such as an earlier exchange or a worked example, add messages to the agent. Each message has a `role` (`system`, `user`, or `assistant`) and `content`. The messages follow the agent's instructions. **Python SDK** Add the messages to the LLM's system messages, after the system message. The SDK sends system messages as the agent's instructions, and the other messages as its `messages`. ```python llm = OpenAI( model="gpt-4.1-mini", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, {"role": "user", "content": "What are your opening hours?"}, {"role": "assistant", "content": "We're open from 9 AM to 6 PM, Monday to Friday."}, ], ) ``` **TypeScript SDK** Add the messages to the LLM's system messages, after the system message. The SDK sends system messages as the agent's instructions, and the other messages as its `messages`. ```ts const llm = new OpenAI({ model: 'gpt-4.1-mini', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, { role: 'user', content: 'What are your opening hours?' }, { role: 'assistant', content: "We're open from 9 AM to 6 PM, Monday to Friday." }, ], }); ``` **Go SDK** Add the messages to the LLM's system messages, after the system message. The SDK sends system messages as the agent's instructions, and the other messages as its `messages`. ```go llm := vendors.NewOpenAI(vendors.OpenAIOptions{ Model: "gpt-4.1-mini", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, {"role": "user", "content": "What are your opening hours?"}, {"role": "assistant", "content": "We're open from 9 AM to 6 PM, Monday to Friday."}, }, }) ``` **REST API** Add `messages` to the agent configuration, at the same level as `instructions`: ```json "instructions": "You are a friendly support agent for Acme. Keep your answers short.", "messages": [ { "role": "user", "content": "What are your opening hours?" }, { "role": "assistant", "content": "We're open from 9 AM to 6 PM, Monday to Friday." } ] ``` You can use the agent's variables in `messages`. For details, see [Personalize conversations](/en/ai/platform/build/shape-the-conversation/personalize-conversations). ## Get the conversation after a session After a session ends, Agora can send its transcript to your server in the [`1002` Session transcripts](/en/ai/platform/reference/event-types#1002-session-transcripts) notification event. Each transcript item contains the speaker's role, what was said, the turn ID, and the source of the message, such as `asr` or `llm`. If the agent was interrupted, the item contains only the part that was played. ## Carry context into later sessions The agent doesn't keep memory between sessions. To give a returning user continuity, save what matters from each conversation, and pass it to the next session as a variable: 1. When a session ends, save its transcript, or a summary of it, from the [`1002` Session transcripts](/en/ai/platform/reference/event-types#1002-session-transcripts) event. 2. In the agent's instructions, refer to a variable for the earlier context, and declare the variable. 3. When you start the user's next session, pass the saved summary as the variable's value. For example: **Python SDK** Declare the variable when you create the agent: ```python context_agent = ( Agent(client=client) .with_stt(DeepgramSTT(model="nova-3", language="en-US")) .with_llm( OpenAI( model="gpt-4.1-mini", system_messages=[ { "role": "system", "content": "You are a friendly support agent for Acme. Here is what the user discussed in earlier conversations: {{previous_context}}", } ], ) ) .with_tts(OpenAITTS(model="tts-1", voice="alloy")) .with_variable("previous_context", type="str") ) saved_agent = context_agent.save(name="Support agent") ``` Pass the value when you start a session with that agent: ```python session = saved_agent.create_session( channel="", token="", agent_uid="1002", remote_uids=["1001"], values={ "previous_context": "The user asked about upgrading to the pro plan and wanted a callback about pricing.", }, ) ``` **TypeScript SDK** Declare the variable when you create the agent: ```ts const contextAgent = new Agent({ client }) .withStt(new DeepgramSTT({ model: 'nova-3', language: 'en-US' })) .withLlm( new OpenAI({ model: 'gpt-4.1-mini', systemMessages: [ { role: 'system', content: "You are a friendly support agent for Acme. Here is what the user discussed in earlier conversations: {{previous_context}}", }, ], }), ) .withTts(new OpenAITTS({ model: 'tts-1', voice: 'alloy' })) .withVariable('previous_context', { type: 'str' }); const savedAgent = await contextAgent.save({ name: 'Support agent' }); ``` Pass the value when you start a session with that agent: ```ts const session = savedAgent.createSession({ channel: '', token: '', agentUid: '1002', remoteUids: ['1001'], values: { previous_context: "The user asked about upgrading to the pro plan and wanted a callback about pricing.", }, }); ``` **Go SDK** Declare the variable when you create the agent: ```go contextAgent := agentkit.NewAgent(client). WithStt(vendors.NewDeepgramSTT(vendors.DeepgramSTTOptions{Model: "nova-3", Language: "en-US"})). WithLlm(vendors.NewOpenAI(vendors.OpenAIOptions{ Model: "gpt-4.1-mini", SystemMessages: []map[string]interface{}{ { "role": "system", "content": "You are a friendly support agent for Acme. Here is what the user discussed in earlier conversations: {{previous_context}}", }, }, })). WithTts(vendors.NewOpenAITTS(vendors.OpenAITTSOptions{Model: "tts-1", Voice: "alloy"})). WithVariable("previous_context", agentkit.VariableDefinition{Type: "str"}) savedAgent, err := contextAgent.Save(ctx, agentkit.SaveOptions{Name: "Support agent"}) if err != nil { log.Fatal(err) } ``` Pass the value when you start a session with that agent: ```go session := savedAgent.CreateSession(agentkit.CreateSessionOptions{ Channel: "", Token: "", AgentUID: "1002", RemoteUIDs: []string{"1001"}, Values: map[string]any{ "previous_context": "The user asked about upgrading to the pro plan and wanted a callback about pricing.", }, }) ``` **REST API** Declare the variable when you create the agent: ```json "instructions": "You are a friendly support agent for Acme. Here is what the user discussed in earlier conversations: {{previous_context}}", "variables": { "previous_context": { "type": "str" } } ``` Pass the value when you start the session: ```json "values": { "previous_context": "The user asked about upgrading to the pro plan and wanted a callback about pricing." } ``` Pass a summary rather than the full transcript when you can. It keeps the instructions short and leaves more room for the current conversation. For details about variables, see [Personalize conversations](/en/ai/platform/build/shape-the-conversation/personalize-conversations). ## Reference For more information, see the following pages: - [Personalize conversations](/en/ai/platform/build/shape-the-conversation/personalize-conversations) - [Notification event types](/en/ai/platform/reference/event-types) ### API reference - [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) - [Update an agent](/en/api-reference/api-ref/conversational-ai/platform/update-agent) - [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session) # Use your own provider keys (/en/ai/platform/build/use-your-own-keys) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). To use your own provider accounts for ASR, LLM, or TTS, bring your own key (BYOK). You store each provider API key in a secret set in your project, and your agent refers to the key by name. The key never appears in the agent's configuration, and the API never returns it. ## Understand the tech A secret set is a named group of keys in your project, such as `support_prod`. Each key holds one secret value, such as an OpenAI API key. The workflow is as follows: 1. You create a secret set that contains your provider keys. 2. For each model that uses your own provider account, you pass a reference to a key in the format `$secrets..` instead of the key itself. Agents accept only references, never the keys themselves. Agora checks that the set and key exist when you create or update the agent. 3. When a session starts, Agora resolves each reference to the key's current value. The session keeps that value until it ends. You choose the credential mode for each model. For example, an agent can use your own LLM key while ASR and TTS use [managed mode](/en/ai/platform/build/managed-mode). ## Prerequisites Before you begin, make sure that you have: - An Agora project and its App ID. To create one, use the [Agora CLI](/en/introduction/agora-cli). - REST API credentials for the Platform, or an SDK client. For details, see [Prerequisites](/en/ai/platform/get-started/start-stop-agent#prerequisites). - An account with each provider you want to use, and an API key for it. ## Store your keys in a secret set Create a secret set with a name for the set and your keys. Choose key names that describe their purpose. This example stores an OpenAI API key under the name `llm`. Set names and key names are case-sensitive, and can contain up to 64 letters, digits, and underscores. Hyphens aren't allowed. A set name must be unique in your project. Key names only need to be unique in their set. A set can hold at most 64 KiB of keys and values. By default, an account can have up to 10 secret sets across all of its projects. To raise this limit, contact Agora support. **Python SDK** ```python client.secrets.create( name="support_prod", secrets={"llm": ""}, ) ``` **TypeScript SDK** ```ts await client.secrets.create({ name: 'support_prod', secrets: { llm: '' }, }); ``` **Go SDK** The last argument is an idempotency key. Secret set creation doesn't support one, so pass an empty string. ```go secretSet, err := client.Secrets.Create(ctx, agentkit.SecretCreate{ Name: "support_prod", Secrets: map[string]string{"llm": ""}, }, "") if err != nil { log.Fatal(err) } fmt.Println(secretSet.Body.Name) // The secret set name ``` **REST API** Send a request to [Create a secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set): ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//secrets \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "name": "support_prod", "secrets": { "llm": "" } }' ``` If the request is successful, the response contains the set's name and key names. It never contains the values. ```json // 201 Created { "name": "support_prod", "keys": ["llm"], "create_ts": 1789898400, "update_ts": 1789898400 } ``` > **Tip** > > Create one secret set for each environment, such as `support_dev` and `support_prod`, with the same key names in each. To switch an agent between environments, you then only change the set name in its references. ## Use the key in an agent Create an agent that refers to the key. For each model that uses your own key, pass the reference instead of the key. If a provider needs another secret in a header, such as an organization ID, set the header value in the model's `headers` to a reference too. Don't put keys anywhere else in the agent. In the following example, the LLM uses the OpenAI key stored as `llm` in the `support_prod` set. ASR and TTS use managed mode. **Python SDK** Pass the reference that `secret_ref()` returns as the API key. With your own key, you also set the provider's endpoint in `base_url`. ```python from agora_agent import Agent, DeepgramSTT, OpenAI, OpenAITTS, secret_ref agent = ( Agent(client=client) .with_stt(DeepgramSTT(model="nova-3", language="en-US")) .with_llm( OpenAI( # [!code highlight] api_key=secret_ref("support_prod", "llm"), base_url="https://api.openai.com/v1/chat/completions", model="gpt-4.1-mini", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(OpenAITTS(model="tts-1", voice="alloy")) ) saved_agent = agent.save(name="Support agent") ``` **TypeScript SDK** Pass the reference that `secretRef()` returns as the API key. With your own key, you also set the provider's endpoint in `url`. ```ts import { Agent, DeepgramSTT, OpenAI, OpenAITTS, secretRef } from 'agora-agents'; const agent = new Agent({ client }) .withStt(new DeepgramSTT({ model: 'nova-3', language: 'en-US' })) .withLlm( new OpenAI({ // [!code highlight] apiKey: secretRef('support_prod', 'llm'), url: 'https://api.openai.com/v1/chat/completions', model: 'gpt-4.1-mini', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(new OpenAITTS({ model: 'tts-1', voice: 'alloy' })); const savedAgent = await agent.save({ name: 'Support agent' }); ``` **Go SDK** Pass the reference that `agentkit.SecretRef()` returns as the API key. With your own key, you also set the provider's endpoint in `BaseURL`. ```go agent := agentkit.NewAgent(client). WithStt(vendors.NewDeepgramSTT(vendors.DeepgramSTTOptions{Model: "nova-3", Language: "en-US"})). WithLlm(vendors.NewOpenAI(vendors.OpenAIOptions{ // [!code highlight] APIKey: agentkit.SecretRef("support_prod", "llm"), BaseURL: "https://api.openai.com/v1/chat/completions", Model: "gpt-4.1-mini", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, })). WithTts(vendors.NewOpenAITTS(vendors.OpenAITTSOptions{Model: "tts-1", Voice: "alloy"})) savedAgent, err := agent.Save(ctx, agentkit.SaveOptions{Name: "Support agent"}) if err != nil { log.Fatal(err) } ``` **REST API** Send a request to [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) with a `pipeline`. For each block that uses your own key, set `credential.mode` to `byok`, and set the provider's key field in `credential.fields` to the reference. For most providers, the field is `api_key`. Each model page lists its provider's fields. Managed blocks don't accept `fields`, and keys don't belong in `params`. ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//agents \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "agent_name": "Support agent", "instructions": "You are a friendly support agent for Acme. Keep your answers short.", "pipeline": { "mode": "cascaded", "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US" }, "llm": { # [!code highlight:6] "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.llm" } }, "vendor": "openai", "style": "openai", "model": "gpt-4.1-mini" }, "tts": { "credential": { "mode": "managed" }, "vendor": "minimax", "params": { "model": "speech-2.6-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1 } } } } }' ``` If the request is successful, the response contains the agent ID and the saved configuration. In the response, each block's `credential` contains only `mode`. Neither the reference nor the key is returned. You then start sessions with the agent as usual. The session request doesn't change. For details, see [Start a session](/en/ai/platform/get-started/start-stop-agent#start-a-session). ## Rotate a key To replace a key's value, set the key to its new value. You don't need to change the agents that reference the key. **Python SDK** ```python client.secrets.set_key( name="support_prod", key="llm", value="", ) ``` **TypeScript SDK** ```ts await client.secrets.setKey({ name: 'support_prod', key: 'llm', value: '', }); ``` **Go SDK** This example also imports `github.com/AgoraIO/agora-agents-go/v2/v3`. ```go secretKey, err := client.Secrets.SetKey(ctx, "support_prod", "llm", v3.SecretKeyWrite{Value: ""}, v3.SecretKeyOptions{}) if err != nil { log.Fatal(err) } fmt.Println(secretKey.Body.Key) // The key name ``` **REST API** Send a request to [Set a secret key](/en/api-reference/api-ref/conversational-ai/platform/set-secret-key) with the new value: ```bash curl --request PUT \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//secrets/support_prod/keys/llm \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "value": "" }' ``` If the request is successful, the response contains the key's name: ```json // 200 OK { "key": "llm" } ``` New sessions use the new value. Sessions that are already running keep the value they started with. Keep the old key active with your provider until those sessions end. To change several keys at the same time, [update the secret set](/en/api-reference/api-ref/conversational-ai/platform/update-secret-set) with all the new values in one request. ## Troubleshoot secret references The following table lists common errors when you work with secret sets and references: | Error | Cause | Solution | | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `400 UnknownSecretReference` | An agent refers to a set or key that doesn't exist. | Check the spelling and case of the set and key names in `$secrets..`. Names can't contain dots. | | `400 MissingRequiredField` | A `byok` block has no `fields`. | Pass your credentials in `credential.fields`, as described in [Use the key in an agent](#use-the-key-in-an-agent). | | `400 InvalidRequestBody` | A `managed` block has `fields`. | Remove `fields`, or set `mode` to `byok`. | | `400 InvalidFieldValue` | `fields` uses the wrong field names for the provider, a value in `fields` isn't a `$secrets..` reference, a key is in `params`, or the vendor doesn't support the credential mode. | Use the field names on the provider's model page, refer to your keys by reference, and keep keys out of `params`. | | `409 SecretSetAlreadyExists` | A secret set with this name already exists. | To change its keys, [set a key](/en/api-reference/api-ref/conversational-ai/platform/set-secret-key) or [update the set](/en/api-reference/api-ref/conversational-ai/platform/update-secret-set). | | `409 SecretSetInUse` | You tried to delete a key or set that an agent refers to. | Update or delete the agents that refer to it first. | | `422 ResourceQuotaLimitExceeded` | Your account has reached its secret set quota. By default, an account can have up to 10 secret sets across all of its projects. | Delete secret sets you no longer use. | For all error reasons, see [Status codes](/en/api-reference/api-ref/conversational-ai/platform/status-codes). ## Reference For more information, see the following pages: - [Use managed mode](/en/ai/platform/build/managed-mode) - [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent) ### API reference - [Create a secret set](/en/api-reference/api-ref/conversational-ai/platform/create-secret-set) - [List secret sets](/en/api-reference/api-ref/conversational-ai/platform/list-secret-sets) - [Update a secret set](/en/api-reference/api-ref/conversational-ai/platform/update-secret-set) - [Set a secret key](/en/api-reference/api-ref/conversational-ai/platform/set-secret-key) - [Delete a secret key](/en/api-reference/api-ref/conversational-ai/platform/delete-secret-key) - [Delete a secret set](/en/api-reference/api-ref/conversational-ai/platform/delete-secret-set) - [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) # Create an agent and start a session (/en/ai/platform/get-started/start-stop-agent) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). On the Conversational AI Platform, you create an agent once and save it in your project. For each conversation, you start a session that runs the agent in an RTC channel or in telephony, and you stop the session when the conversation ends. This page shows the code for each step. In a production environment, run this code on your business server. ## Understand the tech An agent is a saved configuration. A session is a single conversation that runs it. The workflow is as follows: 1. Your server creates an agent and stores the agent ID that the Platform returns. You do this once, not for every conversation. 2. Your server starts a session with the agent ID, the channel name, and the user's UID. The agent and the user, through your app, join the same RTC channel. The agent talks to the user, using the agent's ASR, LLM, and TTS models and Agora's low-latency Software-Defined Real-Time Network (SDRTN®). 3. When the conversation ends, your server stops the session, and the agent leaves the channel. ## Prerequisites Use the [Agora CLI](/en/introduction/agora-cli) to create or select an Agora project, verify project readiness, and export local credentials: ```bash agora login agora project create conv-ai-tutorial agora project use conv-ai-tutorial agora project doctor agora project env --format shell --with-secrets ``` You also need: - An [RTC token](/en/realtime-media/rtc/build/authenticate-users/integrate-token-generation) for the agent's UID in the channel. - A client app that can join an Agora RTC channel, such as the [Voice Calling](/en/realtime-media/rtc/voice-quickstart) or [Video Calling](/en/realtime-media/rtc/get-started-sdk) quickstart. **Python SDK** Install the SDK preview in your project's virtual environment. You need Python 3.8 or later. Specify the version, because the default `agora-agents` release doesn't support the Platform API. ```bash pip install agora-agents==3.0.0a3 ``` Create a client with your App ID and App Certificate. The SDK uses them to generate a token for each request. The Python examples on this page use this `client`: ```python import os from agora_agent import Agora, Area client = Agora( area=Area.US, app_id=os.environ["AGORA_APP_ID"], app_certificate=os.environ["AGORA_APP_CERTIFICATE"], ) ``` **TypeScript SDK** Install the SDK preview in your project. You need Node.js 18 or later. Specify the version, because the default `agora-agents` release doesn't support the Platform API. ```bash cd npm install agora-agents@3.0.0-alpha.3 ``` Create a client with your App ID and App Certificate. The SDK uses them to generate a token for each request. The TypeScript examples on this page use this `client`: ```ts import { AgoraClient, Area } from 'agora-agents'; const client = new AgoraClient({ area: Area.US, appId: process.env.AGORA_APP_ID!, appCertificate: process.env.AGORA_APP_CERTIFICATE!, }); ``` **Go SDK** Add the SDK to your Go module. You need Go 1.21 or later. ```bash cd go get github.com/AgoraIO/agora-agents-go/v2@v2.14.0-alpha.3 go mod tidy ``` Create a client with your App ID and App Certificate. The SDK uses them to generate a token for each request. The Go examples on this page use this `client` and `ctx`, and these imports: ```go import ( "context" "fmt" "log" "os" "github.com/AgoraIO/agora-agents-go/v2/agentkit" "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors" "github.com/AgoraIO/agora-agents-go/v2/option" ) ctx := context.Background() client := agentkit.NewAgoraClient(agentkit.AgoraClientOptions{ Area: option.AreaUS, AppID: os.Getenv("AGORA_APP_ID"), AppCertificate: os.Getenv("AGORA_APP_CERTIFICATE"), }) ``` **REST API** Get REST API credentials for the Platform. For details, see [Authentication](/en/api-reference/api-ref/conversational-ai/platform/authentication). ## Create an agent Create an agent with its name, instructions, greeting, and models. This example declares a `customer_name` variable and uses it in the instructions and the greeting. You pass its value when you start a session. **Python SDK** ```python from agora_agent import Agent, DeepgramSTT, OpenAI, OpenAITTS agent = ( Agent(client=client) .with_stt(DeepgramSTT(model="nova-3", language="en-US")) .with_llm( OpenAI( model="gpt-4.1-mini", system_messages=[ { "role": "system", "content": "You are a friendly support agent for Acme. Address the user as {{customer_name}}. Keep your answers short.", } ], greeting_message="Hi {{customer_name}}, how can I help you today?", greeting_configs={"on": "each_join"}, ) ) .with_tts(OpenAITTS(model="tts-1", voice="alloy")) .with_variable("customer_name", type="str", required=True) ) saved_agent = agent.save(name="Support agent") print(saved_agent.id) # The agent ID ``` **TypeScript SDK** ```ts import { Agent, DeepgramSTT, OpenAI, OpenAITTS } from 'agora-agents'; const agent = new Agent({ client }) .withStt(new DeepgramSTT({ model: 'nova-3', language: 'en-US' })) .withLlm( new OpenAI({ model: 'gpt-4.1-mini', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Address the user as {{customer_name}}. Keep your answers short.', }, ], greetingMessage: 'Hi {{customer_name}}, how can I help you today?', greetingConfigs: { on: 'each_join' }, }), ) .withTts(new OpenAITTS({ model: 'tts-1', voice: 'alloy' })) .withVariable('customer_name', { type: 'str', required: true }); const savedAgent = await agent.save({ name: 'Support agent' }); console.log(savedAgent.id); // The agent ID ``` **Go SDK** ```go agent := agentkit.NewAgent(client). WithStt(vendors.NewDeepgramSTT(vendors.DeepgramSTTOptions{Model: "nova-3", Language: "en-US"})). WithLlm(vendors.NewOpenAI(vendors.OpenAIOptions{ Model: "gpt-4.1-mini", SystemMessages: []map[string]interface{}{ { "role": "system", "content": "You are a friendly support agent for Acme. Address the user as {{customer_name}}. Keep your answers short.", }, }, GreetingMessage: "Hi {{customer_name}}, how can I help you today?", GreetingConfigs: map[string]interface{}{"on": "each_join"}, })). WithTts(vendors.NewOpenAITTS(vendors.OpenAITTSOptions{Model: "tts-1", Voice: "alloy"})). WithVariable("customer_name", agentkit.VariableDefinition{Type: "str", Required: true}) savedAgent, err := agent.Save(ctx, agentkit.SaveOptions{Name: "Support agent"}) if err != nil { log.Fatal(err) } fmt.Println(savedAgent.ID) // The agent ID ``` **REST API** Send a request to [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). The `pipeline` sets the agent's ASR, LLM, and TTS models. ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//agents \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "agent_name": "Support agent", "instructions": "You are a friendly support agent for Acme. Address the user as {{customer_name}}. Keep your answers short.", "variables": { "customer_name": { "type": "str", "required": true } }, "greeting": { "mode": "text", "on": "each_join", "text": "Hi {{customer_name}}, how can I help you today?" }, "pipeline": { "mode": "cascaded", "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US" }, "llm": { "credential": { "mode": "managed" }, "vendor": "openai", "style": "openai", "model": "gpt-4.1-mini" }, "tts": { "credential": { "mode": "managed" }, "vendor": "minimax", "params": { "model": "speech-2.6-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1 } } } } }' ``` If the request is successful, the response contains the agent ID and the saved configuration: ```json // 201 Created { "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "agent_name": "Support agent", "instructions": "You are a friendly support agent for Acme. Address the user as {{customer_name}}. Keep your answers short.", "variables": { "customer_name": { "type": "str", "required": true } }, "greeting": { "mode": "text", "on": "each_join", "text": "Hi {{customer_name}}, how can I help you today?" }, "pipeline": { ... }, // The pipeline you set in the request. "create_ts": 1786543331, "update_ts": 1786543331 } ``` Store the agent ID. You use it to start every session that runs this agent. This agent uses managed mode for its ASR, LLM, and TTS models. Agora provides access to the models, and you don't need provider API keys. To use other models or your own provider accounts, see [Use managed mode](/en/ai/platform/build/managed-mode) and [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). ## Start a session To start a conversation, start a session with the agent ID and the following details: - The RTC channel for the conversation. - The RTC token for the agent's UID. - The UID the agent uses in the channel. It must be different from the user's UID. - The UID of the user the agent talks to. - A value for each required variable that you defined when you created the agent, such as `customer_name`. **Python SDK** Load the saved agent and call `create_session()`. ```python from agora_agent import SavedAgent saved_agent = SavedAgent.get(client, "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10") session = saved_agent.create_session( channel="", token="", agent_uid="1002", remote_uids=["1001"], values={"customer_name": "Ada"}, ) session_id = session.start() print(session_id) # The agent_session_id ``` **TypeScript SDK** Load the saved agent and call `createSession()`. ```ts import { SavedAgent } from 'agora-agents'; const savedAgent = await SavedAgent.get(client, '3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10'); const session = savedAgent.createSession({ channel: '', token: '', agentUid: '1002', remoteUids: ['1001'], values: { customer_name: 'Ada' }, }); const sessionId = await session.start(); console.log(sessionId); // The agent_session_id ``` **Go SDK** Load the saved agent and call `CreateSession()`. ```go savedAgent, err := agentkit.GetSavedAgent(ctx, client, "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10") if err != nil { log.Fatal(err) } session := savedAgent.CreateSession(agentkit.CreateSessionOptions{ Channel: "", Token: "", AgentUID: "1002", RemoteUIDs: []string{"1001"}, Values: map[string]any{"customer_name": "Ada"}, }) sessionID, err := session.Start(ctx) if err != nil { log.Fatal(err) } fmt.Println(sessionID) // The agent_session_id ``` **REST API** Send a request to [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session). In `transport`, set: - `type`: `rtc`, to run the session in an RTC channel. To run the session in a phone call, you use `telephony` instead. For details, see [Make outbound calls and run campaigns](/en/ai/platform/build/phone-calls/outbound-calls-campaigns). - `channel`: The RTC channel for the conversation. - `token`: The RTC token for the agent's UID. - `uid`: The UID the agent uses in the channel, as a string or an integer. It must be different from the user's UID. If you omit it, Agora assigns one. - `subscribe_uids`: The UID of the user the agent talks to, as a string or an integer. In `values`, pass the variable values. In the `Idempotency-Key` header, pass a unique value for each session you start. If a request times out, retry it with the same key and the same body. If the first request already started the session, the retry fails with `409 IdempotencyKeyConflict` instead of starting a second one. To get the session ID, [list sessions](/en/api-reference/api-ref/conversational-ai/platform/list-sessions) filtered by your channel. ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//sessions \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: ' \ --data ' { "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10", "values": { "customer_name": "Ada" }, "transport": { "type": "rtc", "channel": "", "token": "", "uid": "1002", "subscribe_uids": ["1001"] } }' ``` If the request is successful, the response contains the session ID and its [status](#check-the-session-status): ```json // 200 OK { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "create_ts": 1737111452, "status": "RUNNING" } ``` Store the session ID. You use it to check and stop the session. ## Check the session status A session starts asynchronously. Starting a session successfully confirms that the session exists, not that the agent has joined the channel. To follow the session, retrieve it with its session ID: **Python SDK** ```python info = client.v3.sessions.get(agent_session_id="") print(info["status"]) ``` If you still have the `session` object from Start a session, you can call `session.get_info()` instead. **TypeScript SDK** ```ts const info = await client.v3.sessions.get({ agentSessionId: '' }); console.log(info.status); ``` If you still have the `session` object from Start a session, you can call `await session.getInfo()` instead. **Go SDK** ```go info, err := client.V3.Sessions.Get(ctx, "") if err != nil { log.Fatal(err) } fmt.Println(info.Body.Status) ``` If you still have the `session` object from Start a session, you can call `session.GetInfo(ctx)` instead. **REST API** Send a request to [Retrieve a session](/en/api-reference/api-ref/conversational-ai/platform/retrieve-session): ```bash curl --request GET \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//sessions/ \ --header 'Authorization: Basic ' ``` When the agent is in the channel, the response looks like this: ```json // 200 OK { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "status": "RUNNING", "start_ts": 1735035893, "message": "ok" } ``` When the agent is in the channel, `status` is `RUNNING`. A session has one of the following statuses: | Status | Description | | ---------- | --------------------------------------------------------------------- | | `IDLE` | The session is idle. | | `STARTING` | The session is starting, and the agent hasn't joined the channel yet. | | `RUNNING` | The agent is in the channel. | | `STOPPING` | The session is stopping. | | `STOPPED` | The session has ended, and the agent has left the channel. | | `FAILED` | The session failed. Check `message` for the reason. | ## Stop the session When the conversation ends, stop the session with its session ID. The agent leaves the channel. **Python SDK** ```python client.v3.sessions.stop(agent_session_id="") ``` If you still have the `session` object from Start a session, you can call `session.stop()` instead. **TypeScript SDK** ```ts await client.v3.sessions.stop({ agentSessionId: '' }); ``` If you still have the `session` object from Start a session, you can call `await session.stop()` instead. **Go SDK** ```go if _, err := client.V3.Sessions.Stop(ctx, ""); err != nil { log.Fatal(err) } ``` If you still have the `session` object from Start a session, you can call `session.Stop(ctx)` instead. **REST API** Send a request to [Stop a session](/en/api-reference/api-ref/conversational-ai/platform/stop-session) without a body: ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//sessions//stop \ --header 'Authorization: Basic ' ``` If the request is successful, the response is an empty JSON object: ```json // 200 OK {} ``` A session also stops asynchronously. To confirm that the session has ended, retrieve it and check that `status` is `STOPPED`. If you don't stop a session, it ends when it reaches a `lifecycle` limit. By default, a session ends 30 seconds after no participant is present, or 5 minutes after it starts. You can set `lifecycle.max_duration_ms` up to 1 hour when you start the session. ## Test a configuration without saving an agent To try a configuration before you save it, start an ephemeral session. You pass the agent configuration instead of an agent ID, and the Platform doesn't save the configuration. **Python SDK** Call `create_session()` on an `Agent` instead of a saved agent. The SDK starts an ephemeral session when you set a Platform session option, such as `max_duration` in seconds. ```python from agora_agent import Agent, DeepgramSTT, OpenAI, OpenAITTS test_agent = ( Agent(client=client) .with_stt(DeepgramSTT(model="nova-3", language="en-US")) .with_llm( OpenAI( model="gpt-4.1-mini", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], greeting_message="Hi, how can I help you today?", greeting_configs={"on": "each_join"}, ) ) .with_tts(OpenAITTS(model="tts-1", voice="alloy")) ) session = test_agent.create_session( channel="", token="", agent_uid="1002", remote_uids=["1001"], max_duration=600, ) session_id = session.start() ``` **TypeScript SDK** Call `createSession()` on an `Agent` instead of a saved agent. The SDK starts an ephemeral session when you set a Platform session option, such as `maxDuration` in seconds. ```ts import { Agent, DeepgramSTT, OpenAI, OpenAITTS } from 'agora-agents'; const testAgent = new Agent({ client }) .withStt(new DeepgramSTT({ model: 'nova-3', language: 'en-US' })) .withLlm( new OpenAI({ model: 'gpt-4.1-mini', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], greetingMessage: 'Hi, how can I help you today?', greetingConfigs: { on: 'each_join' }, }), ) .withTts(new OpenAITTS({ model: 'tts-1', voice: 'alloy' })); const session = testAgent.createSession({ channel: '', token: '', agentUid: '1002', remoteUids: ['1001'], maxDuration: 600, }); const sessionId = await session.start(); ``` **Go SDK** Call `CreateSession()` on an `Agent` instead of a saved agent. The SDK starts an ephemeral session when you set a Platform session option, such as `MaxDuration` in seconds. ```go testAgent := agentkit.NewAgent(client). WithStt(vendors.NewDeepgramSTT(vendors.DeepgramSTTOptions{Model: "nova-3", Language: "en-US"})). WithLlm(vendors.NewOpenAI(vendors.OpenAIOptions{ Model: "gpt-4.1-mini", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, GreetingMessage: "Hi, how can I help you today?", GreetingConfigs: map[string]interface{}{"on": "each_join"}, })). WithTts(vendors.NewOpenAITTS(vendors.OpenAITTSOptions{Model: "tts-1", Voice: "alloy"})) maxDuration := 600 session := testAgent.CreateSession(agentkit.CreateSessionOptions{ Channel: "", Token: "", AgentUID: "1002", RemoteUIDs: []string{"1001"}, MaxDuration: &maxDuration, }) sessionID, err := session.Start(ctx) if err != nil { log.Fatal(err) } ``` **REST API** Send a request to [Start an ephemeral session](/en/api-reference/api-ref/conversational-ai/platform/start-ephemeral-session). The request is the same as Start a session, but you pass the agent configuration in `agent` instead of `agent_id`. ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//sessions/ephemeral \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "agent": { "instructions": "You are a friendly support agent for Acme. Keep your answers short.", "greeting": { "mode": "text", "on": "each_join", "text": "Hi, how can I help you today?" }, "pipeline": { "mode": "cascaded", "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US" }, "llm": { "credential": { "mode": "managed" }, "vendor": "openai", "style": "openai", "model": "gpt-4.1-mini" }, "tts": { "credential": { "mode": "managed" }, "vendor": "minimax", "params": { "model": "speech-2.6-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1 } } } } }, "transport": { "type": "rtc", "channel": "", "token": "", "uid": "1002", "subscribe_uids": ["1001"] } }' ``` The response has the same format as Start a session. Check and stop an ephemeral session the same way as any other session. When the configuration works as you want, save it with [Create an agent](#create-an-agent), or apply it to an existing agent with [Update an agent](/en/api-reference/api-ref/conversational-ai/platform/update-agent). ## Reference For more information, see the following pages: - [Use managed mode](/en/ai/platform/build/managed-mode) - [Authentication](/en/api-reference/api-ref/conversational-ai/platform/authentication) ### API reference - [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent) - [Update an agent](/en/api-reference/api-ref/conversational-ai/platform/update-agent) - [Start a session](/en/api-reference/api-ref/conversational-ai/platform/start-session) - [Start an ephemeral session](/en/api-reference/api-ref/conversational-ai/platform/start-ephemeral-session) - [Retrieve a session](/en/api-reference/api-ref/conversational-ai/platform/retrieve-session) - [List sessions](/en/api-reference/api-ref/conversational-ai/platform/list-sessions) - [Stop a session](/en/api-reference/api-ref/conversational-ai/platform/stop-session) # Amazon Transcribe (/en/ai/platform/models/asr/amazon) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Amazon provides advanced automatic speech recognition with high accuracy and support for multiple languages, designed for real-time conversational AI applications. ## Sample configuration The following example shows how to configure Amazon Transcribe as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Amazon Transcribe supports BYOK only. It isn't available in managed mode. Store your AWS credentials in a secret set, and refer to them from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, AmazonSTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( AmazonSTT( access_key=secret_ref("support_prod", "amazon_access_key_id"), secret_key=secret_ref("support_prod", "amazon"), region="", language="en-US", additional_params={"media_sample_rate_hz": 16000, "media_encoding": "pcm"}, ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, AmazonSTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new AmazonSTT({ accessKey: secretRef('support_prod', 'amazon_access_key_id'), secretKey: secretRef('support_prod', 'amazon'), region: '', language: 'en-US', additionalParams: { media_sample_rate_hz: 16000, media_encoding: 'pcm' }, }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewAmazonSTT(vendors.AmazonSTTOptions{ AccessKey: agentkit.SecretRef("support_prod", "amazon_access_key_id"), SecretKey: agentkit.SecretRef("support_prod", "amazon"), Region: "", Language: "en-US", AdditionalParams: map[string]interface{}{ "media_sample_rate_hz": 16000, "media_encoding": "pcm", }, })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok`, and set `credential.fields.access_key_id` and `credential.fields.secret_access_key` to references to your AWS access key ID and secret access key in a secret set. In the following example, they're stored as `amazon_access_key_id` and `amazon` in the `support_prod` set: ```json "asr": { "credential": { "mode": "byok", "fields": { "access_key_id": "$secrets.support_prod.amazon_access_key_id", "secret_access_key": "$secrets.support_prod.amazon" } }, "vendor": "amazon", "language": "en-US", "params": { "language_code": "en-US", "region": "", "media_sample_rate_hz": 16000, "media_encoding": "pcm" } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `AmazonSTT` sets them from its options, and passes any other Amazon Transcribe parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `amazon`. **`credential` (object) required** How the agent authenticates with Amazon Transcribe. Set `mode` to `byok`, and set `fields.access_key_id` and `fields.secret_access_key` to `$secrets..` references to your AWS access key ID and secret access key. Get both from the [AWS IAM Console](https://console.aws.amazon.com/iam/). **`language` (string) required** The language code for speech recognition, for example, `en-US`, `es-US`, or `fr-FR`. See [supported languages](https://docs.aws.amazon.com/transcribe/latest/dg/supported-languages.html) for available language codes. **`params` (object) required** **`region` (string) required** The AWS region where the Transcribe service is hosted, for example, `us-east-1`, `us-west-2`, or `eu-west-1`. See [AWS regions](https://docs.aws.amazon.com/general/latest/gr/transcribe.html) for available regions. **`language_code` (string) required** The language code for Amazon Transcribe. Use the same value as `language`. **`media_sample_rate_hz` (integer) optional** The sample rate in Hertz for the audio input, for example, `16000` or `8000`. **`media_encoding` (string) optional** The encoding format of the audio input, for example, `pcm`, `opus`, or `flac`. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Amazon Transcribe without validation. For a full list of supported options, refer to the [Amazon official documentation](https://docs.aws.amazon.com/transcribe/latest/dg/streaming.html). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # ARES (/en/ai/platform/models/asr/ares) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Adaptive Recognition Engine for Speech (ARES) provides built-in real-time speech-to-text, offering seamless integration with low latency and reliable performance for conversational AI applications. ## Sample configuration The following example shows how to configure ARES as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). ARES is available in managed mode only. Agora provides ARES, and you don't need a provider account or API key. For details, see [Use managed mode](/en/ai/platform/build/managed-mode). **Python SDK** ```python from agora_agent import Agent, AresSTT # client is your configured Agora client agent = ( Agent(client=client) .with_stt(AresSTT(keywords=["Agora", "Conversational AI", "RTC"])) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, AresSTT } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(new AresSTT({ keywords: ['Agora', 'Conversational AI', 'RTC'] })) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewAresSTT(vendors.AresSTTOptions{ Keywords: []string{"Agora", "Conversational AI", "RTC"}, })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `managed` in the `asr` block: ```json "asr": { "credential": { "mode": "managed" }, "vendor": "ares", "language": "en-US", "params": { "keywords": ["Agora", "Conversational AI", "RTC"] } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `AresSTT` sets them from its options, and passes any other ARES parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `ares`. **`credential` (object) required** How the agent authenticates with ARES. Set `mode` to `managed`. **`language` (string) required** The BCP-47 language tag identifying the primary language used for agent interaction. See [Supported languages](/en/realtime-media/speech-to-text/reference/supported-languages#real-time-transcription) for the complete list. **`params` (object) optional** **`keywords` (array[string]) optional** Keywords used to improve ASR recognition accuracy for specific terms, such as brand names, product names, or industry jargon. Supports up to 128 keywords. See [Configure ASR keywords](/en/ai/platform/build/shape-the-conversation/asr-keywords) for details. # AssemblyAI (/en/ai/platform/models/asr/assembly-ai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). AssemblyAI provides advanced automatic speech recognition with high accuracy and support for multiple languages, designed for real-time conversational AI applications. ## Sample configuration The following example shows how to configure AssemblyAI as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). AssemblyAI supports BYOK only. It isn't available in managed mode. Store your AssemblyAI API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, AssemblyAISTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( AssemblyAISTT( api_key=secret_ref("support_prod", "assemblyai"), language="en-US", ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, AssemblyAISTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new AssemblyAISTT({ apiKey: secretRef('support_prod', 'assemblyai'), language: 'en-US', }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewAssemblyAISTT(vendors.AssemblyAISTTOptions{ APIKey: agentkit.SecretRef("support_prod", "assemblyai"), Language: "en-US", })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your AssemblyAI API key in a secret set. In the following example, the key is stored as `assemblyai` in the `support_prod` set: ```json "asr": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.assemblyai" } }, "vendor": "assemblyai", "language": "en-US", "url": "wss://streaming.assemblyai.com/v3/ws", "params": { "language": "en-US" } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `AssemblyAISTT` sets them from its options, and passes any other AssemblyAI parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `assemblyai`. **`credential` (object) required** How the agent authenticates with AssemblyAI. Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your AssemblyAI API key. Get your API key from the [AssemblyAI Dashboard](https://www.assemblyai.com/dashboard/signup). **`language` (string) required** The language code for speech recognition. **`url` (string) optional** The WebSocket URL for AssemblyAI's streaming API. Specify this to target a particular region, for example, `wss://streaming.assemblyai.com/v3/ws`. Omit it to use the default endpoint. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to AssemblyAI without validation. For a full list of supported options, refer to the [AssemblyAI official documentation](https://www.assemblyai.com/docs/universal-streaming). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Deepgram (/en/ai/platform/models/asr/deepgram) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Deepgram provides fast, accurate automatic speech recognition with advanced AI models optimized for real-time streaming and conversational applications across multiple languages. ## Sample configuration The following example shows how to configure Deepgram as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Deepgram supports managed mode and BYOK. In managed mode, Agora provides access to Deepgram, and you don't need a Deepgram account. For BYOK, store your Deepgram API key in a secret set, and refer to it from the agent. For details, see [Use managed mode](/en/ai/platform/build/managed-mode) and [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, DeepgramSTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( DeepgramSTT( api_key=secret_ref("support_prod", "deepgram"), # omit to use managed mode model="nova-3", language="en-US", keyterm="agora%20convo", ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, DeepgramSTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new DeepgramSTT({ apiKey: secretRef('support_prod', 'deepgram'), // omit to use managed mode model: 'nova-3', language: 'en-US', keyterm: 'agora%20convo', }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewDeepgramSTT(vendors.DeepgramSTTOptions{ APIKey: agentkit.SecretRef("support_prod", "deepgram"), // omit to use managed mode Model: "nova-3", Language: "en-US", Keyterm: "agora%20convo", })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** - **Managed mode** Set `credential.mode` to `managed` in the `asr` block. Agora provides access to Deepgram, and you don't need a Deepgram account. ```json "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US", "params": { "keyterm": "agora%20convo" } } ``` - **BYOK** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Deepgram API key in a secret set. In the following example, the key is stored as `deepgram` in the `support_prod` set: ```json "asr": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.deepgram" } }, "vendor": "deepgram", "model": "nova-3", "language": "en-US", "params": { "keyterm": "term1%20term2" } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `DeepgramSTT` sets them from its options, and passes any other Deepgram parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `deepgram`. **`credential` (object) required** How the agent authenticates with Deepgram. Set `mode` to `managed`, or to `byok` with `fields.api_key` set to a `$secrets..` reference to your Deepgram API key. Get your API key from the [Deepgram Console](https://console.deepgram.com/). **`model` (string) optional** The speech recognition model to use. Required in managed mode, where it must be `nova-2` or `nova-3`. **`language` (string) optional** The language code for speech recognition, for example `en-US`, `es`, or `fr`. See [supported languages](https://developers.deepgram.com/docs/models-languages-overview) for language codes. **`url` (string) optional** A custom WebSocket endpoint for Deepgram's streaming API, for example `wss://api.deepgram.com/v1/listen`. Omit it to use the default endpoint. **`params` (object) optional** **`keyterm` (string) optional** Boost specialized terms and brands. Only compatible with the `nova-3` model. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Deepgram without validation. For a full list of supported options, refer to the [Deepgram API documentation](https://developers.deepgram.com/docs/getting-started-with-live-streaming-audio). > > The following parameters are not passed through and instead use default values set by Agora: > `callback`, `callback_method`, `channels`, `encoding`, `multichannel`, `sample_rate` # Gemini (/en/ai/platform/models/asr/gemini) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Google Gemini provides real-time streaming transcription. Use it as the ASR model in a cascading pipeline with any supported LLM and TTS vendor. ## Sample configuration The following example shows how to configure Gemini as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Gemini supports BYOK only. It isn't available in managed mode. Store your Gemini API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, GeminiSTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( GeminiSTT( api_key=secret_ref("support_prod", "gemini"), model="gemini-3.5-transcribe-live", language="en-US", sample_rate=16000, word_timestamp=True, ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, GeminiSTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new GeminiSTT({ apiKey: secretRef('support_prod', 'gemini'), model: 'gemini-3.5-transcribe-live', language: 'en-US', sampleRate: 16000, wordTimestamp: true, }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go wordTimestamp := true // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewGeminiSTT(vendors.GeminiSTTOptions{ APIKey: agentkit.SecretRef("support_prod", "gemini"), Model: "gemini-3.5-transcribe-live", Language: "en-US", SampleRate: 16000, WordTimestamp: &wordTimestamp, })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Gemini API key in a secret set. In the following example, the key is stored as `gemini` in the `support_prod` set: ```json "asr": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.gemini" } }, "vendor": "gemini", "model": "gemini-3.5-transcribe-live", "language": "en-US", "params": { "sample_rate": 16000, "word_timestamp": true } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `GeminiSTT` sets them from its options, and passes any other Gemini parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `gemini`. **`credential` (object) required** How the agent authenticates with Gemini. Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Google Gemini API key. You can generate an API key in [Google AI Studio](https://aistudio.google.com/apikey). **`model` (string) required** The Gemini transcription model identifier. Set to `gemini-3.5-transcribe-live` to use Gemini 3.5 Transcribe Live. **`language` (string) required** The BCP-47 language tag identifying the primary language used for agent interaction, for example, `en-US`. **`params` (object) optional** **`sample_rate` (integer) optional** The audio sample rate in Hz. For example, `16000`. **`word_timestamp` (boolean) optional** Whether to include word-level timestamps in the transcription results. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Gemini without validation. For a full list of supported options, refer to the [Google Gemini API documentation](https://ai.google.dev/api/live). # Google (/en/ai/platform/models/asr/google) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Google provides advanced automatic speech recognition with high accuracy and support for multiple languages, designed for real-time conversational AI applications. ## Sample configuration The following example shows how to configure Google as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Google supports BYOK only. It isn't available in managed mode. Store your Google Cloud service account credentials in a secret set, and refer to them from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, GoogleSTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( GoogleSTT( adc_credentials_string=secret_ref("support_prod", "google"), project_id="", location="global", language="en-US", model="long", ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, GoogleSTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new GoogleSTT({ adcCredentialsString: secretRef('support_prod', 'google'), projectId: '', location: 'global', language: 'en-US', model: 'long', }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewGoogleSTT(vendors.GoogleSTTOptions{ ADCCredentialsString: agentkit.SecretRef("support_prod", "google"), ProjectID: "", Location: "global", Language: "en-US", Model: "long", })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.adc_credentials_string` to a reference to your service account credentials in a secret set. In the following example, the credentials are stored as `google` in the `support_prod` set: ```json "asr": { "credential": { "mode": "byok", "fields": { "adc_credentials_string": "$secrets.support_prod.google" } }, "vendor": "google", "model": "long", "language": "en-US", "params": { "language": "en-US", "project_id": "", "location": "global" } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `GoogleSTT` sets them from its options, and passes any other Google parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `google`. **`credential` (object) required** How the agent authenticates with Google. Set `mode` to `byok` and `fields.adc_credentials_string` to a `$secrets..` reference to your Google Cloud service account credentials JSON string. Get your credentials from the [Google Cloud Console](https://console.cloud.google.com/). **`model` (string) optional** The recognition model to use. **`language` (string) required** The language code for speech recognition, for example, `en-US`, `es-ES`, or `fr-FR`. See [supported languages](https://cloud.google.com/speech-to-text/docs/speech-to-text-supported-languages) for available language codes. **`params` (object) required** **`project_id` (string) required** The Google Cloud project ID where the Speech-to-Text API is enabled. Get your project ID from the [Google Cloud Console](https://console.cloud.google.com/). **`location` (string) required** The Google Cloud region where the speech service is hosted, for example, `global`, `us-central1`, or `europe-west1`. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Google without validation. For a full list of supported options, refer to the [Google official documentation](https://docs.cloud.google.com/speech-to-text/v2/docs). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Microsoft Azure (/en/ai/platform/models/asr/microsoft) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Microsoft Azure provides enterprise-grade automatic speech recognition with support for multiple languages and robust noise handling capabilities, optimized for real-time conversational applications. ## Sample configuration The following example shows how to configure Microsoft Azure as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Microsoft Azure supports BYOK only. It isn't available in managed mode. Store your Azure Speech key in a secret set, and refer to it from the agent. Your Azure region isn't secret. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, MicrosoftSTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( MicrosoftSTT( key=secret_ref("support_prod", "microsoft"), region="eastus", language="en-US", additional_params={"phrase_list": ["agora", "conversational", "ai", "engine"]}, ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, MicrosoftSTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new MicrosoftSTT({ key: secretRef('support_prod', 'microsoft'), region: 'eastus', language: 'en-US', additionalParams: { phrase_list: ['agora', 'conversational', 'ai', 'engine'] }, }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewMicrosoftSTT(vendors.MicrosoftSTTOptions{ Key: agentkit.SecretRef("support_prod", "microsoft"), Region: "eastus", Language: "en-US", AdditionalParams: map[string]interface{}{ "phrase_list": []string{"agora", "conversational", "ai", "engine"}, }, })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.key` to a reference to your Azure Speech key in a secret set. Pass the region in `params`. In the following example, the key is stored as `microsoft` in the `support_prod` set: ```json "asr": { "credential": { "mode": "byok", "fields": { "key": "$secrets.support_prod.microsoft" } }, "vendor": "microsoft", "language": "en-US", "params": { "language": "en-US", "region": "eastus", "phrase_list": ["agora", "conversational", "ai", "engine"] } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `MicrosoftSTT` sets them from its options, and passes any other Microsoft Azure parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `microsoft`. **`credential` (object) required** How the agent authenticates with Microsoft Azure. Set `mode` to `byok` and `fields.key` to a `$secrets..` reference to your Azure Speech key. Get your key from the [Azure Portal](https://portal.azure.com/). **`language` (string) required** The language code for speech recognition, for example, `en-US`, `es-ES`, or `fr-FR`. See [supported languages](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=stt) for language codes. **`params` (object) required** **`region` (string) required** The Azure region where the speech service is hosted, for example, `eastus` or `westus2`. **`phrase_list` (array[string]) optional** A list of words or phrases provided in advance to improve recognition accuracy. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Microsoft Azure without validation. For a full list of supported options, refer to the [Microsoft Azure Speech-to-Text documentation](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/speech-to-text). # OpenAI (/en/ai/platform/models/asr/openai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). OpenAI provides real-time speech-to-text with low latency and reliable performance, making it ideal for conversational AI applications. ## Sample configuration The following example shows how to configure OpenAI ASR as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). OpenAI ASR supports BYOK only. It isn't available in managed mode. Store your OpenAI API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, OpenAISTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( OpenAISTT( api_key=secret_ref("support_prod", "openai"), model="gpt-4o-mini-transcribe", prompt="Please transcribe the following audio into text. Output in English.", language="en", ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, OpenAISTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new OpenAISTT({ apiKey: secretRef('support_prod', 'openai'), model: 'gpt-4o-mini-transcribe', prompt: 'Please transcribe the following audio into text. Output in English.', language: 'en', }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewOpenAISTT(vendors.OpenAISTTOptions{ APIKey: agentkit.SecretRef("support_prod", "openai"), Model: "gpt-4o-mini-transcribe", Prompt: "Please transcribe the following audio into text. Output in English.", Language: "en", })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your OpenAI API key in a secret set. In the following example, the key is stored as `openai` in the `support_prod` set: ```json "asr": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.openai" } }, "vendor": "openai", "language": "en-US", "params": { "input_audio_transcription": { "model": "gpt-4o-mini-transcribe", "prompt": "Please transcribe the following audio into text. Output in English.", "language": "en" } } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `OpenAISTT` sets the transcription model, prompt, and language in `params.input_audio_transcription`, and passes any other OpenAI ASR parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `openai`. **`credential` (object) required** How the agent authenticates with OpenAI. Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your OpenAI API key. **`language` (string) optional** The language of the user's speech, for example, `en-US`. **`params` (object) required** **`input_audio_transcription` (object) required** The configuration object for audio transcription. Use this object to specify the model, prompt, and language for the transcription task. **`model` (string) required** The OpenAI ASR model to use for transcription. For example, `gpt-4o-mini-transcribe`. **`prompt` (string) required** A prompt that guides the transcription process. Use this parameter to provide context or instructions for how the audio should be transcribed. **`language` (string) required** The language code to use for transcription. For example, use `en` for English. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to OpenAI without validation. For a full list of supported options, refer to the [OpenAI documentation](https://platform.openai.com/docs/guides/speech-to-text). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Sarvam (/en/ai/platform/models/asr/sarvam) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Sarvam ASR provides real-time speech-to-text with low latency and reliable performance for Indian languages. ## Sample configuration The following example shows how to configure Sarvam as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Sarvam supports BYOK only. It isn't available in managed mode. Store your Sarvam API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, SarvamSTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( SarvamSTT( api_key=secret_ref("support_prod", "sarvam"), language="hi-IN", ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, SarvamSTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new SarvamSTT({ apiKey: secretRef('support_prod', 'sarvam'), language: 'hi-IN', }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewSarvamSTT(vendors.SarvamSTTOptions{ APIKey: agentkit.SecretRef("support_prod", "sarvam"), Language: "hi-IN", })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Sarvam API key in a secret set. In the following example, the key is stored as `sarvam` in the `support_prod` set: ```json "asr": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.sarvam" } }, "vendor": "sarvam", "language": "hi-IN", "params": { "language": "hi-IN" } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `SarvamSTT` sets them from its options, and passes any other Sarvam parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `sarvam`. **`credential` (object) required** How the agent authenticates with Sarvam. Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Sarvam API key. Get your API key from the [Sarvam dashboard](https://dashboard.sarvam.ai/signin). **`language` (string) required** The language code for transcription, for example, `hi-IN`. Set to `unknown` for automatic language detection. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Sarvam without validation. For a full list of supported options, refer to the [Sarvam documentation](https://docs.sarvam.ai/api-reference-docs/speech-to-text/transcribe). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Smallest AI (/en/ai/platform/models/asr/smallest-ai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Smallest AI provides real-time streaming transcription through its Pulse model. Use it as the ASR model in a cascading pipeline with any supported LLM and TTS vendor. ## Sample configuration The following example shows how to configure Smallest AI as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Smallest AI supports BYOK only. It isn't available in managed mode. Store your Smallest AI API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** The SDK converts the boolean options to the `"true"` and `"false"` strings that Smallest AI expects. ```python from agora_agent import Agent, SmallestAISTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( SmallestAISTT( api_key=secret_ref("support_prod", "smallestai"), language="zh", url="wss://api.us.smallest.ai/waves/v1/stt/live", sample_rate=16000, encoding="linear16", word_timestamps=True, sentence_timestamps=True, diarize=True, vad_events=True, endpointing=True, eou_timeout_ms=480, format=True, finalize_on_words=True, max_words="100", punctuate=True, capitalize=True, itn_normalize=True, full_transcript=True, keywords="Codex:2,Smallest AI:2", redact_pii=False, redact_pci=False, ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** The SDK converts the boolean options to the `"true"` and `"false"` strings that Smallest AI expects. ```ts import { Agent, SmallestAISTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new SmallestAISTT({ apiKey: secretRef('support_prod', 'smallestai'), language: 'zh', url: 'wss://api.us.smallest.ai/waves/v1/stt/live', sampleRate: 16000, encoding: 'linear16', wordTimestamps: true, sentenceTimestamps: true, diarize: true, vadEvents: true, endpointing: true, eouTimeoutMs: 480, format: true, finalizeOnWords: true, maxWords: '100', punctuate: true, capitalize: true, itnNormalize: true, fullTranscript: true, keywords: 'Codex:2,Smallest AI:2', redactPii: false, redactPci: false, }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** The SDK converts the boolean options to the `"true"` and `"false"` strings that Smallest AI expects. ```go sampleRate, eouTimeoutMs := 16000, 480 // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewSmallestAISTT(vendors.SmallestAISTTOptions{ APIKey: agentkit.SecretRef("support_prod", "smallestai"), Language: "zh", URL: "wss://api.us.smallest.ai/waves/v1/stt/live", SampleRate: &sampleRate, Encoding: "linear16", WordTimestamps: true, SentenceTimestamps: true, Diarize: true, VADEvents: true, Endpointing: true, EOUTimeoutMs: &eouTimeoutMs, Format: true, FinalizeOnWords: true, MaxWords: "100", Punctuate: true, Capitalize: true, ITNNormalize: true, FullTranscript: true, Keywords: "Codex:2,Smallest AI:2", })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Smallest AI API key in a secret set. In the following example, the key is stored as `smallestai` in the `support_prod` set. Only `credential` and `vendor` are required: ```json "asr": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.smallestai" } }, "vendor": "smallestai", "language": "zh", "url": "wss://api.us.smallest.ai/waves/v1/stt/live", "params": { "sample_rate": 16000, "encoding": "linear16", "word_timestamps": "true", "sentence_timestamps": "true", "diarize": "true", "vad_events": "true", "endpointing": "true", "eou_timeout_ms": 480, "format": "true", "finalize_on_words": "true", "max_words": "100", "punctuate": "true", "capitalize": "true", "itn_normalize": "true", "full_transcript": "true", "keywords": "Codex:2,Smallest AI:2", "redact_pii": "false", "redact_pci": "false" } } ``` > **Info** > > Smallest AI expects its boolean options as the strings `"true"` and `"false"`, as shown in the example. ## Key parameters The `asr` block takes the following fields. In the SDKs, `SmallestAISTT` sets them from its options, and passes any other Smallest AI parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `smallestai`. **`credential` (object) required** How the agent authenticates with Smallest AI. Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Smallest AI API key. **`language` (string) optional** The language code for speech recognition, for example, `zh`. **`url` (string) optional** The Smallest AI streaming ASR WebSocket endpoint, for example, `wss://api.us.smallest.ai/waves/v1/stt/live`. Omit it to use the default endpoint. **`params` (object) optional** **`sample_rate` (integer) optional** Input audio sample rate in Hz. Defaults to `16000`. **`encoding` (string) optional** Input audio encoding. Defaults to `linear16`. **`word_timestamps` (string) optional** Whether to include word-level timestamps in the transcription results. **`sentence_timestamps` (string) optional** Whether to include sentence-level timestamps in the transcription results. **`diarize` (string) optional** Whether to enable speaker diarization. Speaker labels are emitted on final transcription results. **`vad_events` (string) optional** Whether to emit voice activity detection events. **`endpointing` (string) optional** Whether to enable automatic end-of-utterance detection. **`eou_timeout_ms` (integer) optional** End-of-utterance timeout in milliseconds. For example, `480`. **`format` (string) optional** Whether to enable Smallest AI's transcript formatting. Smallest AI defines the formatting applied. **`finalize_on_words` (string) optional** Whether to finalize transcription results based on word count, together with `max_words`. **`max_words` (string) optional** Maximum number of words per transcription result, passed as a string. For example, `"100"`. **`punctuate` (string) optional** Whether to add punctuation to transcription results. **`capitalize` (string) optional** Whether to apply capitalization to transcription results. **`itn_normalize` (string) optional** Whether to apply inverse text normalization, which converts spoken forms such as numbers and dates into written form. Smallest AI applies it only to finalized transcripts, before redaction. **`full_transcript` (string) optional** Whether to return the full accumulated transcript. **`keywords` (string) optional** Keyword boosts that improve recognition accuracy for specific terms, as a comma-separated list in `keyword:weight` format. For example, `Codex:2,Smallest AI:2`. **`redact_pii` (string) optional** Whether to redact personally identifiable information from transcription results. **`redact_pci` (string) optional** Whether to redact payment card information from transcription results. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Smallest AI without validation. For a full list of supported options, refer to the [Smallest AI documentation](https://docs.smallest.ai/models/documentation/speech-to-text-pulse/overview). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Speechmatics (/en/ai/platform/models/asr/speechmatics) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Speechmatics provides real-time automatic speech recognition (ASR) with flexible language support and reliable performance for conversational AI applications. ## Sample configuration The following example shows how to configure Speechmatics as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Speechmatics supports BYOK only. It isn't available in managed mode. Store your Speechmatics API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, SpeechmaticsSTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( SpeechmaticsSTT( api_key=secret_ref("support_prod", "speechmatics"), language="en", ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, SpeechmaticsSTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new SpeechmaticsSTT({ apiKey: secretRef('support_prod', 'speechmatics'), language: 'en', }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewSpeechmaticsSTT(vendors.SpeechmaticsSTTOptions{ APIKey: agentkit.SecretRef("support_prod", "speechmatics"), Language: "en", })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.key` to a reference to your Speechmatics API key in a secret set. In the following example, the key is stored as `speechmatics` in the `support_prod` set: ```json "asr": { "credential": { "mode": "byok", "fields": { "key": "$secrets.support_prod.speechmatics" } }, "vendor": "speechmatics", "language": "en", "url": "wss://eu2.rt.speechmatics.com/v2", "params": { "language": "en" } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `SpeechmaticsSTT` sets them from its options, and passes any other Speechmatics parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `speechmatics`. **`credential` (object) required** How the agent authenticates with Speechmatics. Set `mode` to `byok` and `fields.key` to a `$secrets..` reference to your Speechmatics API key. **`language` (string) required** The language code to use for transcription. For example, use `en` for English. **`url` (string) optional** The WebSocket URL for the Speechmatics streaming API. Specify this to target a particular region, for example, `wss://eu2.rt.speechmatics.com/v2`. Omit it to use the default endpoint. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Speechmatics without validation. For a full list of supported options, refer to the [Speechmatics documentation](https://docs.speechmatics.com/api-ref/realtime-transcription-websocket). # xAI (/en/ai/platform/models/asr/xai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). xAI provides real-time automatic speech recognition (ASR) over WebSocket for conversational AI applications. ## Sample configuration The following example shows how to configure xAI as the agent's ASR when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). xAI supports BYOK only. It isn't available in managed mode. Store your xAI API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, XaiSTT, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt( XaiSTT( api_key=secret_ref("support_prod", "xai"), language="en", base_url="wss://api.x.ai/v1/stt", sample_rate=16000, ) ) .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, XAiSTT, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt( new XAiSTT({ apiKey: secretRef('support_prod', 'xai'), language: 'en', baseUrl: 'wss://api.x.ai/v1/stt', sampleRate: 16000, }), ) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go sampleRate := vendors.SampleRate16kHz // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt(vendors.NewXaiSTT(vendors.XaiSTTOptions{ APIKey: agentkit.SecretRef("support_prod", "xai"), Language: "en", BaseURL: "wss://api.x.ai/v1/stt", SampleRate: &sampleRate, })). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your xAI API key in a secret set. In the following example, the key is stored as `xai` in the `support_prod` set: ```json "asr": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.xai" } }, "vendor": "xai", "language": "en", "url": "wss://api.x.ai/v1/stt", "params": { "sample_rate": 16000 } } ``` ## Key parameters The `asr` block takes the following fields. In the SDKs, `XaiSTT` sets them from its options, and passes any other xAI parameters from its additional parameters option to `params`. **asr required** **`vendor` (string) required** Set to `xai`. **`credential` (object) required** How the agent authenticates with xAI. Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your xAI API key. **`language` (string) optional** The language code to use for transcription. For example, use `en` for English. Setting this enables text formatting of numbers, currencies, and units. For supported language codes, refer to the [xAI documentation](https://docs.x.ai/developers/model-capabilities/audio/speech-to-text#supported-languages). **`url` (string) optional** The WebSocket endpoint URL for the xAI streaming STT API. Defaults to `wss://api.x.ai/v1/stt`. **`params` (object) optional** **`sample_rate` (integer) optional** The audio sample rate in Hz. Supported values: `8000`, `16000`, `22050`, `24000`, `44100`, `48000`. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to xAI without validation. For a full list of supported options, refer to the [xAI Speech to Text documentation](https://docs.x.ai/developers/model-capabilities/audio/speech-to-text#streaming-speech-to-text-websocket). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Akool (/en/ai/platform/models/avatar/akool) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Akool provides AI-powered avatars with realistic facial expressions and lip-sync capabilities, enabling natural video conversations with your AI agents. Their platform offers a variety of pre-built avatars and supports custom avatar creation. ## Sample configuration The following example shows how to configure Akool as the agent's avatar when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Akool supports BYOK only. It isn't available in managed mode. Store your Akool API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, AkoolAvatar, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts(...) # configure a TTS vendor with a 16,000 Hz sample rate .with_avatar( AkoolAvatar( api_key=secret_ref("support_prod", "akool"), avatar_id="", additional_params={ "agora_uid": "", "agora_token": "", }, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, AkoolAvatar, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts(/* configure a TTS vendor with a 16,000 Hz sample rate */) .withAvatar( new AkoolAvatar({ apiKey: secretRef('support_prod', 'akool'), avatarId: '', additionalParams: { agora_uid: '', agora_token: '', }, }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure a TTS vendor with a 16,000 Hz sample rate */ ). WithAvatar(vendors.NewAkoolAvatar(vendors.AkoolAvatarOptions{ APIKey: agentkit.SecretRef("support_prod", "akool"), AvatarID: "", AdditionalParams: map[string]interface{}{ "agora_uid": "", "agora_token": "", }, })) ``` **REST API** Add an `avatar` block to the `pipeline`. Set `credential.mode` to `byok` and `credential.fields.api_key` to the reference. In the following example, the key is stored as `akool` in the `support_prod` set: ```json "avatar": { "enabled": true, "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.akool" } }, "vendor": "akool", "params": { "agora_uid": "", "agora_token": "", "avatar_id": "" } } ``` > **Info** > > Akool avatars only support audio with a sample rate of 16,000 Hz. Using a TTS model configured with a different sample rate results in an error. Make sure that your TTS configuration matches this requirement. ## Key parameters The `avatar` block takes the following fields. In the SDKs, `AkoolAvatar` sets them from its options, and passes any other parameters from its additional parameters option to `params`. **avatar required** **`enabled` (boolean) required** Set to `true` to show the avatar. **`vendor` (string) required** Set to `akool`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Akool API key. > **Info** > > To purchase an Akool API key, contact [Agora sales](mailto:sales@agora.io). **`params` (object) required** **`agora_uid` (string) required** The unique identifier for the avatar's RTC connection. This must be different from other participants in the channel. **`agora_token` (string) optional** The RTC token that authorizes the avatar to join the video channel. Generate this token using your Agora project credentials. **`avatar_id` (string) required** The unique identifier for the specific Akool avatar you want to use. Find available avatar IDs in your Akool dashboard. This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Anam (/en/ai/platform/models/avatar/anam) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Anam provides AI-powered avatars with real-time video rendering, enabling natural video conversations with your AI agents. ## Sample configuration The following example shows how to configure Anam as the agent's avatar when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Anam supports BYOK only. It isn't available in managed mode. Store your Anam API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, AnamAvatar, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor .with_avatar( AnamAvatar( api_key=secret_ref("support_prod", "anam"), avatar_id="960f614f-ea88-47c3-9883-f02094f70874", additional_params={ "agora_uid": "", "agora_token": "", "sample_rate": 24000, "quality": "high", "video_encoding": "H264", }, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, AnamAvatar, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */) .withAvatar( new AnamAvatar({ apiKey: secretRef('support_prod', 'anam'), avatarId: '960f614f-ea88-47c3-9883-f02094f70874', additionalParams: { agora_uid: '', agora_token: '', sample_rate: 24000, quality: 'high', video_encoding: 'H264', }, }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ). WithAvatar(vendors.NewAnamAvatar(vendors.AnamAvatarOptions{ APIKey: agentkit.SecretRef("support_prod", "anam"), AvatarID: "960f614f-ea88-47c3-9883-f02094f70874", AdditionalParams: map[string]interface{}{ "agora_uid": "", "agora_token": "", "sample_rate": 24000, "quality": "high", "video_encoding": "H264", }, })) ``` **REST API** Add an `avatar` block to the `pipeline`. Set `credential.mode` to `byok` and `credential.fields.api_key` to the reference. In the following example, the key is stored as `anam` in the `support_prod` set: ```json "avatar": { "enabled": true, "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.anam" } }, "vendor": "anam", "params": { "avatar_id": "960f614f-ea88-47c3-9883-f02094f70874", "agora_uid": "", "agora_token": "", "sample_rate": 24000, "quality": "high", "video_encoding": "H264" } } ``` ## Key parameters The `avatar` block takes the following fields. In the SDKs, `AnamAvatar` sets them from its options, and passes any other parameters from its additional parameters option to `params`. **avatar required** **`enabled` (boolean) required** Set to `true` to show the avatar. **`vendor` (string) required** Set to `anam`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Anam API key. Get your API key from the Anam console. **`params` (object) required** **`avatar_id` (string) required** The unique identifier for the Anam avatar you want to use. **`agora_uid` (string) required** The unique identifier for the avatar's RTC connection. This must be different from other participants in the channel. **`agora_token` (string) required** The RTC token that authorizes the avatar to join the video channel. Generate this token using your Agora project credentials. **`sample_rate` (number) optional** Default value: `24000` Possible values: `16000, 24000, 48000` The audio sample rate in Hz. **`quality` (string) optional** Default value: `high` Possible values: `high, medium, low` The video quality level. **`video_encoding` (string) optional** Default value: `H264` Possible values: `H264, AV1` The video encoding format. This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Generic avatar (/en/ai/platform/models/avatar/generic) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). The `generic` avatar vendor lets you integrate a custom avatar provider into the Conversational AI Platform. ## Sample configuration The following example shows how to configure a generic avatar provider as the agent's avatar when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Generic avatar providers support BYOK only. They aren't available in managed mode. Store your avatar provider's API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, GenericAvatar, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor .with_avatar( GenericAvatar( api_key=secret_ref("support_prod", "avatar"), api_base_url="", avatar_id="", agora_uid="", agora_token="", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, GenericAvatar, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */) .withAvatar( new GenericAvatar({ apiKey: secretRef('support_prod', 'avatar'), apiBaseUrl: '', avatarId: '', agoraUid: '', agoraToken: '', }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ). WithAvatar(vendors.NewGenericAvatar(vendors.GenericAvatarOptions{ APIKey: agentkit.SecretRef("support_prod", "avatar"), APIBaseURL: "", AvatarID: "", AgoraUID: "", AgoraToken: "", })) ``` **REST API** Add an `avatar` block to the `pipeline`. Set `credential.mode` to `byok` and `credential.fields.api_key` to the reference. In the following example, the key is stored as `avatar` in the `support_prod` set: ```json "avatar": { "enabled": true, "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.avatar" } }, "vendor": "generic", "params": { "api_base_url": "", "avatar_id": "", "agora_token": "", "agora_uid": "" } } ``` ## Key parameters The `avatar` block takes the following fields. In the SDKs, `GenericAvatar` sets them from its options, and passes any other parameters from its additional parameters option to `params`. **avatar required** **`enabled` (boolean) required** Set to `true` to show the avatar. **`vendor` (string) required** Set to `generic`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to the API key for your avatar provider. **`params` (object) required** **`api_base_url` (string) required** The base URL of the avatar provider's API endpoint. **`avatar_id` (string) required** The unique identifier for the avatar to use. **`agora_token` (string) optional** The RTC token that authorizes the avatar to join the video channel. Generate this token using your Agora project credentials. **`agora_uid` (string) required** The unique identifier for the avatar's RTC connection. This must be different from other participants in the channel. This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # LiveAvatar (/en/ai/platform/models/avatar/heygen) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). LiveAvatar by HeyGen provides AI-powered avatars with high-quality video rendering and customizable video quality settings, enabling professional video conversations with your AI agents. ## Sample configuration The following example shows how to configure LiveAvatar as the agent's avatar when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). LiveAvatar supports BYOK only. It isn't available in managed mode. Store your LiveAvatar API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, LiveAvatarAvatar, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts(...) # configure a TTS vendor with a 24,000 Hz sample rate .with_avatar( LiveAvatarAvatar( api_key=secret_ref("support_prod", "liveavatar"), quality="high", agora_uid="", agora_token="", avatar_id="65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, LiveAvatarAvatar, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts(/* configure a TTS vendor with a 24,000 Hz sample rate */) .withAvatar( new LiveAvatarAvatar({ apiKey: secretRef('support_prod', 'liveavatar'), quality: 'high', agoraUid: '', agoraToken: '', avatarId: '65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0', }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure a TTS vendor with a 24,000 Hz sample rate */ ). WithAvatar(vendors.NewLiveAvatarAvatar(vendors.LiveAvatarAvatarOptions{ APIKey: agentkit.SecretRef("support_prod", "liveavatar"), Quality: "high", AgoraUID: "", AgoraToken: "", AvatarID: "65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0", })) ``` **REST API** Add an `avatar` block to the `pipeline`. Set `credential.mode` to `byok` and `credential.fields.api_key` to the reference. In the following example, the key is stored as `liveavatar` in the `support_prod` set: ```json "avatar": { "enabled": true, "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.liveavatar" } }, "vendor": "liveavatar", "params": { "agora_token": "", "agora_uid": "", "quality": "high", "avatar_id": "65f9e3c9-d48b-4118-b73a-4ae2e3cbb8f0" } } ``` > **Info** > > LiveAvatar only supports audio with a sample rate of 24,000 Hz. Using a TTS model configured with a different sample rate results in an error. Make sure that your TTS configuration matches this requirement. ## Key parameters The `avatar` block takes the following fields. In the SDKs, `LiveAvatarAvatar` sets them from its options, and passes any other parameters from its additional parameters option to `params`. **avatar required** **`enabled` (boolean) required** Set to `true` to show the avatar. **`vendor` (string) required** Set to `liveavatar`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your LiveAvatar API key. Get your API key from the LiveAvatar console. **`params` (object) required** **`quality` (string) required** Possible values: `low, medium, high` The video quality for the avatar rendering. - `"high"` (720p) - `"medium"` (480p) - `"low"` (360p) Higher quality provides a better visual experience but requires more bandwidth. **`agora_uid` (string) required** The unique identifier for the avatar's RTC connection. This must be different from other participants in the channel. **`agora_token` (string) optional** The RTC token that authorizes the avatar to join the video channel. Generate this token using your Agora project credentials. **`avatar_id` (string) optional** The unique identifier for the avatar you want to use. **`disable_idle_timeout` (boolean) optional** Default value: `false` Whether to disable the idle timeout feature. **`activity_idle_timeout` (integer) optional** Default value: `120` The number of seconds of inactivity before the avatar session times out. Only applies when `disable_idle_timeout` is `false`. For advanced configuration options, refer to the [LiveAvatar official documentation](https://docs.liveavatar.com/reference/create_session_token_v1_sessions_token_post). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # LemonSlice (/en/ai/platform/models/avatar/lemonslice) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). LemonSlice provides AI-powered avatar agents that generate synchronized video and audio responses in real time, enabling natural video conversations with your AI agents. ## Sample configuration The following example shows how to configure LemonSlice as the agent's avatar when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). LemonSlice supports BYOK only. It isn't available in managed mode. Store your LemonSlice API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, LemonSlice, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor .with_avatar( LemonSlice( api_key=secret_ref("support_prod", "lemonslice"), api_base_url="https://lemonslice.com/api/liveai/agora", avatar_id="lemonslice", agora_uid="", agora_token="", additional_params={ "agent_image_url": "", "aspect_ratio": "2x3", }, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, LemonSlice, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */) .withAvatar( new LemonSlice({ apiKey: secretRef('support_prod', 'lemonslice'), apiBaseUrl: 'https://lemonslice.com/api/liveai/agora', avatarId: 'lemonslice', agoraUid: '', agoraToken: '', agentImageUrl: '', aspectRatio: '2x3', }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ). WithAvatar(vendors.NewLemonSlice(vendors.LemonSliceOptions{ APIKey: agentkit.SecretRef("support_prod", "lemonslice"), APIBaseURL: "https://lemonslice.com/api/liveai/agora", AvatarID: "lemonslice", AgoraUID: "", AgoraToken: "", AdditionalParams: map[string]interface{}{ "agent_image_url": "", "aspect_ratio": "2x3", }, })) ``` **REST API** Add an `avatar` block to the `pipeline`. LemonSlice uses the `generic` avatar vendor. Set `credential.mode` to `byok` and `credential.fields.api_key` to the reference. In the following example, the key is stored as `lemonslice` in the `support_prod` set: ```json "avatar": { "enabled": true, "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.lemonslice" } }, "vendor": "generic", "params": { "api_base_url": "https://lemonslice.com/api/liveai/agora", "avatar_id": "lemonslice", "agent_image_url": "", "agora_token": "", "agora_uid": "", "aspect_ratio": "2x3" } } ``` ## Key parameters The `avatar` block takes the following fields. In the SDKs, `LemonSlice` sets them from its options, and passes any other parameters from its additional parameters option to `params`. **avatar required** **`enabled` (boolean) required** Set to `true` to show the avatar. **`vendor` (string) required** Set to `generic`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your LemonSlice API key. Get your API key from your LemonSlice account. **`params` (object) required** **`api_base_url` (string) required** The base URL of the LemonSlice API endpoint. Set to `https://lemonslice.com/api/liveai/agora`. **`avatar_id` (string) required** Fixed value that identifies the vendor integration. Always set to `lemonslice`. **`agent_image_url` (string) optional** A publicly accessible URL to the avatar image. Provide exactly one of `agent_id`, `agent_image_url`, or `agent_image_base64`. **`agent_id` (string) optional** The ID of a LemonSlice agent to use as the avatar. Provide exactly one of `agent_id`, `agent_image_url`, or `agent_image_base64`. If you provide `agent_id`, LemonSlice also uses that agent's configured settings as defaults for `agent_prompt` and `agent_idle_prompt`. **`agent_image_base64` (string) optional** A base64-encoded avatar image. Provide exactly one of `agent_id`, `agent_image_url`, or `agent_image_base64`. **`aspect_ratio` (string) optional** The output aspect ratio for the avatar video. One of `2x3`, `9x16`, or `1x1`. Defaults to `2x3`. **`agora_token` (string) optional** The RTC token that authorizes the avatar to join the video channel. Generate this token using your Agora project credentials. **`agora_uid` (string) required** The unique identifier for the avatar's RTC connection. This must be different from other participants in the channel. For advanced configuration options, refer to the [LemonSlice Agora integration](https://lemonslice.com/docs/agora) page or the [LemonSlice API documentation](https://lemonslice.com/docs/api-reference/create-self-managed-session). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Protoface (/en/ai/platform/models/avatar/protoface) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Protoface provides real-time AI avatars that add a talking, lip-synced face to your voice agents, enabling natural video conversations with your AI agents. ## Sample configuration The following example shows how to configure Protoface as the agent's avatar when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Protoface supports BYOK only. It isn't available in managed mode. Store your Protoface API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, Protoface, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor .with_avatar( Protoface( api_key=secret_ref("support_prod", "protoface"), api_base_url="https://api.protoface.com/v1/agora", avatar_id="", agora_uid="", agora_token="", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, Protoface, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */) .withAvatar( new Protoface({ apiKey: secretRef('support_prod', 'protoface'), apiBaseUrl: 'https://api.protoface.com/v1/agora', avatarId: '', agoraUid: '', agoraToken: '', }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ). WithAvatar(vendors.NewProtoface(vendors.ProtofaceOptions{ APIKey: agentkit.SecretRef("support_prod", "protoface"), APIBaseURL: "https://api.protoface.com/v1/agora", AvatarID: "", AgoraUID: "", AgoraToken: "", })) ``` **REST API** Add an `avatar` block to the `pipeline`. Protoface uses the `generic` avatar vendor. Set `credential.mode` to `byok` and `credential.fields.api_key` to the reference. In the following example, the key is stored as `protoface` in the `support_prod` set: ```json "avatar": { "enabled": true, "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.protoface" } }, "vendor": "generic", "params": { "api_base_url": "https://api.protoface.com/v1/agora", "avatar_id": "", "agora_token": "", "agora_uid": "" } } ``` ## Key parameters The `avatar` block takes the following fields. In the SDKs, `Protoface` sets them from its options, and passes any other parameters from its additional parameters option to `params`. **avatar required** **`enabled` (boolean) required** Set to `true` to show the avatar. **`vendor` (string) required** Set to `generic`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Protoface API key. Get your API key from the [Protoface dashboard](https://app.protoface.com). **`params` (object) required** **`api_base_url` (string) required** The base URL of the Protoface API endpoint. Set to `https://api.protoface.com/v1/agora`. **`avatar_id` (string) required** The ID of the Protoface avatar to use, for example, `av_stock_001`. Find a stock avatar or create your own in the [Protoface dashboard](https://app.protoface.com). **`agora_token` (string) optional** The RTC token that authorizes the avatar to join the video channel. Generate this token using your Agora project credentials. **`agora_uid` (string) required** The unique identifier for the avatar's RTC connection. This must be different from other participants in the channel. For more information about avatars, refer to the [Protoface avatar documentation](https://docs.protoface.com/guides/avatars). For a complete working project, see the [Protoface Agora quickstart](https://github.com/protoface-ai/protoface-quickstart-agora). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Tavus (/en/ai/platform/models/avatar/tavus) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Tavus provides lifelike AI avatars that see, hear, and respond in real time, enabling natural video conversations with your AI agents. ## Sample configuration The following example shows how to configure Tavus as the agent's avatar when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Tavus supports BYOK only. It isn't available in managed mode. Store your Tavus API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, Tavus, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts(...) # configure your TTS vendor .with_avatar( Tavus( api_key=secret_ref("support_prod", "tavus"), api_base_url="https://tavusapi.com/v2/conversations/agora", avatar_id="", agora_uid="", agora_token="", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, Tavus, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts(/* configure your TTS vendor */) .withAvatar( new Tavus({ apiKey: secretRef('support_prod', 'tavus'), apiBaseUrl: 'https://tavusapi.com/v2/conversations/agora', avatarId: '', agoraUid: '', agoraToken: '', }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts( /* configure your TTS vendor */ ). WithAvatar(vendors.NewTavus(vendors.TavusOptions{ APIKey: agentkit.SecretRef("support_prod", "tavus"), APIBaseURL: "https://tavusapi.com/v2/conversations/agora", AvatarID: "", AgoraUID: "", AgoraToken: "", })) ``` **REST API** Add an `avatar` block to the `pipeline`. Tavus uses the `generic` avatar vendor. Set `credential.mode` to `byok` and `credential.fields.api_key` to the reference. In the following example, the key is stored as `tavus` in the `support_prod` set: ```json "avatar": { "enabled": true, "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.tavus" } }, "vendor": "generic", "params": { "api_base_url": "https://tavusapi.com/v2/conversations/agora", "avatar_id": "", "agora_token": "", "agora_uid": "" } } ``` ## Key parameters The `avatar` block takes the following fields. In the SDKs, `Tavus` sets them from its options, and passes any other parameters from its additional parameters option to `params`. **avatar required** **`enabled` (boolean) required** Set to `true` to show the avatar. **`vendor` (string) required** Set to `generic`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Tavus API key. Get your API key from your Tavus account. For details, refer to [Tavus authentication](https://docs.tavus.io/api-reference/authentication). **`params` (object) required** **`api_base_url` (string) required** The base URL of the Tavus API endpoint. Set to `https://tavusapi.com/v2/conversations/agora`. **`avatar_id` (string) required** The ID of the Tavus face (formerly called a replica) to render the avatar. Find or create a face in the [Tavus Developer Portal](https://maker.tavus.io/dev/faces). **`agora_token` (string) optional** The RTC token that authorizes the avatar to join the video channel. Generate this token using your Agora project credentials. **`agora_uid` (string) required** The unique identifier for the avatar's RTC connection. This must be different from other participants in the channel. For more information about Tavus faces and conversations, refer to the [Tavus documentation](https://docs.tavus.io). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Amazon Bedrock (/en/ai/platform/models/llm/amazon) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Amazon Bedrock provides access to a variety of foundation models (FMs) from leading AI providers through a fully managed AWS service. ## Sample configuration The following example shows how to configure Amazon Bedrock as the agent's LLM when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Amazon Bedrock supports BYOK only. It isn't available in managed mode. Store your Bedrock credentials in a secret set, and refer to them from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** The SDK authenticates with an AWS access key ID and secret access key instead of a Bedrock API key. Store both in a secret set, and pass a reference to each: ```python from agora_agent import Agent, AmazonBedrock, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm( AmazonBedrock( access_key=secret_ref("support_prod", "aws_access_key_id"), secret_key=secret_ref("support_prod", "aws_secret_access_key"), region="us-east-1", model="us.anthropic.claude-sonnet-4-20250514-v1:0", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** The SDK authenticates with an AWS access key ID and secret access key instead of a Bedrock API key. Store both in a secret set, and pass a reference to each: ```ts import { Agent, AmazonBedrock, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm( new AmazonBedrock({ accessKey: secretRef('support_prod', 'aws_access_key_id'), secretKey: secretRef('support_prod', 'aws_secret_access_key'), region: 'us-east-1', model: 'us.anthropic.claude-sonnet-4-20250514-v1:0', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(/* configure your TTS vendor */); ``` **Go SDK** The SDK authenticates with an AWS access key ID and secret access key instead of a Bedrock API key. Store both in a secret set, and pass a reference to each: ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm(vendors.NewAmazonBedrock(vendors.AmazonBedrockOptions{ AccessKey: agentkit.SecretRef("support_prod", "aws_access_key_id"), SecretKey: agentkit.SecretRef("support_prod", "aws_secret_access_key"), Region: "us-east-1", Model: "us.anthropic.claude-sonnet-4-20250514-v1:0", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, })). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Bedrock API key. To use an AWS access key pair instead, set `credential.fields.access_key` and `credential.fields.secret_key`. Your AWS region isn't secret. Pass it in `params`. In the following example, the key is stored as `bedrock` in the `support_prod` set: ```json "llm": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.bedrock" } }, "vendor": "amazon", "style": "bedrock", "model": "us.anthropic.claude-sonnet-4-20250514-v1:0", "url": "https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-20250514-v1:0/converse-stream", "params": { "region": "us-east-1" } } ``` Set the system prompt and the greeting with the agent's `instructions` and `greeting`, not in the `llm` block. ## Key parameters The `llm` block takes the following fields. In the SDKs, the LLM class sets them from its options. **llm** **`vendor` (string) required** Set to `amazon`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Bedrock API key, or set `fields.access_key` and `fields.secret_key` to references to an AWS access key pair. **`style` (string) required** The API style to use. Set to `bedrock` for Amazon Bedrock models. **`model` (string) required** The Bedrock model ID, for example `us.anthropic.claude-sonnet-4-20250514-v1:0`. **`url` (string) required** The Amazon Bedrock runtime endpoint for the target region and model. See [Amazon Bedrock endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/bedrock.html#bedrock_region) for the correct endpoint format. **`params` (object) required** **`region` (string) required** The AWS region hosting the Bedrock model, for example, `us-east-1` or `us-west-2`. See [Supported Regions and models](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html) for available regions. For complete `llm` block options, see [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). For advanced configuration options, model capabilities, and detailed parameter descriptions, see the [Amazon Bedrock documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html). # Azure OpenAI (/en/ai/platform/models/llm/azure-openai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Azure OpenAI service provides REST API access to OpenAI's powerful language models through Microsoft Azure's secure infrastructure. ## Sample configuration The following example shows how to configure Azure OpenAI as the agent's LLM when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Azure OpenAI supports BYOK only. It isn't available in managed mode. Store your Azure OpenAI API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, AzureOpenAI, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm( AzureOpenAI( api_key=secret_ref("support_prod", "azure_openai"), endpoint="https://your-resource-name.openai.azure.com", deployment_name="YOUR_DEPLOYMENT_NAME", api_version="AZURE_API_VERSION", model="gpt-4o-mini", max_history=32, failure_message="Please hold on a second.", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, AzureOpenAI, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm( new AzureOpenAI({ apiKey: secretRef('support_prod', 'azure_openai'), endpoint: 'https://your-resource-name.openai.azure.com', deploymentName: 'YOUR_DEPLOYMENT_NAME', apiVersion: 'AZURE_API_VERSION', model: 'gpt-4o-mini', maxHistory: 32, failureMessage: 'Please hold on a second.', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client maxHistory := 32 agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm(vendors.NewAzureOpenAI(vendors.AzureOpenAIOptions{ APIKey: agentkit.SecretRef("support_prod", "azure_openai"), Endpoint: "https://your-resource-name.openai.azure.com", DeploymentName: "YOUR_DEPLOYMENT_NAME", APIVersion: "AZURE_API_VERSION", Model: "gpt-4o-mini", MaxHistory: &maxHistory, FailureMessage: "Please hold on a second.", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, })). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to the key. In the following example, the key is stored as `azure_openai` in the `support_prod` set: ```json "llm": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.azure_openai" } }, "vendor": "azure", "style": "openai", "model": "gpt-4o-mini", "url": "https://your-resource-name.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/chat/completions?api-version=AZURE_API_VERSION", "max_history": 32, "failure_message": "Please hold on a second." } ``` Set the system prompt and the greeting with the agent's `instructions` and `greeting`, not in the `llm` block. ## Key parameters The `llm` block takes the following fields. In the SDKs, the LLM class sets them from its options. The SDK builds the endpoint URL from the resource endpoint, the deployment name, and the API version, and sets the vendor to `azure`. **llm** **`vendor` (string) required** Set to `azure`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Azure OpenAI API key. Find your API key in the Azure portal under your OpenAI resource. **`style` (string) optional** Set to `openai`. **`model` (string) required** Use the deployment name you created in Azure, not the base model name. **`url` (string) required** Replace `your-resource-name` with your Azure resource name and `YOUR_DEPLOYMENT_NAME` with your model deployment name. For complete `llm` block options, see [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). For advanced configuration options, deployment setup, and detailed parameter descriptions, see the [Azure OpenAI API documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference). # Claude Anthropic (/en/ai/platform/models/llm/claude) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Claude from Anthropic provides helpful, harmless, and honest AI assistance with strong reasoning capabilities and natural conversational abilities. ## Sample configuration The following example shows how to configure Claude as the agent's LLM when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Claude supports BYOK only. It isn't available in managed mode. Store your Anthropic API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, Anthropic, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm( Anthropic( api_key=secret_ref("support_prod", "anthropic"), vendor="anthropic", url="https://api.anthropic.com/v1/messages", headers={"anthropic-version": "2023-06-01"}, model="claude-opus-4-8", max_tokens=1024, max_history=32, failure_message="Please hold on a second.", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, Anthropic, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm( new Anthropic({ apiKey: secretRef('support_prod', 'anthropic'), vendor: 'anthropic', url: 'https://api.anthropic.com/v1/messages', headers: { 'anthropic-version': '2023-06-01' }, model: 'claude-opus-4-8', maxTokens: 1024, maxHistory: 32, failureMessage: 'Please hold on a second.', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client maxTokens, maxHistory := 1024, 32 agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm(vendors.NewAnthropic(vendors.AnthropicOptions{ APIKey: agentkit.SecretRef("support_prod", "anthropic"), Vendor: "anthropic", URL: "https://api.anthropic.com/v1/messages", Headers: map[string]string{"anthropic-version": "2023-06-01"}, Model: "claude-opus-4-8", MaxTokens: &maxTokens, MaxHistory: &maxHistory, FailureMessage: "Please hold on a second.", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, })). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to the key. In the following example, the key is stored as `anthropic` in the `support_prod` set: ```json "llm": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.anthropic" } }, "vendor": "anthropic", "style": "anthropic", "model": "claude-opus-4-8", "url": "https://api.anthropic.com/v1/messages", "headers": { "anthropic-version": "2023-06-01" }, "max_history": 32, "failure_message": "Please hold on a second.", "params": { "max_tokens": 1024 } } ``` Set the system prompt and the greeting with the agent's `instructions` and `greeting`, not in the `llm` block. ## Key parameters The `llm` block takes the following fields. In the SDKs, the LLM class sets them from its options. Use the `Anthropic` class. The SDK sets the style to `anthropic` and sends `max_tokens` in `params`. **llm** **`vendor` (string) required** Set to `anthropic`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Anthropic API key. Get your API key from the [Anthropic Console](https://console.anthropic.com/). **`style` (string) required** Set to `anthropic` to use Claude's message format. **`model` (string) required** Refer to [Claude models](https://docs.anthropic.com/en/docs/about-claude/models) for available models. **`url` (string) required** Use Anthropic's messages endpoint. **`headers` (object) required** Must include the `anthropic-version` header for API compatibility. **`params` (object) required** **`max_tokens` (integer) required** The maximum number of tokens to generate in the response. For complete `llm` block options, see [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). For Claude-specific options and model capabilities, see the [Claude API documentation](https://docs.anthropic.com/en/api/messages). # Dify (/en/ai/platform/models/llm/dify) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Dify is an open-source LLM application development platform that provides a unified API for multiple LLM providers with workflow orchestration and advanced features. ## Set up Dify To integrate Dify with Agora Conversational AI, install the plugin, configure your Agora project, and create an endpoint: 1. **Install the Dify plugin** 1. Log in to the [Dify Console](https://cloud.dify.ai). 2. Click on **Plugins** in the top navigation bar to open the Marketplace. 3. Search for the **Agora Conversational AI** plugin. 4. Click **Install** to install the plugin. 5. After installation, confirm that the plugin status is **Active** in the Installed Plugins list. 2. **Configure the Agora Console** 1. Log in to the [Agora Console](https://console.agora.io). 2. Create a new project or select an existing one. 3. Enable the **Conversational AI** feature within the selected project. 4. Record the following information for later use: - **App ID** (unique project identifier) - **Certificate** (optional, if enabled for enhanced security) 5. Navigate to the **RESTful API** page and generate a **Customer ID** and **Customer Secret** (required for HTTP Basic Authentication). 3. **Create an Endpoint in Dify** 1. In the Dify console's left-hand navigation panel, click on the **Agora Conversational AI** plugin you just installed. 2. Click **Create a new API endpoint** to open the configuration page. 3. Fill in the following details: - **App ID** (copied from the Agora Console) - **Customer ID and Customer Secret** (copied from the Agora Console) - **TTS** (Text-to-Speech) configuration (e.g., Azure or ElevenLabs) 4. **Save and note the endpoint details** 1. Save the endpoint configuration. Dify generates an **Endpoint URL**. 2. Note down this **Dify Endpoint URL** and **Dify endpoint API key** for use in the `llm` configuration. ![](https://assets-docs.agora.io/images/conversational-ai/dify-endpoint.png) ## Sample configuration The following example shows how to configure Dify as the agent's LLM when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Dify supports BYOK only. It isn't available in managed mode. Store your Dify endpoint API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, Dify, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm( Dify( api_key=secret_ref("support_prod", "dify"), vendor="dify", url="https://xxxxxx.ai-plugin.io/convoai/dify-completion", model="default", max_history=32, failure_message="Hold on a moment.", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, Dify, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm( new Dify({ apiKey: secretRef('support_prod', 'dify'), vendor: 'dify', url: 'https://xxxxxx.ai-plugin.io/convoai/dify-completion', model: 'default', maxHistory: 32, failureMessage: 'Hold on a moment.', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client maxHistory := 32 agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm(vendors.NewDify(vendors.DifyOptions{ APIKey: agentkit.SecretRef("support_prod", "dify"), Vendor: "dify", URL: "https://xxxxxx.ai-plugin.io/convoai/dify-completion", Model: "default", MaxHistory: &maxHistory, FailureMessage: "Hold on a moment.", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, })). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to the key. In the following example, the key is stored as `dify` in the `support_prod` set: ```json "llm": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.dify" } }, "vendor": "dify", "style": "dify", "model": "default", "url": "https://xxxxxx.ai-plugin.io/convoai/dify-completion", "max_history": 32, "failure_message": "Hold on a moment." } ``` Set the system prompt and the greeting with the agent's `instructions` and `greeting`, not in the `llm` block. ## Key parameters The `llm` block takes the following fields. In the SDKs, the LLM class sets them from its options. Use the `Dify` class. The SDK sets the style to `dify`. **llm** **`vendor` (string) required** Set to `dify`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to the same API key configured in your Dify endpoint setup. **`style` (string) required** Set to `dify` to use Dify's message format and workflow processing. **`model` (string) required** Set to `default` to use the model configured in your Dify application. **`url` (string) required** Use the custom endpoint URL from your Dify marketplace integration. For complete `llm` block options, see [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). For advanced configuration options, workflow setup, and detailed parameter descriptions, see the [Agora Conversational AI - Dify Marketplace](https://marketplace.dify.ai/plugins/plutoless/convoai) documentation. # Google Gemini (/en/ai/platform/models/llm/gemini) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Google Gemini provides advanced multimodal AI capabilities with fast performance and efficient processing for conversational AI applications. ## Sample configuration Google Gemini supports BYOK only. It isn't available in managed mode. The following example starts an [ephemeral session](/en/ai/platform/get-started/start-stop-agent#test-a-configuration-without-saving-an-agent) with Gemini as the LLM. In an ephemeral session, you pass the agent configuration in the request, with your Gemini API key in the endpoint URL, and the Platform doesn't save them. Get your API key from [Google AI Studio](https://aistudio.google.com/app/apikey). **Python SDK** Pass your key as `api_key`, and leave it out of `url`. Call `create_session()` on an `Agent`. The SDK starts an ephemeral session when you set a Platform session option, such as `max_duration` in seconds. ```python from agora_agent import Agent, DeepgramSTT, Gemini, OpenAITTS test_agent = ( Agent(client=client) .with_stt(DeepgramSTT(model="nova-3", language="en-US")) .with_llm( Gemini( api_key="", model="gemini-3.6-flash", url="https://generativelanguage.googleapis.com/v1beta/models/gemini-3.6-flash:streamGenerateContent?alt=sse", max_history=32, failure_message="Hold on a second.", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(OpenAITTS(model="tts-1", voice="alloy")) ) session = test_agent.create_session( channel="", token="", agent_uid="1002", remote_uids=["1001"], max_duration=600, ) session_id = session.start() ``` **TypeScript SDK** Pass your key as `apiKey`, and leave it out of `url`. Call `createSession()` on an `Agent`. The SDK starts an ephemeral session when you set a Platform session option, such as `maxDuration` in seconds. ```ts import { Agent, DeepgramSTT, Gemini, OpenAITTS } from 'agora-agents'; const testAgent = new Agent({ client }) .withStt(new DeepgramSTT({ model: 'nova-3', language: 'en-US' })) .withLlm( new Gemini({ apiKey: '', model: 'gemini-3.6-flash', url: 'https://generativelanguage.googleapis.com/v1beta/models/gemini-3.6-flash:streamGenerateContent?alt=sse', maxHistory: 32, failureMessage: 'Hold on a second.', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(new OpenAITTS({ model: 'tts-1', voice: 'alloy' })); const session = testAgent.createSession({ channel: '', token: '', agentUid: '1002', remoteUids: ['1001'], maxDuration: 600, }); const sessionId = await session.start(); ``` **Go SDK** Pass your key as `APIKey`, and leave it out of `URL`. Call `CreateSession()` on an `Agent`. The SDK starts an ephemeral session when you set a Platform session option, such as `MaxDuration` in seconds. ```go maxHistory := 32 testAgent := agentkit.NewAgent(client). WithStt(vendors.NewDeepgramSTT(vendors.DeepgramSTTOptions{Model: "nova-3", Language: "en-US"})). WithLlm(vendors.NewGemini(vendors.GeminiOptions{ APIKey: "", Model: "gemini-3.6-flash", URL: "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.6-flash:streamGenerateContent?alt=sse", MaxHistory: &maxHistory, FailureMessage: "Hold on a second.", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, })). WithTts(vendors.NewOpenAITTS(vendors.OpenAITTSOptions{Model: "tts-1", Voice: "alloy"})) maxDuration := 600 session := testAgent.CreateSession(agentkit.CreateSessionOptions{ Channel: "", Token: "", AgentUID: "1002", RemoteUIDs: []string{"1001"}, MaxDuration: &maxDuration, }) sessionID, err := session.Start(ctx) if err != nil { log.Fatal(err) } ``` **REST API** Send a request to [Start an ephemeral session](/en/api-reference/api-ref/conversational-ai/platform/start-ephemeral-session). In the `llm` block, set `url` to the Gemini `streamGenerateContent` endpoint for your model, with `alt=sse` and your API key in the `key` query parameter. Set `credential.mode` to `byok`, and leave out `credential.fields`. ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//sessions/ephemeral \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "agent": { "instructions": "You are a friendly support agent for Acme. Keep your answers short.", "pipeline": { "mode": "cascaded", "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US" }, "llm": { "credential": { "mode": "byok" }, "vendor": "gemini", "style": "gemini", "model": "gemini-3.6-flash", "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.6-flash:streamGenerateContent?alt=sse&key=", "max_history": 32, "failure_message": "Hold on a second." }, "tts": { "credential": { "mode": "managed" }, "vendor": "minimax", "params": { "model": "speech-2.6-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1 } } } } }, "transport": { "type": "rtc", "channel": "", "token": "", "uid": "1002", "subscribe_uids": ["1001"] } }' ``` A saved agent can't have a key in its `url`. The response has the same format as Start a session. Set the system prompt and the greeting with the agent's `instructions` and `greeting`, not in the `llm` block. ## Key parameters The `llm` block takes the following fields. **llm** **`vendor` (string) required** Set to `gemini`. **`credential` (object) required** Set `mode` to `byok`. **`style` (string) required** Set to `gemini` to use Gemini's message format. **`model` (string) required** Refer to [Gemini models](https://ai.google.dev/gemini-api/docs/models/gemini) for available models. **`url` (string) required** The Gemini `streamGenerateContent` endpoint for your model, with `alt=sse` and `key=`. Get your API key from [Google AI Studio](https://aistudio.google.com/app/apikey). **`params` (object) optional** **`ignore_empty` (boolean) optional** Set to `true` to handle empty responses appropriately. For complete `llm` block options, see [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). For advanced configuration options, model capabilities, and detailed parameter descriptions, see the [Google Gemini API documentation](https://ai.google.dev/api/generate-content#method:-models.streamgeneratecontent). # Google Vertex AI (/en/ai/platform/models/llm/google-vertex-ai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Google Vertex AI provides enterprise-grade access to Google's generative AI models with enhanced security, scaling capabilities, and integration with Google Cloud services. ## Sample configuration Google Vertex AI supports BYOK only. It isn't available in managed mode. The following example starts an [ephemeral session](/en/ai/platform/get-started/start-stop-agent#test-a-configuration-without-saving-an-agent) with Vertex AI as the LLM. In an ephemeral session, you pass the agent configuration and your credential in the request, and the Platform doesn't save them. Agora sends the credential to Vertex AI as an OAuth 2.0 access token, in an `Authorization: Bearer` header. Get a token for your Google Cloud project, for example with `gcloud auth print-access-token`. For details, see [REST authentication](https://cloud.google.com/docs/authentication/rest). **Python SDK** Call `create_session()` on an `Agent`. The SDK starts an ephemeral session when you set a Platform session option, such as `max_duration` in seconds. ```python from agora_agent import Agent, DeepgramSTT, OpenAITTS, VertexAILLM test_agent = ( Agent(client=client) .with_stt(DeepgramSTT(model="nova-3", language="en-US")) .with_llm( VertexAILLM( api_key="", vendor="vertexai", project_id="", location="global", model="gemini-3.8-flash", url="https://aiplatform.googleapis.com/v1/projects//locations/global/publishers/google/models/gemini-3.8-flash:streamGenerateContent?alt=sse", max_history=32, failure_message="Hold on a second.", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(OpenAITTS(model="tts-1", voice="alloy")) ) session = test_agent.create_session( channel="", token="", agent_uid="1002", remote_uids=["1001"], max_duration=600, ) session_id = session.start() ``` **TypeScript SDK** Call `createSession()` on an `Agent`. The SDK starts an ephemeral session when you set a Platform session option, such as `maxDuration` in seconds. ```ts import { Agent, DeepgramSTT, OpenAITTS, VertexAILLM } from 'agora-agents'; const testAgent = new Agent({ client }) .withStt(new DeepgramSTT({ model: 'nova-3', language: 'en-US' })) .withLlm( new VertexAILLM({ apiKey: '', vendor: 'vertexai', projectId: '', location: 'global', model: 'gemini-3.8-flash', url: 'https://aiplatform.googleapis.com/v1/projects//locations/global/publishers/google/models/gemini-3.8-flash:streamGenerateContent?alt=sse', maxHistory: 32, failureMessage: 'Hold on a second.', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(new OpenAITTS({ model: 'tts-1', voice: 'alloy' })); const session = testAgent.createSession({ channel: '', token: '', agentUid: '1002', remoteUids: ['1001'], maxDuration: 600, }); const sessionId = await session.start(); ``` **Go SDK** Call `CreateSession()` on an `Agent`. The SDK starts an ephemeral session when you set a Platform session option, such as `MaxDuration` in seconds. ```go maxHistory := 32 testAgent := agentkit.NewAgent(client). WithStt(vendors.NewDeepgramSTT(vendors.DeepgramSTTOptions{Model: "nova-3", Language: "en-US"})). WithLlm(vendors.NewVertexAILLM(vendors.VertexAILLMOptions{ GeminiOptions: vendors.GeminiOptions{ APIKey: "", Vendor: "vertexai", Model: "gemini-3.8-flash", URL: "https://aiplatform.googleapis.com/v1/projects//locations/global/publishers/google/models/gemini-3.8-flash:streamGenerateContent?alt=sse", MaxHistory: &maxHistory, FailureMessage: "Hold on a second.", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, }, ProjectID: "", Location: "global", })). WithTts(vendors.NewOpenAITTS(vendors.OpenAITTSOptions{Model: "tts-1", Voice: "alloy"})) maxDuration := 600 session := testAgent.CreateSession(agentkit.CreateSessionOptions{ Channel: "", Token: "", AgentUID: "1002", RemoteUIDs: []string{"1001"}, MaxDuration: &maxDuration, }) sessionID, err := session.Start(ctx) if err != nil { log.Fatal(err) } ``` **REST API** Send a request to [Start an ephemeral session](/en/api-reference/api-ref/conversational-ai/platform/start-ephemeral-session). In the `llm` block, set `credential.mode` to `byok` and `credential.fields.api_key` to the access token. Your project ID and location aren't secret. Pass them in the `url`, replacing ``. The following example uses the global endpoint: ```bash curl --request POST \ --url https://preview.ai.agora.io/conversational-ai/v1/projects//sessions/ephemeral \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data ' { "agent": { "instructions": "You are a friendly support agent for Acme. Keep your answers short.", "pipeline": { "mode": "cascaded", "asr": { "credential": { "mode": "managed" }, "vendor": "deepgram", "model": "nova-3", "language": "en-US" }, "llm": { "credential": { "mode": "byok", "fields": { "api_key": "" } }, "vendor": "vertexai", "style": "gemini", "model": "gemini-3.8-flash", "url": "https://aiplatform.googleapis.com/v1/projects//locations/global/publishers/google/models/gemini-3.8-flash:streamGenerateContent?alt=sse", "max_history": 32, "failure_message": "Hold on a second." }, "tts": { "credential": { "mode": "managed" }, "vendor": "minimax", "params": { "model": "speech-2.6-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1 } } } } }, "transport": { "type": "rtc", "channel": "", "token": "", "uid": "1002", "subscribe_uids": ["1001"] } }' ``` The response has the same format as Start a session. Set the system prompt and the greeting with the agent's `instructions` and `greeting`, not in the `llm` block. ## Key parameters The `llm` block takes the following fields. In the SDKs, the LLM class sets them from its options. Use the `VertexAILLM` class. The SDK builds the endpoint URL from the project ID, the location, and the model. **llm** **`vendor` (string) required** Set to `vertexai`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to an OAuth 2.0 access token for your Google Cloud project. Don't put the token in the `url`. **`style` (string) required** Set to `gemini` to use Gemini's message format. **`model` (string) required** Refer to [Vertex AI models](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models) for available models. **`url` (string) required** The Vertex AI `streamGenerateContent` endpoint, with your Google Cloud project ID, location, and model in the path. Use one of these hosts, with the matching location in the path: - Global: `aiplatform.googleapis.com` with `locations/global`. - US multi-region: `aiplatform.us.rep.googleapis.com` with `locations/us`. - EU multi-region: `aiplatform.eu.rep.googleapis.com` with `locations/eu`. - A region: `-aiplatform.googleapis.com` with `locations/`, for example `us-central1`. Some models aren't offered in every location. If a request returns `404`, use the global endpoint. Include `alt=sse` in the URL. For details, see [Vertex AI locations](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations). For complete `llm` block options, see [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). For advanced configuration options, model capabilities, and detailed parameter descriptions, see the [Google Vertex AI API documentation](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/system-instructions). # Groq (/en/ai/platform/models/llm/groq) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Groq provides state-of-the-art language models optimized for different use cases. ## Sample configuration The following example shows how to configure Groq as the agent's LLM when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Groq supports BYOK only. It isn't available in managed mode. Store your Groq API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, Groq, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm( Groq( api_key=secret_ref("support_prod", "groq"), vendor="groq", base_url="https://api.groq.com/openai/v1/chat/completions", model="llama-3.3-70b-versatile", max_history=32, failure_message="Please hold on a second.", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, Groq, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm( new Groq({ apiKey: secretRef('support_prod', 'groq'), vendor: 'groq', url: 'https://api.groq.com/openai/v1/chat/completions', model: 'llama-3.3-70b-versatile', maxHistory: 32, failureMessage: 'Please hold on a second.', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client maxHistory := 32 agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm(vendors.NewGroq(vendors.GroqOptions{ APIKey: agentkit.SecretRef("support_prod", "groq"), Vendor: "groq", BaseURL: "https://api.groq.com/openai/v1/chat/completions", Model: "llama-3.3-70b-versatile", MaxHistory: &maxHistory, FailureMessage: "Please hold on a second.", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, })). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to the key. In the following example, the key is stored as `groq` in the `support_prod` set: ```json "llm": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.groq" } }, "vendor": "groq", "style": "openai", "model": "llama-3.3-70b-versatile", "url": "https://api.groq.com/openai/v1/chat/completions", "max_history": 32, "failure_message": "Please hold on a second." } ``` Set the system prompt and the greeting with the agent's `instructions` and `greeting`, not in the `llm` block. ## Key parameters The `llm` block takes the following fields. In the SDKs, the LLM class sets them from its options. Use the `Groq` class. The SDK sets the style to `openai`. **llm** **`vendor` (string) required** Set to `groq`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Groq API key. Create and manage your API key from [Groq console](https://console.groq.com/keys). **`style` (string) optional** Set to `openai`. Groq uses an OpenAI-compatible API. **`model` (string) required** Refer to [Groq models](https://console.groq.com/docs/models) for available models. **`url` (string) required** Use the completions endpoint. For complete `llm` block options, see [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). For advanced configuration options, model capabilities, and detailed parameter descriptions, see the [Groq API Documentation](https://console.groq.com/docs/api-reference). # OpenAI (/en/ai/platform/models/llm/openai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). OpenAI provides frontier models ranging from lightweight to high-capability. ## Sample configuration The following example shows how to configure OpenAI as the agent's LLM when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). OpenAI supports managed mode and BYOK. In managed mode, Agora provides access to OpenAI, and you don't need an OpenAI account. For BYOK, store your OpenAI API key in a secret set, and refer to it from the agent. For details, see [Use managed mode](/en/ai/platform/build/managed-mode) and [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, OpenAI, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm( OpenAI( api_key=secret_ref("support_prod", "openai"), # omit to use managed mode base_url="https://api.openai.com/v1/chat/completions", # omit to use managed mode model="gpt-4.1-mini", max_history=32, failure_message="Please hold on a second.", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, OpenAI, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm( new OpenAI({ apiKey: secretRef('support_prod', 'openai'), // omit to use managed mode url: 'https://api.openai.com/v1/chat/completions', // omit to use managed mode model: 'gpt-4.1-mini', maxHistory: 32, failureMessage: 'Please hold on a second.', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client maxHistory := 32 agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm(vendors.NewOpenAI(vendors.OpenAIOptions{ APIKey: agentkit.SecretRef("support_prod", "openai"), // omit to use managed mode BaseURL: "https://api.openai.com/v1/chat/completions", // omit to use managed mode Model: "gpt-4.1-mini", MaxHistory: &maxHistory, FailureMessage: "Please hold on a second.", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, })). WithTts( /* configure your TTS vendor */ ) ``` **REST API** - **Managed mode** Set `credential.mode` to `managed` in the `llm` block. Agora provides access to OpenAI, and you don't need an OpenAI account. ```json "llm": { "credential": { "mode": "managed" }, "vendor": "openai", "style": "openai", "model": "gpt-4.1-mini", "max_history": 32, "failure_message": "Please hold on a second." } ``` - **BYOK** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your OpenAI API key in a secret set. In the following example, the key is stored as `openai` in the `support_prod` set: ```json "llm": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.openai" } }, "vendor": "openai", "style": "openai", "model": "gpt-4o-mini", "url": "https://api.openai.com/v1/chat/completions", "max_history": 32, "failure_message": "Please hold on a second." } ``` Set the system prompt and the greeting with the agent's `instructions` and `greeting`, not in the `llm` block. ## Key parameters The `llm` block takes the following fields. In the SDKs, the LLM class sets them from its options. In managed mode, omit the API key, the endpoint URL, and the vendor. Managed mode supports the models listed for `model` in [Key parameters](#key-parameters). **llm** **`vendor` (string) required** Set to `openai`. **`credential` (object) required** How the agent authenticates with OpenAI. Set `mode` to `managed`, or to `byok` with `fields.api_key` set to a `$secrets..` reference to your OpenAI API key. Create or manage your API key from [OpenAI organization settings](https://platform.openai.com/settings/organization/api-keys). **`style` (string) optional** Set to `openai`. **`model` (string) required** Refer to [OpenAI models](https://platform.openai.com/docs/models) for available models. For managed mode, use `gpt-4o-mini`, `gpt-4.1-mini`, `gpt-5-nano`, `gpt-5-mini`, or `gpt-5.6-luna`. **`url` (string) optional** The chat completions endpoint. Not needed in managed mode. For complete `llm` block options, see [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). For OpenAI-specific options and model capabilities, see the [OpenAI API documentation](https://platform.openai.com/docs/api-reference/chat). # xAI Grok (/en/ai/platform/models/llm/xai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). xAI provides access to Grok large language models through an OpenAI-compatible chat completions API for conversational AI applications. ## Sample configuration The following example shows how to configure xAI Grok as the agent's LLM when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). xAI Grok supports BYOK only. It isn't available in managed mode. Store your xAI API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, OpenAI, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm( OpenAI( api_key=secret_ref("support_prod", "xai"), vendor="xai", base_url="https://api.x.ai/v1/chat/completions", model="grok-4.3", max_history=32, failure_message="Please hold on a second.", system_messages=[ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."} ], ) ) .with_tts(...) # configure your TTS vendor ) ``` **TypeScript SDK** ```ts import { Agent, OpenAI, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm( new OpenAI({ apiKey: secretRef('support_prod', 'xai'), vendor: 'xai', url: 'https://api.x.ai/v1/chat/completions', model: 'grok-4.3', maxHistory: 32, failureMessage: 'Please hold on a second.', systemMessages: [ { role: 'system', content: 'You are a friendly support agent for Acme. Keep your answers short.' }, ], }), ) .withTts(/* configure your TTS vendor */); ``` **Go SDK** ```go // client is your configured Agora client maxHistory := 32 agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm(vendors.NewXaiLLM(vendors.XaiLLMOptions{ APIKey: agentkit.SecretRef("support_prod", "xai"), BaseURL: "https://api.x.ai/v1/chat/completions", Model: "grok-4.3", MaxHistory: &maxHistory, FailureMessage: "Please hold on a second.", SystemMessages: []map[string]interface{}{ {"role": "system", "content": "You are a friendly support agent for Acme. Keep your answers short."}, }, })). WithTts( /* configure your TTS vendor */ ) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to the key. In the following example, the key is stored as `xai` in the `support_prod` set: ```json "llm": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.xai" } }, "vendor": "xai", "model": "grok-4.3", "url": "https://api.x.ai/v1/chat/completions", "max_history": 32, "failure_message": "Please hold on a second." } ``` Set the system prompt and the greeting with the agent's `instructions` and `greeting`, not in the `llm` block. ## Key parameters The `llm` block takes the following fields. In the SDKs, the LLM class sets them from its options. In Python and TypeScript, use the OpenAI-compatible `OpenAI` class with the vendor set to `xai`. In Go, use `NewXaiLLM`, which sets the vendor for you. **llm** **`vendor` (string) required** Set to `xai`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your xAI API key. **`model` (string) required** The Grok model to use. For example, `grok-4.3`. For available models, refer to the [xAI models documentation](https://docs.x.ai/developers/models). **`url` (string) required** The xAI chat completions endpoint. Set to `https://api.x.ai/v1/chat/completions`. For complete `llm` block options, see [Create an agent](/en/api-reference/api-ref/conversational-ai/platform/create-agent). For more information, refer to the [xAI Chat Completions documentation](https://docs.x.ai/developers/model-capabilities/legacy/chat-completions). # Amazon Polly (/en/ai/platform/models/tts/amazon) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Amazon provides natural-sounding text-to-speech with customizable voice instructions and multiple voice options. ## Sample configuration The following example shows how to configure Amazon Polly as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Amazon Polly supports BYOK only. It isn't available in managed mode. Store your AWS credentials in a secret set, and refer to them from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** Store both the access key ID and the secret access key in the secret set, and pass a reference to each. In the following example, they're stored as `amazon_access_key_id` and `amazon` in the `support_prod` set: ```python from agora_agent import Agent, AmazonTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( AmazonTTS( access_key=secret_ref("support_prod", "amazon_access_key_id"), secret_key=secret_ref("support_prod", "amazon"), region="", voice_id="Joanna", engine="neural", ) ) ) ``` **TypeScript SDK** Store both the access key ID and the secret access key in the secret set, and pass a reference to each. In the following example, they're stored as `amazon_access_key_id` and `amazon` in the `support_prod` set: ```ts import { Agent, AmazonTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new AmazonTTS({ accessKey: secretRef('support_prod', 'amazon_access_key_id'), secretKey: secretRef('support_prod', 'amazon'), region: '', voiceId: 'Joanna', engine: 'neural', }), ); ``` **Go SDK** Store both the access key ID and the secret access key in the secret set, and pass a reference to each. In the following example, they're stored as `amazon_access_key_id` and `amazon` in the `support_prod` set: ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewAmazonTTS(vendors.AmazonTTSOptions{ AccessKey: agentkit.SecretRef("support_prod", "amazon_access_key_id"), SecretKey: agentkit.SecretRef("support_prod", "amazon"), Region: "", VoiceID: "Joanna", Engine: "neural", })) ``` **REST API** Set `credential.mode` to `byok`, and set `credential.fields.aws_access_key_id` and `credential.fields.aws_secret_access_key` to references to your AWS access key ID and secret access key. Your AWS region isn't secret. Pass it in `params`. In the following example, the keys are stored as `amazon_access_key_id` and `amazon` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "aws_access_key_id": "$secrets.support_prod.amazon_access_key_id", "aws_secret_access_key": "$secrets.support_prod.amazon" } }, "vendor": "amazon", "params": { "region_name": "", "voice": "Joanna", "engine": "neural" } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, `AmazonTTS` sets them from its options. **tts** **`vendor` (string) required** Set to `amazon`. **`credential` (object) required** Set `mode` to `byok`, and set `fields.aws_access_key_id` and `fields.aws_secret_access_key` to `$secrets..` references to your AWS access key ID and secret access key. Get both from the [AWS IAM Console](https://console.aws.amazon.com/iam/). **`params` (object) required** **`region_name` (string) required** The AWS region where the Polly service is hosted, for example, `us-east-1`, `us-west-2`, or `eu-west-1`. See [AWS regions](https://docs.aws.amazon.com/general/latest/gr/pol.html) for available regions. **`voice` (string) required** The voice ID to use for speech synthesis, for example, `Joanna`, `Matthew`, or `Ivy`. See [available voices](https://docs.aws.amazon.com/polly/latest/dg/voicelist.html) for supported voice IDs. **`engine` (string) required** The engine type to use for speech synthesis. Supported values: `standard`, `neural`, `long-form`, `generative`. See [engine documentation](https://docs.aws.amazon.com/polly/latest/dg/voicelist.html) for details on each engine type. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Amazon Polly without validation. For a full list of supported options, refer to the [Amazon Polly documentation](https://docs.aws.amazon.com/polly/latest/dg/what-is.html). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Cartesia (/en/ai/platform/models/tts/cartesia) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Cartesia provides ultra-fast, low-latency text-to-speech with real-time streaming capabilities, optimized for interactive conversational AI applications. ## Sample configuration The following example shows how to configure Cartesia as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Cartesia supports BYOK only. It isn't available in managed mode. Store your Cartesia API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, CartesiaTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( CartesiaTTS( api_key=secret_ref("support_prod", "cartesia"), base_url="wss://api.cartesia.ai", model_id="sonic-2", voice_id="", sample_rate=16000, language="en", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, CartesiaTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new CartesiaTTS({ apiKey: secretRef('support_prod', 'cartesia'), baseUrl: 'wss://api.cartesia.ai', modelId: 'sonic-2', voiceId: '', sampleRate: 16000, language: 'en', }), ); ``` **Go SDK** ```go // client is your configured Agora client sampleRate := vendors.SampleRate16kHz agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewCartesiaTTS(vendors.CartesiaTTSOptions{ APIKey: agentkit.SecretRef("support_prod", "cartesia"), BaseURL: "wss://api.cartesia.ai", ModelID: "sonic-2", VoiceID: "", SampleRate: &sampleRate, Language: "en", })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Cartesia API key. In the following example, the key is stored as `cartesia` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.cartesia" } }, "vendor": "cartesia", "url": "wss://api.cartesia.ai", "params": { "model_id": "sonic-2", "voice": { "mode": "id", "id": "" }, "output_format": { "container": "raw", "sample_rate": 16000 }, "language": "en" } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, `CartesiaTTS` sets them from its options. **tts** **`vendor` (string) required** Set to `cartesia`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Cartesia API key. Get your API key from the [Cartesia Console](https://play.cartesia.ai/sign-up). **`url` (string) optional** The WebSocket URL for the Cartesia streaming API. For example, `wss://api.cartesia.ai`. **`params` (object) required** **`model_id` (string) required** The identifier of the TTS model to use. For example, `sonic-2`. **`voice` (object) required** Voice configuration object. **`mode` (string) required** Voice selection mode. Use `id` to select by voice identifier. **`id` (string) required** The identifier of the selected voice for speech synthesis. **`output_format` (object) optional** Audio output format configuration **`container` (string) optional** Audio container format for the output stream. **`sample_rate` (number) optional** Default value: `16000` Possible values: `8000, 16000, 22050, 24000, 44100, 48000` Audio sampling rate in Hz **`language` (string) optional** Target language for speech synthesis. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Cartesia without validation. For a full list of supported options, refer to the [Cartesia TTS documentation](https://docs.cartesia.ai/). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Deepgram (/en/ai/platform/models/tts/deepgram) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Deepgram provides low-latency text-to-speech with a wide range of voices, optimized for real-time conversational AI applications. ## Sample configuration The following example shows how to configure Deepgram as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Deepgram supports BYOK only. It isn't available in managed mode. Store your Deepgram API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, DeepgramTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( DeepgramTTS( api_key=secret_ref("support_prod", "deepgram"), base_url="wss://api.deepgram.com/v1/speak", model="aura-2-thalia-en", sample_rate=24000, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, DeepgramTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new DeepgramTTS({ apiKey: secretRef('support_prod', 'deepgram'), baseUrl: 'wss://api.deepgram.com/v1/speak', model: 'aura-2-thalia-en', sampleRate: 24000, }), ); ``` **Go SDK** ```go // client is your configured Agora client sampleRate := vendors.SampleRate24kHz agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewDeepgramTTS(vendors.DeepgramTTSOptions{ APIKey: agentkit.SecretRef("support_prod", "deepgram"), BaseURL: "wss://api.deepgram.com/v1/speak", Model: "aura-2-thalia-en", SampleRate: &sampleRate, })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Deepgram API key. In the following example, the key is stored as `deepgram` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.deepgram" } }, "vendor": "deepgram", "url": "wss://api.deepgram.com/v1/speak", "params": { "model": "aura-2-thalia-en", "sample_rate": 24000 } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, `DeepgramTTS` sets them from its options. **tts** **`vendor` (string) required** Set to `deepgram`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Deepgram API key. Get your API key from the [Deepgram Console](https://console.deepgram.com/). **`url` (string) optional** The WebSocket URL for the Deepgram streaming API. Defaults to `wss://api.deepgram.com/v1/speak`. **`params` (object) required** **`model` (string) required** The identifier of the TTS model to use. See [Deepgram voices and languages](https://developers.deepgram.com/docs/tts-models). **`sample_rate` (number) optional** The audio sampling rate in Hz. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Deepgram without validation. For a full list of supported options, refer to the [Deepgram TTS documentation](https://developers.deepgram.com/docs/text-to-speech). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # ElevenLabs (/en/ai/platform/models/tts/elevenlabs) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). ElevenLabs provides highly realistic AI voices with advanced prosody and natural speech patterns, delivering lifelike audio synthesis with emotional nuance and conversational flow. > **Caution: Paid plan required** > > You need a **paid ElevenLabs plan** for reliable TTS integration. > > ElevenLabs may restrict or disable free-tier accounts due to abuse-detection mechanisms, even if free credits are available. To avoid missing audio responses during testing and production, ensure you use a paid plan. ## Sample configuration The following example shows how to configure ElevenLabs as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). ElevenLabs supports BYOK only. It isn't available in managed mode. Store your ElevenLabs API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, ElevenLabsTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( ElevenLabsTTS( key=secret_ref("support_prod", "elevenlabs"), base_url="wss://api.elevenlabs.io/v1", model_id="eleven_flash_v2_5", voice_id="pNInz6obpgDQGcFmaJgB", sample_rate=24000, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, ElevenLabsTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new ElevenLabsTTS({ key: secretRef('support_prod', 'elevenlabs'), baseUrl: 'wss://api.elevenlabs.io/v1', modelId: 'eleven_flash_v2_5', voiceId: 'pNInz6obpgDQGcFmaJgB', sampleRate: 24000, }), ); ``` **Go SDK** ```go // client is your configured Agora client sampleRate := vendors.SampleRate24kHz agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewElevenLabsTTS(vendors.ElevenLabsTTSOptions{ Key: agentkit.SecretRef("support_prod", "elevenlabs"), BaseURL: "wss://api.elevenlabs.io/v1", ModelID: "eleven_flash_v2_5", VoiceID: "pNInz6obpgDQGcFmaJgB", SampleRate: &sampleRate, })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.key` to a reference to your ElevenLabs API key. In the following example, the key is stored as `elevenlabs` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "key": "$secrets.support_prod.elevenlabs" } }, "vendor": "elevenlabs", "url": "wss://api.elevenlabs.io/v1", "params": { "model_id": "eleven_flash_v2_5", "voice_id": "pNInz6obpgDQGcFmaJgB", "sample_rate": 24000 } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, `ElevenLabsTTS` sets them from its options. **tts** **`vendor` (string) required** Set to `elevenlabs`. **`credential` (object) required** Set `mode` to `byok` and `fields.key` to a `$secrets..` reference to your ElevenLabs API key. Get your API key from the [ElevenLabs Console](https://elevenlabs.io/). **`url` (string) required** The endpoint URL for the ElevenLabs TTS service. See [Data residency](https://elevenlabs.io/docs/product-guides/administration/data-residency). **`params` (object) required** **`model_id` (string) required** Identifier of the model to be used. Popular options include `eleven_flash_v2_5` for speed or `eleven_multilingual_v2` for quality. **`voice_id` (string) required** The identifier for the selected voice for speech synthesis. Browse available voices in the [Voice Library](https://elevenlabs.io/voice-library). **`sample_rate` (number) optional** Default value: `24000` Audio sampling rate in Hz. Common values: `16000`, `22050`, `24000`, `44100`. **`speed` (number) optional** Default value: `1.0` Speed up or slow down the speed of the generated speech. Range `0.7` to `1.2` inclusive. **`stability` (number) optional** Controls voice stability. Higher values `(0.8-1.0)` produce more consistent speech, lower values `(0.0-0.5)` add more variation. **`similarity_boost` (number) optional** Enhances similarity to the original voice. Range: `0.0-1.0`. Higher values stick closer to the training voice. **`style` (number) optional** Controls speaking style and expressiveness. Higher values increase emotional range and variation. **`use_speaker_boost` (boolean) optional** Improves voice quality and similarity when enabled. Recommended for most use cases. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to ElevenLabs without validation. For a full list of supported options, refer to the [ElevenLabs TTS documentation](https://elevenlabs.io/docs/capabilities/text-to-speech). # Fish Audio (/en/ai/platform/models/tts/fish-audio) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Fish Audio provides text-to-speech (TTS) with flexible models and high-quality synthetic voices. ## Sample configuration The following example shows how to configure Fish Audio as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Fish Audio supports BYOK only. It isn't available in managed mode. Store your Fish Audio API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, FishAudioTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( FishAudioTTS( key=secret_ref("support_prod", "fishaudio"), reference_id="", backend="speech-1.5", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, FishAudioTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new FishAudioTTS({ key: secretRef('support_prod', 'fishaudio'), referenceId: '', backend: 'speech-1.5', }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewFishAudioTTS(vendors.FishAudioTTSOptions{ Key: agentkit.SecretRef("support_prod", "fishaudio"), ReferenceID: "", Backend: "speech-1.5", })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Fish Audio API key. In the following example, the key is stored as `fishaudio` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.fishaudio" } }, "vendor": "fishaudio", "params": { "reference_id": "", "backend": "speech-1.5" } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, `FishAudioTTS` sets them from its options. **tts** **`vendor` (string) required** Set to `fishaudio`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Fish Audio API key. **`params` (object) required** **`reference_id` (string) required** The identifier of the voice model to use for speech synthesis. **`backend` (string) required** The backend model version to use. For example, `speech-1.5`. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Fish Audio without validation. For a full list of supported options, refer to the [Fish Audio documentation](https://docs.fish.audio/sdk-reference/python/api-reference). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Google (/en/ai/platform/models/tts/google) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Google provides fast, reliable text-to-speech (TTS) with customizable voices. ## Sample configuration The following example shows how to configure Google TTS as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Google TTS supports BYOK only. It isn't available in managed mode. Store your Google Cloud service account credentials JSON string in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, GoogleTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( GoogleTTS( key=secret_ref("support_prod", "google"), voice_name="en-US-Chirp3-HD-Charon", sample_rate_hertz=24000, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, GoogleTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new GoogleTTS({ key: secretRef('support_prod', 'google'), voiceName: 'en-US-Chirp3-HD-Charon', sampleRate: 24000, }), ); ``` **Go SDK** ```go // client is your configured Agora client sampleRate := vendors.SampleRate24kHz agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewGoogleTTS(vendors.GoogleTTSOptions{ Key: agentkit.SecretRef("support_prod", "google"), VoiceName: "en-US-Chirp3-HD-Charon", SampleRate: &sampleRate, })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.credentials` to a reference to your Google Cloud service account credentials JSON string. In the following example, the key is stored as `google` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "credentials": "$secrets.support_prod.google" } }, "vendor": "google", "params": { "VoiceSelectionParams": { "name": "en-US-Chirp3-HD-Charon" }, "AudioConfig": { "speaking_rate": 1.0, "sample_rate_hertz": 24000 } } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, `GoogleTTS` sets them from its options. **tts** **`vendor` (string) required** Set to `google`. **`credential` (object) required** Set `mode` to `byok` and `fields.credentials` to a `$secrets..` reference to your Google Cloud service account credentials JSON string. Get your credentials from the [Google Cloud Console](https://console.cloud.google.com/). **`params` (object) required** **`VoiceSelectionParams` (object) required** **`name` (string) required** The name of the voice to use, for example, `en-US-Chirp3-HD-Charon` or `en-US-Neural2-A`. See [supported voices](https://cloud.google.com/text-to-speech/docs/voices) for available voice names. **`AudioConfig` (object) optional** **`speaking_rate` (number) optional** The speed of speech. Valid range is `0.25` to `2.0`, where `1.0` is the normal speed. Values less than `1.0` slow down the speech, while values greater than `1.0` speed it up. **`sample_rate_hertz` (integer) optional** The sample rate in Hertz for the audio output, for example, `24000` or `16000`. The default value depends on the selected voice. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Google without validation. For a full list of supported options, refer to the [Google documentation](https://cloud.google.com/text-to-speech/docs/create-audio-text-streaming). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Gradium (/en/ai/platform/models/tts/gradium) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Gradium provides enterprise-grade AI voice generation with text-to-speech (TTS) models. ## Sample configuration The following example shows how to configure Gradium as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Gradium supports BYOK only. It isn't available in managed mode. Store your Gradium API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, GradiumTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( GradiumTTS( api_key=secret_ref("support_prod", "gradium"), url="wss://api.gradium.ai/api/speech/tts", model_name="default", voice_id="", sample_rate=16000, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, GradiumTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new GradiumTTS({ apiKey: secretRef('support_prod', 'gradium'), url: 'wss://api.gradium.ai/api/speech/tts', modelName: 'default', voiceId: '', sampleRate: 16000, }), ); ``` **Go SDK** ```go // client is your configured Agora client sampleRate := vendors.SampleRate16kHz agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewGradiumTTS(vendors.GradiumTTSOptions{ APIKey: agentkit.SecretRef("support_prod", "gradium"), URL: "wss://api.gradium.ai/api/speech/tts", ModelName: "default", VoiceID: "", SampleRate: &sampleRate, })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Gradium API key. In the following example, the key is stored as `gradium` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.gradium" } }, "vendor": "gradium", "url": "wss://api.gradium.ai/api/speech/tts", "params": { "model_name": "default", "voice_id": "", "sample_rate": 16000 } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, `GradiumTTS` sets them from its options. **tts** **`vendor` (string) required** Set to `gradium`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Gradium API key. **`url` (string) optional** The WebSocket endpoint for streaming TTS output. For example, `wss://api.gradium.ai/api/speech/tts`. **`params` (object) required** **`model_name` (string) optional** The TTS model to use. For example, `default`. **`voice_id` (string) optional** The voice identifier to use. **`sample_rate` (number) optional** The audio sample rate in Hz. For example, `16000`. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Gradium without validation. For a full list of supported options, refer to the [Gradium documentation](https://docs.gradium.ai/guides/text-to-speech). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Hume AI (/en/ai/platform/models/tts/humeai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Hume AI provides emotion-aware text-to-speech technology that generates natural, expressive voices with emotional intelligence. The platform offers both curated voices from the Voice Library and support for custom voice creation, enabling personalized audio experiences. ## Sample configuration The following example shows how to configure Hume AI as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Hume AI supports BYOK only. It isn't available in managed mode. Store your Hume AI API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, HumeAITTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( HumeAITTS( key=secret_ref("support_prod", "humeai"), base_url="https://api.hume.ai", voice_id="", provider="HUME_AI", speed=1.0, trailing_silence=0.35, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, HumeAITTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new HumeAITTS({ key: secretRef('support_prod', 'humeai'), baseUrl: 'https://api.hume.ai', voiceId: '', provider: 'HUME_AI', speed: 1.0, trailingSilence: 0.35, }), ); ``` **Go SDK** ```go // client is your configured Agora client speed, trailingSilence := 1.0, 0.35 agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewHumeAITTS(vendors.HumeAITTSOptions{ Key: agentkit.SecretRef("support_prod", "humeai"), BaseURL: "https://api.hume.ai", VoiceID: "", Provider: "HUME_AI", Speed: &speed, TrailingSilence: &trailingSilence, })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.key` to a reference to your Hume AI API key. In the following example, the key is stored as `humeai` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "key": "$secrets.support_prod.humeai" } }, "vendor": "humeai", "url": "https://api.hume.ai", "params": { "voice_id": "", "provider": "HUME_AI", "speed": 1, "trailing_silence": 0.35 } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, `HumeAITTS` sets them from its options. **tts** **`vendor` (string) required** Set to `humeai`. **`credential` (object) required** Set `mode` to `byok` and `fields.key` to a `$secrets..` reference to your Hume AI API key. Get your API key from the Hume AI console. **`url` (string) optional** The base URL for the Hume AI API. For example, `https://api.hume.ai`. **`params` (object) required** **`voice_id` (string) required** The identifier of the voice to use for speech synthesis. Choose from available voices in your Hume AI dashboard. **`provider` (string) required** Default value: `CUSTOM_VOICE` Possible values: `HUME_AI, CUSTOM_VOICE` The voice provider type. - `"HUME_AI"`: Use a pre-built voice from Hume's curated Voice Library. - `"CUSTOM_VOICE"`: Use your own custom-trained voice. **`speed` (number) optional** Default value: `1` Possible values: `0.25 to 3.0` Controls the playback speed of the generated speech. Higher values increase speech rate. **`trailing_silence` (number) optional** Default value: `0.35` Possible values: `0 to 5` Duration of silence (in seconds) to add at the end of each utterance. Useful for natural conversation pacing. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Hume AI without validation. For a full list of supported options, refer to the [Hume AI TTS documentation](https://dev.hume.ai/docs/text-to-speech-tts/overview). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Microsoft Azure (/en/ai/platform/models/tts/microsoft) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Microsoft Azure offers neural voices in multiple languages with options for different speaking styles and emotions, providing enterprise-grade text-to-speech capabilities with high-quality audio output. ## Sample configuration The following example shows how to configure Microsoft Azure as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Microsoft Azure supports BYOK only. It isn't available in managed mode. Store your Azure Speech key in a secret set, and refer to it from the agent. Your Azure region isn't secret. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, MicrosoftTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( MicrosoftTTS( key=secret_ref("support_prod", "microsoft"), region="eastus", voice_name="en-US-AndrewMultilingualNeural", speed=1.0, volume=70, sample_rate=24000, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, MicrosoftTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new MicrosoftTTS({ key: secretRef('support_prod', 'microsoft'), region: 'eastus', voiceName: 'en-US-AndrewMultilingualNeural', speed: 1.0, volume: 70, sampleRate: 24000, }), ); ``` **Go SDK** ```go // client is your configured Agora client speed, volume, sampleRate := 1.0, 70.0, vendors.SampleRate24kHz agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewMicrosoftTTS(vendors.MicrosoftTTSOptions{ Key: agentkit.SecretRef("support_prod", "microsoft"), Region: "eastus", VoiceName: "en-US-AndrewMultilingualNeural", Speed: &speed, Volume: &volume, SampleRate: &sampleRate, })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.key` to a reference to your Azure Speech key. Pass your Azure region in `params`. In the following example, the key is stored as `microsoft` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "key": "$secrets.support_prod.microsoft" } }, "vendor": "microsoft", "params": { "region": "eastus", "voice_name": "en-US-AndrewMultilingualNeural", "speed": 1.0, "volume": 70, "sample_rate": 24000 } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, `MicrosoftTTS` sets them from its options. **tts** **`vendor` (string) required** Set to `microsoft`. **`credential` (object) required** Set `mode` to `byok` and `fields.key` to a `$secrets..` reference to your Azure Speech key. Get your key from the [Azure Portal](https://portal.azure.com/). **`params` (object) required** **`region` (string) required** The Azure region where the speech service is hosted, for example `eastus` or `westus2`. **`voice_name` (string) required** The identifier for the selected voice for speech synthesis. See [available voices](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=tts) for options. **`speed` (number) optional** Default value: `1.0` Speaking rate of the text. Values between `0.5` and `2.0` times the original audio speed. **`volume` (number) optional** Default value: `100` Audio volume as a number between `0.0` and `100.0`, where `0.0` is quietest and `100.0` is loudest. **`sample_rate` (integer) optional** Default value: `24000` Audio sampling rate in Hz. Common values: `16000`, `24000`, `48000`. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Microsoft Azure without validation. For a full list of supported options, refer to the [Microsoft Azure TTS documentation](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/text-to-speech). # MiniMax (/en/ai/platform/models/tts/minimax) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). MiniMax provides text-to-speech (TTS) with multiple voice styles and low-latency streaming output. ## Sample configuration The following example shows how to configure MiniMax as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). MiniMax supports managed mode and BYOK. In managed mode, Agora provides access to MiniMax, and you don't need a MiniMax account. For BYOK, store your MiniMax API key in a secret set, and refer to it from the agent. For details, see [Use managed mode](/en/ai/platform/build/managed-mode) and [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, MiniMaxTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( MiniMaxTTS( key=secret_ref("support_prod", "minimax"), # omit to use managed mode group_id="", # omit to use managed mode url="wss://api-uw.minimax.io/ws/v1/t2a_v2", # omit to use managed mode model="speech-2.8-turbo", voice_id="English_captivating_female1", speed=1.0, sample_rate=44100, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, MiniMaxTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new MiniMaxTTS({ key: secretRef('support_prod', 'minimax'), // omit to use managed mode groupId: '', // omit to use managed mode url: 'wss://api-uw.minimax.io/ws/v1/t2a_v2', // omit to use managed mode model: 'speech-2.8-turbo', voiceId: 'English_captivating_female1', speed: 1.0, sampleRate: 44100, }), ); ``` **Go SDK** ```go // client is your configured Agora client speed, sampleRate := 1.0, 44100 agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewMiniMaxTTS(vendors.MiniMaxTTSOptions{ Key: agentkit.SecretRef("support_prod", "minimax"), // omit to use managed mode GroupID: "", // omit to use managed mode URL: "wss://api-uw.minimax.io/ws/v1/t2a_v2", // omit to use managed mode Model: "speech-2.8-turbo", VoiceID: "English_captivating_female1", Speed: &speed, SampleRate: &sampleRate, })) ``` **REST API** - **Managed mode** Set `credential.mode` to `managed` in the `tts` block. Agora provides access to MiniMax, and you don't need a MiniMax account. ```json "tts": { "credential": { "mode": "managed" }, "vendor": "minimax", "params": { "model": "speech-2.8-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1.0 }, "audio_setting": { "sample_rate": 44100 } } } ``` - **BYOK** Set `credential.mode` to `byok` and `credential.fields.key` to a reference to your MiniMax API key in a secret set. Your MiniMax group ID isn't secret. Pass it in `params`. In the following example, the key is stored as `minimax` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "key": "$secrets.support_prod.minimax" } }, "vendor": "minimax", "url": "wss://api-uw.minimax.io/ws/v1/t2a_v2", "params": { "group_id": "", "model": "speech-2.8-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1.0 }, "audio_setting": { "sample_rate": 44100 } } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, the MiniMax TTS class sets them from its options. **tts** **`vendor` (string) required** Set to `minimax`. **`credential` (object) required** How the agent authenticates with MiniMax. Set `mode` to `managed`, or to `byok` with `fields.key` set to a `$secrets..` reference to your MiniMax API key. **`url` (string) optional** A custom WebSocket endpoint for streaming TTS output, for example `wss://api-uw.minimax.io/ws/v1/t2a_v2`. Not needed in managed mode. **`params` (object) required** **`group_id` (string) optional** The MiniMax group identifier. Required for BYOK. **`model` (string) required** The TTS model to use, for example `speech-02-turbo`. For managed mode, use `speech-2.6-turbo` or `speech-2.8-turbo`. **`voice_setting.voice_id` (string) required** The voice style identifier to use, for example `English_captivating_female1`. **`voice_setting.speed` (number) required** The speaking speed, for example `1.0`. **`audio_setting.sample_rate` (number) optional** Possible values: `8000, 16000, 22050, 24000, 32000, 44100` The audio sampling rate in Hz. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to MiniMax without validation. For a full list of supported options, refer to the [MiniMax documentation](https://www.minimax.io/platform/document/t2a_http). # Mistral (/en/ai/platform/models/tts/mistral) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Mistral provides enterprise-grade AI voice generation with text-to-speech (TTS) models. ## Sample configuration The following example shows how to configure Mistral as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Mistral supports BYOK only. It isn't available in managed mode. Store your Mistral API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, MistralTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( MistralTTS( api_key=secret_ref("support_prod", "mistral"), model="voxtral-mini-tts-2603", voice="", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, MistralTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new MistralTTS({ apiKey: secretRef('support_prod', 'mistral'), model: 'voxtral-mini-tts-2603', voice: '', }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewMistralTTS(vendors.MistralTTSOptions{ APIKey: agentkit.SecretRef("support_prod", "mistral"), Model: "voxtral-mini-tts-2603", Voice: "", })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Mistral API key in a secret set. In the following example, the key is stored as `mistral` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.mistral" } }, "vendor": "mistral", "params": { "model": "voxtral-mini-tts-2603", "voice": "" } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, the Mistral TTS class sets them from its options. **tts** **`vendor` (string) required** Set to `mistral`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Mistral API key. **`params` (object) optional** **`model` (string) optional** The TTS model to use, for example `voxtral-mini-tts-2603`. **`voice` (string) optional** The voice identifier to use. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Mistral without validation. For a full list of supported options, refer to the [Mistral documentation](https://docs.mistral.ai/api/endpoint/audio/speech). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Murf (/en/ai/platform/models/tts/murf) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Murf provides enterprise-grade AI voice generation with text-to-speech (TTS) models. ## Sample configuration The following example shows how to configure Murf as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Murf supports BYOK only. It isn't available in managed mode. Store your Murf API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, MurfTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( MurfTTS( key=secret_ref("support_prod", "murf"), base_url="wss://global.api.murf.ai/v1/speech/stream-input", voice_id="Matthew", locale="en-US", rate=0, pitch=0, model="FALCON", sample_rate=24000, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, MurfTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new MurfTTS({ key: secretRef('support_prod', 'murf'), baseUrl: 'wss://global.api.murf.ai/v1/speech/stream-input', voiceId: 'Matthew', locale: 'en-US', rate: 0, pitch: 0, model: 'FALCON', sampleRate: 24000, }), ); ``` **Go SDK** ```go rate, pitch, sampleRate := 0.0, 0.0, 24000 // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewMurfTTS(vendors.MurfTTSOptions{ Key: agentkit.SecretRef("support_prod", "murf"), BaseURL: "wss://global.api.murf.ai/v1/speech/stream-input", VoiceID: "Matthew", Locale: "en-US", Rate: &rate, Pitch: &pitch, Model: "FALCON", SampleRate: &sampleRate, })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Murf API key in a secret set. In the following example, the key is stored as `murf` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.murf" } }, "vendor": "murf", "url": "wss://global.api.murf.ai/v1/speech/stream-input", "params": { "voiceId": "Matthew", "locale": "en-US", "rate": 0, "pitch": 0, "model": "FALCON", "sample_rate": 24000 } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, the Murf TTS class sets them from its options. **tts** **`vendor` (string) required** Set to `murf`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Murf API key. **`url` (string) optional** The WebSocket endpoint for streaming TTS output, for example `wss://global.api.murf.ai/v1/speech/stream-input`. **`params` (object) optional** **`voiceId` (string) optional** The voice identifier to use, for example `Matthew`. **`locale` (string) optional** The locale for the selected voice, for example `en-US`. **`rate` (number) optional** The speech rate adjustment. A value of `0` applies the default rate. **`pitch` (number) optional** The pitch adjustment. A value of `0` applies the default pitch. **`model` (string) optional** The TTS model to use, for example `FALCON`. **`sample_rate` (number) optional** The audio sample rate in Hz, for example `24000`. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Murf without validation. For a full list of supported options, refer to the [Murf documentation](https://murf.ai/api/docs/api-reference/text-to-speech/stream-input). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # OpenAI (/en/ai/platform/models/tts/openai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). OpenAI provides natural-sounding text-to-speech with customizable voice instructions and multiple voice options. ## Sample configuration The following example shows how to configure OpenAI as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). OpenAI supports managed mode and BYOK. In managed mode, Agora provides access to OpenAI, and you don't need a OpenAI account. For BYOK, store your OpenAI API key in a secret set, and refer to it from the agent. For details, see [Use managed mode](/en/ai/platform/build/managed-mode) and [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, OpenAITTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( OpenAITTS( api_key=secret_ref("support_prod", "openai"), # omit to use managed mode base_url="https://api.openai.com/v1/audio/speech", # omit to use managed mode model="tts-1", voice="coral", instructions="Please use standard American English, natural tone, moderate pace, and steady intonation", speed=1, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, OpenAITTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new OpenAITTS({ apiKey: secretRef('support_prod', 'openai'), // omit to use managed mode baseUrl: 'https://api.openai.com/v1/audio/speech', // omit to use managed mode model: 'tts-1', voice: 'coral', instructions: 'Please use standard American English, natural tone, moderate pace, and steady intonation', speed: 1, }), ); ``` **Go SDK** ```go speed := 1.0 // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewOpenAITTS(vendors.OpenAITTSOptions{ APIKey: agentkit.SecretRef("support_prod", "openai"), // omit to use managed mode BaseURL: "https://api.openai.com/v1/audio/speech", // omit to use managed mode Model: "tts-1", Voice: "coral", Instructions: "Please use standard American English, natural tone, moderate pace, and steady intonation", Speed: &speed, })) ``` **REST API** - **Managed mode** Set `credential.mode` to `managed` in the `tts` block. Agora provides access to OpenAI, and you don't need a OpenAI account. ```json "tts": { "credential": { "mode": "managed" }, "vendor": "openai", "params": { "model": "tts-1", "voice": "coral", "instructions": "Please use standard American English, natural tone, moderate pace, and steady intonation", "speed": 1 } } ``` - **BYOK** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your OpenAI API key in a secret set. In the following example, the key is stored as `openai` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.openai" } }, "vendor": "openai", "url": "https://api.openai.com/v1/audio/speech", "params": { "model": "gpt-4o-mini-tts", "voice": "coral", "instructions": "Please use standard American English, natural tone, moderate pace, and steady intonation", "speed": 1 } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, the OpenAI TTS class sets them from its options. **tts** **`vendor` (string) required** Set to `openai`. **`credential` (object) required** How the agent authenticates with OpenAI. Set `mode` to `managed`, or to `byok` with `fields.api_key` set to a `$secrets..` reference to your OpenAI API key. Get your API key from the [OpenAI Console](https://platform.openai.com/api-keys). **`url` (string) optional** The full endpoint URL for the OpenAI speech API, for example `https://api.openai.com/v1/audio/speech`. Not needed in managed mode. See [How to use data residency](https://platform.openai.com/docs/guides/your-data#how-to-use-data-residency). **`params` (object) required** **`model` (string) required** Identifier of the model to be used. For managed mode, use `tts-1`. **`voice` (string) required** The voice identifier for speech synthesis. **`instructions` (string) optional** Custom instructions for voice style, accent, pace, and tone. Helps fine-tune the speech characteristics. **`speed` (number) optional** Default value: `1.0` Speaking rate multiplier. Values between `0.25` and `4.0`, where `1.0` is normal speed. > **Info** > > OpenAI TTS models do not support changing the sample rate. The audio output is fixed at 24,000 Hz. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to OpenAI without validation. For a full list of supported options, refer to the [OpenAI TTS documentation](https://platform.openai.com/docs/guides/text-to-speech). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Rime (/en/ai/platform/models/tts/rime) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Rime provides high-quality text-to-speech (TTS) with low latency, supporting multiple speakers and models. ## Sample configuration The following example shows how to configure Rime as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Rime supports BYOK only. It isn't available in managed mode. Store your Rime API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, RimeTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( RimeTTS( key=secret_ref("support_prod", "rime"), base_url="wss://users.rime.ai/ws2", speaker="cove", model_id="mistv2", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, RimeTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new RimeTTS({ key: secretRef('support_prod', 'rime'), baseUrl: 'wss://users.rime.ai/ws2', speaker: 'cove', modelId: 'mistv2', }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewRimeTTS(vendors.RimeTTSOptions{ Key: agentkit.SecretRef("support_prod", "rime"), BaseURL: "wss://users.rime.ai/ws2", Speaker: "cove", ModelID: "mistv2", })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Rime API key in a secret set. In the following example, the key is stored as `rime` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.rime" } }, "vendor": "rime", "url": "wss://users.rime.ai/ws2", "params": { "speaker": "cove", "modelId": "mistv2" } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, the Rime TTS class sets them from its options. **tts** **`vendor` (string) required** Set to `rime`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Rime API key. **`url` (string) optional** The WebSocket URL for the Rime streaming API, for example `wss://users.rime.ai/ws2`. **`params` (object) required** **`speaker` (string) required** The speaker voice to use for TTS output, for example `cove`. **`modelId` (string) required** The Rime TTS model to use, for example `mistv2`. Different models provide different voice qualities and capabilities. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Rime without validation. For a full list of supported options, refer to the Rime documentation for [Arcana](https://docs.rime.ai/api-reference/arcana/streaming-pcm) and [Mist v2](https://docs.rime.ai/api-reference/endpoint/streaming-pcm). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Sarvam (/en/ai/platform/models/tts/sarvam) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Sarvam provides fast, reliable text-to-speech (TTS) with support for Indian languages and customizable voices. ## Sample configuration The following example shows how to configure Sarvam as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Sarvam supports BYOK only. It isn't available in managed mode. Store your Sarvam API subscription key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, SarvamTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( SarvamTTS( key=secret_ref("support_prod", "sarvam"), speaker="anushka", target_language_code="en-IN", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, SarvamTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new SarvamTTS({ key: secretRef('support_prod', 'sarvam'), speaker: 'anushka', targetLanguageCode: 'en-IN', }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewSarvamTTS(vendors.SarvamTTSOptions{ Key: agentkit.SecretRef("support_prod", "sarvam"), Speaker: "anushka", TargetLanguageCode: "en-IN", })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_subscription_key` to a reference to your Sarvam API subscription key in a secret set. In the following example, the key is stored as `sarvam` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_subscription_key": "$secrets.support_prod.sarvam" } }, "vendor": "sarvam", "params": { "model": "bulbul:v3", "speaker": "anushka", "target_language_code": "en-IN" } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, the Sarvam TTS class sets them from its options. **tts** **`vendor` (string) required** Set to `sarvam`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_subscription_key` to a `$secrets..` reference to your Sarvam API subscription key. Get your key from the [Sarvam dashboard](https://dashboard.sarvam.ai/signin). **`params` (object) required** **`model` (string) required** The Sarvam text-to-speech model. Set to `bulbul:v3`. **`speaker` (string) required** The voice ID to use for speech generation. - Female voices: `anushka`, `manisha`, `vidya`, `arya`. - Male voices: `abhilash`, `karun`, `hitesh`. **`target_language_code` (string) required** The language code for speech synthesis. Supported values: - `en-IN`: English (India) - `hi-IN`: Hindi - `bn-IN`: Bengali - `ta-IN`: Tamil - `te-IN`: Telugu - `kn-IN`: Kannada - `ml-IN`: Malayalam - `mr-IN`: Marathi - `gu-IN`: Gujarati - `pa-IN`: Punjabi - `or-IN`: Odia **`pitch` (number) optional** Possible values: `[-0.75,0.75]` The pitch adjustment for the voice. Positive values make the voice sharper; negative values make it deeper. **`pace` (number) optional** Possible values: `[0.3,3.0]` The speed of speech. `1.0` is the normal speed. Values less than `1.0` slow down the speech; values greater than `1.0` speed it up. **`loudness` (number) optional** Possible values: `[0.1,3.0]` The volume level of the speech. Higher values increase the loudness. **`sample_rate` (number) optional** Possible values: `8000, 16000, 22050, 24000` The audio sample rate in Hz. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Sarvam without validation. For a full list of supported options, refer to the [Sarvam documentation](https://docs.sarvam.ai/api-reference-docs/text-to-speech/convert). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Smallest AI (/en/ai/platform/models/tts/smallest-ai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Smallest AI provides low-latency streaming text-to-speech (TTS) through its Lightning model family, with voices across a broad set of languages. ## Sample configuration The following example shows how to configure Smallest AI as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Smallest AI supports BYOK only. It isn't available in managed mode. Store your Smallest AI API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, SmallestAITTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( SmallestAITTS( api_key=secret_ref("support_prod", "smallestai"), url="https://api.smallest.ai/waves/v1/tts/live", model="lightning_v3.1_pro", voice_id="hazel", sample_rate=16000, speed=1.0, language="zh", number_pronunciation_language="zh", math_notation=True, pronunciation_dicts=[], session_id="session_001", request_id="request_001", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, SmallestAITTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new SmallestAITTS({ apiKey: secretRef('support_prod', 'smallestai'), url: 'https://api.smallest.ai/waves/v1/tts/live', model: 'lightning_v3.1_pro', voiceId: 'hazel', sampleRate: 16000, speed: 1.0, language: 'zh', numberPronunciationLanguage: 'zh', mathNotation: true, pronunciationDicts: [], sessionId: 'session_001', requestId: 'request_001', }), ); ``` **Go SDK** ```go sampleRate, speed, mathNotation := 16000, 1.0, true // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewSmallestAITTS(vendors.SmallestAITTSOptions{ APIKey: agentkit.SecretRef("support_prod", "smallestai"), URL: "https://api.smallest.ai/waves/v1/tts/live", Model: "lightning_v3.1_pro", VoiceID: "hazel", SampleRate: &sampleRate, Speed: &speed, Language: "zh", NumberPronunciationLanguage: "zh", MathNotation: &mathNotation, PronunciationDicts: []string{}, SessionID: "session_001", RequestID: "request_001", })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Smallest AI API key in a secret set. In the following example, the key is stored as `smallestai` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.smallestai" } }, "vendor": "smallestai", "url": "https://api.smallest.ai/waves/v1/tts/live", "params": { "model": "lightning_v3.1_pro", "voice_id": "hazel", "sample_rate": 16000, "speed": 1.0, "language": "zh", "number_pronunciation_language": "zh", "math_notation": true, "pronunciation_dicts": [], "session_id": "session_001", "request_id": "request_001" } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, the Smallest AI TTS class sets them from its options. **tts** **`vendor` (string) required** Set to `smallestai`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Smallest AI API key. **`url` (string) optional** The Smallest AI streaming TTS endpoint, for example `https://api.smallest.ai/waves/v1/tts/live`. **`params` (object) optional** **`model` (string) optional** The Smallest AI TTS model to use, such as `lightning_v3.1_pro` or `lightning_v3.1`. Voice identifiers are model-specific. Make sure `voice_id` belongs to the model you select. **`voice_id` (string) optional** The Smallest AI voice identifier to use, for example `hazel`. **`sample_rate` (integer) optional** Output audio sample rate in Hz, for example `16000`. **`speed` (number) optional** Speech rate multiplier, where `1.0` is the model's default pace. **`language` (string) optional** Language code used for speech synthesis, for example `zh`. **`number_pronunciation_language` (string) optional** Language code used when reading numbers aloud. Set this when numbers should be spoken in a different language from the surrounding text. **`math_notation` (boolean) optional** Whether to read mathematical notation as spoken mathematics rather than as literal symbols. **`pronunciation_dicts` (array[string]) optional** Identifiers of Smallest AI pronunciation dictionaries to apply, used to override how specific terms are spoken. **`session_id` (string) optional** Caller-supplied session identifier, passed through to Smallest AI for tracing. **`request_id` (string) optional** Caller-supplied request identifier, passed through to Smallest AI for tracing. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Smallest AI without validation. For a full list of supported options, refer to the [Smallest AI documentation](https://docs.smallest.ai/models/documentation/text-to-speech-lightning/overview). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Typecast (/en/ai/platform/models/tts/typecast) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). Typecast provides text-to-speech (TTS) with expressive, natural-sounding voices. ## Sample configuration The following example shows how to configure Typecast as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). Typecast supports BYOK only. It isn't available in managed mode. Store your Typecast API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, TypecastTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( TypecastTTS( api_key=secret_ref("support_prod", "typecast"), voice_id="tc_60e5426de8b95f1d3000d7b5", model="ssfm-v30", ) ) ) ``` **TypeScript SDK** ```ts import { Agent, TypecastTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new TypecastTTS({ apiKey: secretRef('support_prod', 'typecast'), voiceId: 'tc_60e5426de8b95f1d3000d7b5', model: 'ssfm-v30', }), ); ``` **Go SDK** ```go // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewTypecastTTS(vendors.TypecastTTSOptions{ APIKey: agentkit.SecretRef("support_prod", "typecast"), VoiceID: "tc_60e5426de8b95f1d3000d7b5", Model: "ssfm-v30", })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your Typecast API key in a secret set. In the following example, the key is stored as `typecast` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.typecast" } }, "vendor": "typecast", "params": { "voice_id": "tc_60e5426de8b95f1d3000d7b5", "model": "ssfm-v30" } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, the Typecast TTS class sets them from its options. **tts** **`vendor` (string) required** Set to `typecast`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your Typecast API key. **`params` (object) required** **`voice_id` (string) required** The Typecast voice identifier to use, for example `tc_60e5426de8b95f1d3000d7b5`. **`model` (string) required** The Typecast TTS model to use, for example `ssfm-v30`. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to Typecast without validation. For a full list of supported options, refer to the [Typecast documentation](https://typecast.ai/docs/api-reference/text-to-speech/text-to-speech). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # xAI (/en/ai/platform/models/tts/xai) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). xAI provides text-to-speech (TTS) with a range of expressive voices for conversational AI applications. ## Sample configuration The following example shows how to configure xAI as the agent's TTS when you create or update an agent. For a complete example, see [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent#create-an-agent). xAI supports BYOK only. It isn't available in managed mode. Store your xAI API key in a secret set, and refer to it from the agent. For details, see [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). **Python SDK** ```python from agora_agent import Agent, XaiTTS, secret_ref # client is your configured Agora client agent = ( Agent(client=client) .with_stt(...) # configure your ASR vendor .with_llm(...) # configure your LLM vendor .with_tts( XaiTTS( api_key=secret_ref("support_prod", "xai"), voice_id="eve", language="en", sample_rate=16000, ) ) ) ``` **TypeScript SDK** ```ts import { Agent, XAiTTS, secretRef } from 'agora-agents'; // client is your configured Agora client const agent = new Agent({ client }) .withStt(/* configure your ASR vendor */) .withLlm(/* configure your LLM vendor */) .withTts( new XAiTTS({ apiKey: secretRef('support_prod', 'xai'), voiceId: 'eve', language: 'en', sampleRate: 16000, }), ); ``` **Go SDK** ```go sampleRate := vendors.SampleRate16kHz // client is your configured Agora client agent := agentkit.NewAgent(client). WithStt( /* configure your ASR vendor */ ). WithLlm( /* configure your LLM vendor */ ). WithTts(vendors.NewXaiTTS(vendors.XaiTTSOptions{ APIKey: agentkit.SecretRef("support_prod", "xai"), VoiceID: "eve", Language: "en", SampleRate: &sampleRate, })) ``` **REST API** Set `credential.mode` to `byok` and `credential.fields.api_key` to a reference to your xAI API key in a secret set. In the following example, the key is stored as `xai` in the `support_prod` set: ```json "tts": { "credential": { "mode": "byok", "fields": { "api_key": "$secrets.support_prod.xai" } }, "vendor": "xai", "params": { "voice_id": "eve", "language": "en", "sample_rate": 16000 } } ``` ## Key parameters The `tts` block takes the following fields. In the SDKs, the xAI TTS class sets them from its options. **tts** **`vendor` (string) required** Set to `xai`. **`credential` (object) required** Set `mode` to `byok` and `fields.api_key` to a `$secrets..` reference to your xAI API key. **`params` (object) required** **`voice_id` (string) optional** The voice to use for speech synthesis. For voice IDs and samples, refer to the [xAI documentation](https://docs.x.ai/developers/model-capabilities/audio/text-to-speech#voices). **`language` (string) required** The BCP-47 language code for speech synthesis. For example, use `en` for English. For supported language codes, refer to the [xAI documentation](https://docs.x.ai/developers/model-capabilities/audio/text-to-speech#supported-languages). **`sample_rate` (integer) optional** The audio sample rate in Hz. Supported values: `8000`, `16000`, `22050`, `24000`, `44100`, `48000`. > **Caution** > > The parameters listed on this page are validated for use with the Conversational AI Platform. Required parameters must be provided as documented. Any additional parameters in `params` are passed through directly to xAI without validation. For a full list of supported options, refer to the [xAI Text to Speech documentation](https://docs.x.ai/developers/model-capabilities/audio/text-to-speech). This integration is fully supported for use with the Conversational AI Platform. While it has completed functional validation, it is newer to the platform, and additional provider-specific edge cases may be identified as usage scales across a broader range of applications and workloads. # Notification event types (/en/ai/platform/reference/event-types) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). When you enable Agora message notifications, the Agora notification server (NCS) sends event notifications about your Conversational AI Platform sessions to your server in HTTPS POST requests. This page describes the request format and each event type. To receive notifications, configure a webhook for your project in Agora Console. ## Choose event types by goal The following table helps you find the events for common tasks: | Goal | Use these event types | What they help you answer | | --------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | Confirm that a session started or ended | [`1001` Session state changed](#1001-session-state-changed) | Did the agent start? When and why did the session end? | | Get what was said in a session | [`1002` Session transcripts](#1002-session-transcripts) | What did the user and the agent say? | | Investigate failures | [`1003` Session errors](#1003-session-errors), [`1001` Session state changed](#1001-session-state-changed) | Which component failed? Did the session end because of it? | | Measure latency per turn | [`1004` Turns finished](#1004-turns-finished) | How long did each turn take, and in which component? | | Renew the agent's RTC token | [`1101` RTC token expiring](#1101-rtc-token-expiring) | Does the agent need a new token? | | Track phone call progress | [`1201` Telephony state](#1201-telephony-state) | Was the call answered? How and why did it end? | For phone calls, the session and the call are reported separately. [`1001` Session state changed](#1001-session-state-changed) reports the agent's session, which can be `running` while the call is still ringing. [`1201` Telephony state](#1201-telephony-state) reports the call itself. A call can also end before the session's post-call results are ready. To follow a phone call, handle both events. ## Request header Each notification request contains the following headers: | Header | Description | | -------------------- | ------------------------------------------------------------------------------------ | | `Content-Type` | `application/json` | | `Agora-Signature-V2` | An HMAC/SHA256 signature over the raw request body. Use this signature when you can. | | `Agora-Signature` | An HMAC/SHA1 signature over the raw request body, for compatible integrations. | Verify the signature against the unchanged raw request body before you accept the notification. ## Request body The request body is a UTF-8 JSON object with the following fields: | Field | Type | Required | Description | | ----------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------ | | `noticeId` | String | Yes | The notification ID. It stays the same when NCS retries the same event. Use it to deduplicate notifications. | | `productId` | Integer | Yes | The product ID. For the Conversational AI Platform, `23`. | | `eventType` | Integer | Yes | The event type. See [Event types](#event-types). | | `notifyMs` | Integer | Yes | The time NCS sent the notification, as a Unix timestamp in milliseconds. It can change when NCS retries. | | `sid` | String | Yes | The session ID. It's the same as `payload.agent_session_id`. | | `payload` | Object | Yes | The event details. Each event type has its own fields. | The envelope fields use camelCase. The `payload` fields use snake\_case, like the Session API. In `payload`, `created_at` and `ended_at` are the session's timestamps in Unix seconds, and `occurred_at_ms` is when the event happened, in Unix milliseconds. ```json { "noticeId": "notice-1001-example", "productId": 23, "eventType": 1001, "notifyMs": 1789913402100, "sid": "b42ac95tp25py49fc37hp94vm67ht52h", "payload": { "agent_session_id": "b42ac95tp25py49fc37hp94vm67ht52h", "status": "failed", "occurred_at_ms": 1789913402000, "created_at": 1789913400, "ended_at": 1789913402, "transport": { "type": "telephony", "direction": "outbound", "to_number": "+14155550101" } } } ``` ### Respond to notifications After you verify a notification, return HTTP status `200` with a JSON body within 10 seconds. Keep the following in mind: - Notifications can be duplicated or arrive out of order. Neither `notifyMs` nor `occurred_at_ms` sets the delivery order. Deduplicate by `noticeId`. - Acknowledge event types that you don't recognize, after you verify their signature. - If you miss a notification, [Retrieve a session](/en/api-reference/api-ref/conversational-ai/platform/retrieve-session) returns the session's latest status, not the transition you missed. Phone call state and post-call results can't be recovered this way. ## Event types Event types are grouped by scope: `10xx` for sessions, `11xx` for RTC, and `12xx` for telephony. Session events apply to both transports. | Event type | Event name | Event description | | :---------------------------------- | :-------------------- | :----------------------------------------------------------------------------------------------------------------------- | | [1001](#1001-session-state-changed) | Session state changed | The session status changes, including when the agent joins or leaves an RTC channel and when the session fails to start. | | [1002](#1002-session-transcripts) | Session transcripts | Transcript processing for the session finished or failed. | | [1003](#1003-session-errors) | Session errors | A component of the agent reported an error. The error doesn't necessarily end the session. | | [1004](#1004-turns-finished) | Turns finished | Conversation turn data, including metrics for each turn, after the session ends. | | [1101](#1101-rtc-token-expiring) | RTC token expiring | The agent's RTC token is about to expire. | | [1201](#1201-telephony-state) | Telephony state | The state of an inbound or outbound phone call changes. | ### 1001 Session state changed The session status changed. This event applies to both transports, and it includes failures before the agent joins an RTC channel or before a call is answered. For RTC sessions, `running` means the agent joined the channel, and `stopped` or `failed` means it left. `payload.status` is the status at the transition. A later [Retrieve a session](/en/api-reference/api-ref/conversational-ai/platform/retrieve-session) request can return a newer status. | Field | Type | Required | Description | | ------------------ | ------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `agent_session_id` | String | Yes | The session ID. It's the same as the envelope `sid`. | | `agent_name` | String | No | The agent name, when it's known. | | `labels` | `Object` | No | The labels you passed when you started the session. | | `status` | String | Yes | The session status at this transition: `idle`, `starting`, `running`, `stopping`, `stopped`, or `failed`. | | `occurred_at_ms` | Integer | Yes | When the transition happened, as a Unix timestamp in milliseconds. | | `created_at` | Integer | Yes | When the session was created, as a Unix timestamp in seconds. | | `ended_at` | Integer | No | When the session ended, as a Unix timestamp in seconds, if it's known. | | `transport` | Object | Yes | The session's transport. For `rtc`, `type` and `channel`. For `telephony`, `type`, `direction`, and the `from_number` and `to_number` when they're known. It never contains RTC tokens or encryption settings. | | `message` | String | No | Details about the status, as free-form text, for example `OK`. Don't rely on a fixed set of values. | A session can fail before the phone numbers are resolved. In that case, `transport` doesn't contain `from_number` or `to_number`. The following examples show payloads for RTC and phone sessions: **RTC session running** ```json { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "agent_name": "support-agent", "status": "running", "occurred_at_ms": 1789913400000, "created_at": 1789913400, "transport": { "type": "rtc", "channel": "support-4821" }, "labels": { "customer_group": "vip" } } ``` **RTC session stopped** ```json { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "agent_name": "support-agent", "status": "stopped", "occurred_at_ms": 1789913470000, "created_at": 1789913400, "ended_at": 1789913470, "transport": { "type": "rtc", "channel": "support-4821" }, "message": "OK", "labels": { "customer_group": "vip" } } ``` **Phone session running** ```json { "agent_session_id": "c42ac95tp25py49fc37hp94vm67ht52h", "agent_name": "support-agent", "status": "running", "occurred_at_ms": 1789913401000, "created_at": 1789913400, "transport": { "type": "telephony", "direction": "outbound", "from_number": "+14155550100", "to_number": "+14155550101" }, "labels": { "customer_group": "vip" } } ``` ### 1002 Session transcripts Transcript processing for the session finished or failed. This event applies to both transports. The transcript records what the user and the agent said. It isn't the LLM's context window. `status` is the result of transcript processing, not the session status. A phone call can end before this event arrives. | Field | Type | Required | Description | | -------------------------------- | ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `agent_session_id` | String | Yes | The session ID. It's the same as the envelope `sid`. | | `occurred_at_ms` | Integer | Yes | When the event happened, as a Unix timestamp in milliseconds. It isn't the NCS delivery time in `notifyMs`. | | `agent_name` | String | No | The agent name, when it's known. | | `labels` | `Object` | No | The labels you passed when you started the session. | | `created_at` | Integer | Yes | When the session was created, as a Unix timestamp in seconds. | | `ended_at` | Integer | Yes | When the session ended, as a Unix timestamp in seconds. | | `status` | String | Yes | The result of transcript processing: `completed` or `failed`. | | `transcript` | `Array` | Yes | The spoken segments. Empty when processing failed or no speech was captured. | | `transcript[].role` | String | Yes | The speaker: `user` or `assistant`. | | `transcript[].content` | String | Yes | The words spoken or played. An interrupted agent segment contains only the part that was played. | | `transcript[].turn_id` | Integer | Yes | The ID of the turn the segment belongs to. | | `transcript[].speech_started_ms` | Integer | No | When the speech or playback started, as a Unix timestamp in milliseconds. | | `transcript[].speech_ended_ms` | Integer | No | When the speech or playback ended, as a Unix timestamp in milliseconds. | | `transcript[].metadata` | Object | No | The source of the segment in `source`: `greeting`, `asr`, `llm`, or `command`. An interrupted segment also contains `interrupted`, `interrupted_ms`, and `original`, the full text the agent planned to say. | The following example shows a payload for this event: ```json { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "occurred_at_ms": 1789913471000, "agent_name": "support-agent", "created_at": 1789913400, "ended_at": 1789913470, "status": "completed", "labels": { "customer_group": "vip" }, "transcript": [ { "role": "assistant", "content": "How can I help you today?", "turn_id": 1, "speech_started_ms": 1789913410000, "speech_ended_ms": 1789913411000, "metadata": { "source": "greeting" } }, { "role": "user", "content": "Can you tell me a joke?", "turn_id": 2, "speech_started_ms": 1789913411200, "speech_ended_ms": 1789913411800, "metadata": { "source": "asr" } }, { "role": "assistant", "content": "Why did the scarecrow ", "turn_id": 2, "speech_started_ms": 1789913412000, "speech_ended_ms": 1789913412700, "metadata": { "source": "llm", "interrupted": true, "interrupted_ms": 1789913412700, "original": "Why did the scarecrow win an award? Because he was outstanding in his field!" } }, { "role": "user", "content": "Tell me a story instead.", "turn_id": 3, "speech_started_ms": 1789913412800, "speech_ended_ms": 1789913413400, "metadata": { "source": "asr" } }, { "role": "assistant", "content": "Once upon a time in a land far away, there lived a brave knight.", "turn_id": 3, "speech_started_ms": 1789913413600, "speech_ended_ms": 1789913417000, "metadata": { "source": "llm" } }, { "role": "assistant", "content": "Are you still there?", "turn_id": 4, "speech_started_ms": 1789913420000, "speech_ended_ms": 1789913421000, "metadata": { "source": "command" } } ] } ``` ### 1003 Session errors A component of the agent reported an error. The error doesn't necessarily end the session. To find out whether the session ended, use [`1001` Session state changed](#1001-session-state-changed). | Field | Type | Required | Description | | ------------------ | --------------- | -------- | ----------------------------------------------------------------------------------------------------------- | | `agent_session_id` | String | Yes | The session ID. It's the same as the envelope `sid`. | | `occurred_at_ms` | Integer | Yes | When the event happened, as a Unix timestamp in milliseconds. It isn't the NCS delivery time in `notifyMs`. | | `agent_name` | String | No | The agent name, when it's known. | | `created_at` | Integer | Yes | When the session was created, as a Unix timestamp in seconds. | | `turn_id` | Integer | No | The ID of the turn the error belongs to, if any. | | `errors` | `Array` | Yes | The errors reported in this notification. | | `errors[].module` | String | Yes | The component that reported the error, for example `llm`. | | `errors[].turn_id` | Integer | No | The ID of the turn the error belongs to, if any. | | `errors[].code` | Integer | Yes | The component's error code. | | `errors[].message` | String | Yes | A description of the error. | The following example shows a payload for this event: ```json { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "occurred_at_ms": 1789913430000, "agent_name": "support-agent", "created_at": 1789913400, "turn_id": 2, "errors": [ { "module": "llm", "turn_id": 2, "code": 503, "message": "Insufficient balance." } ] } ``` ### 1004 Turns finished The session ended, and its conversation turn data is available. Each turn includes its start, its end, and its latency metrics, if they were collected. The payload can leave out earlier turns. `is_truncated` tells you whether it did. Session timestamps are in Unix seconds. Turn boundaries are in Unix milliseconds. | Field | Type | Required | Description | | -------------------------------------- | ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | `agent_session_id` | String | Yes | The session ID. It's the same as the envelope `sid`. | | `occurred_at_ms` | Integer | Yes | When the event happened, as a Unix timestamp in milliseconds. It isn't the NCS delivery time in `notifyMs`. | | `agent_name` | String | No | The agent name, when it's known. | | `created_at` | Integer | Yes | When the session was created, as a Unix timestamp in seconds. | | `ended_at` | Integer | Yes | When the session ended, as a Unix timestamp in seconds. | | `total_turn_count` | Integer | Yes | The total number of turns in the session. | | `is_truncated` | Boolean | Yes | Whether `turns` leaves out earlier turns. | | `turns` | `Array` | Yes | The turns in this payload. | | `turns[].agent_session_id` | String | Yes | The session ID. | | `turns[].turn_id` | Integer | Yes | The turn ID. | | `turns[].start` | Object | Yes | The start of the turn and what triggered it. | | `turns[].start.started_at_ms` | Integer | Yes | When the turn started, as a Unix timestamp in milliseconds. | | `turns[].start.type` | String | Yes | What started the turn: `voice_input`, `greeting`, `silence_timeout`, `api_speak`, or `api_think`. | | `turns[].start.metadata` | Object | No | Details about what started the turn. | | `turns[].end` | Object | Yes | The end of the turn and its outcome. | | `turns[].end.ended_at_ms` | Integer | Yes | When the turn ended, as a Unix timestamp in milliseconds. | | `turns[].end.type` | String | Yes | How the turn ended: `ok`, `error`, `ignored`, or `interrupted`. | | `turns[].end.metadata` | Object | No | Details about how the turn ended. | | `turns[].metrics` | Object | No | Performance metrics for the turn, if collected. | | `turns[].metrics.e2e_latency_ms` | Number | No | The end-to-end latency of the turn, in milliseconds. | | `turns[].metrics.segmented_latency_ms` | `Object` | No | The latency of each component in milliseconds, such as `asr_ttlw_ms`, `llm_ttfb_ms`, and `tts_ttfb_ms`. Components that weren't measured are left out. | The following example shows a payload for this event: ```json { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "occurred_at_ms": 1789913473000, "agent_name": "support-agent", "created_at": 1789913400, "ended_at": 1789913470, "total_turn_count": 4, "is_truncated": true, "turns": [ { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "turn_id": 4, "start": { "started_at_ms": 1789913420000, "type": "silence_timeout" }, "end": { "ended_at_ms": 1789913421000, "type": "ok" }, "metrics": { "e2e_latency_ms": 1500, "segmented_latency_ms": { "asr_ttlw_ms": 503, "llm_ttfb_ms": 1104, "tts_ttfb_ms": 85 } } } ] } ``` ### 1101 RTC token expiring The agent's RTC token is about to expire. This is a warning only: the agent stays in the channel, and the session continues. If you passed the agent's token when you started the session, [update the session](/en/api-reference/api-ref/conversational-ai/platform/update-session) with a new `transport.token` before the token expires. | Field | Type | Required | Description | | ------------------ | ------- | -------- | ----------------------------------------------------------------------------------------------------------- | | `agent_session_id` | String | Yes | The session ID. It's the same as the envelope `sid`. | | `occurred_at_ms` | Integer | Yes | When the event happened, as a Unix timestamp in milliseconds. It isn't the NCS delivery time in `notifyMs`. | | `agent_name` | String | No | The agent name, when it's known. | | `transport` | Object | Yes | The RTC transport. `type` is `rtc`, and `channel` is the channel name. | | `created_at` | Integer | Yes | When the session was created, as a Unix timestamp in seconds. | | `message` | String | Yes | The warning text: `RTC token will expire soon.` | The following example shows a payload for this event: ```json { "agent_session_id": "a42ac95tp25py49fc37hp94vm67ht52h", "occurred_at_ms": 1789913450000, "agent_name": "support-agent", "created_at": 1789913400, "transport": { "type": "rtc", "channel": "support-4821" }, "message": "RTC token will expire soon." } ``` ### 1201 Telephony state The state of an inbound or outbound phone call changed. Call state is separate from the session status: a `running` session doesn't mean that the call was answered. Each notification contains the basic call details. You can handle each one on its own, even when notifications arrive out of order. | Field | Type | Required | Description | | -------------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `agent_session_id` | String | Yes | The session ID. It's the same as the envelope `sid`. | | `custom_id` | String | No | Your own call ID from the SIP `X-switch-id` header, if any. It isn't the session ID or an idempotency key. | | `direction` | String | Yes | The call direction: `inbound` or `outbound`. | | `from_number` | String | Yes | The caller's number. | | `to_number` | String | Yes | The called number. | | `occurred_at_ms` | Integer | Yes | When the event happened, as a Unix timestamp in milliseconds. It doesn't guarantee ordering. | | `state` | String | Yes | The call state: `starting`, `calling`, `ringing`, `answered`, `transferred`, or `ended`. A call can skip `calling` and `ringing`. Don't assume that a call was answered because it ended. | | `hangup_reason` | String | No | Why the call ended, as a normalized reason. Present when `state` is `ended`. See [Hangup reasons](#hangup-reasons). | | `hangup_reason_code` | String | No | The raw SIP or gateway reason code. Present when `state` is `ended`. New values can appear. | | `duration_seconds` | Number | No | How long the call was connected, in seconds. `0` if it never connected. | The following example shows a payload for this event: ```json { "agent_session_id": "c42ac95tp25py49fc37hp94vm67ht52h", "custom_id": "customer-call-0001", "direction": "outbound", "from_number": "+14155550100", "to_number": "+14155550101", "state": "ended", "occurred_at_ms": 1789913470000, "hangup_reason": "USER_HANGUP", "hangup_reason_code": "NORMAL_CLEARING", "duration_seconds": 60 } ``` #### Hangup reasons The following tables list the documented `hangup_reason` values and the `hangup_reason_code` values they map to, grouped by whether the call connected. Neither field is a closed list. If you get a `hangup_reason_code` you don't recognize, `hangup_reason` is `UNKNOWN_REASON`. **Hangup reasons before the call connects** | `hangup_reason` | Meaning | `hangup_reason_code` values | | ---------------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------- | | `NO_ANSWER` | No answer | `NO_ANSWER`, `NO_USER_RESPONSE` | | `POWER_OFF` | The phone is off | `SUBSCRIBER_ABSENT` | | `SUSPENDED` | The number is suspended | `USER_NOT_REGISTERED` | | `BUSY` | The line is busy | `USER_BUSY`, `LOSE_RACE` | | `REJECTED` | The user rejected the call | `CALL_REJECTED` | | `NUMBER_NOT_EXIST` | The number doesn't exist | `UNALLOCATED_NUMBER`, `INCOMPATIBLE_DESTINATION`, `DESTINATION_OUT_OF_ORDER`, `INVALID_NUMBER_FORMAT` | | `ROUTE_EXCEPTION` | A routing error | `NO_ROUTE_DESTINATION`, `EXCHANGE_ROUTING_ERROR` | | `NETWORK_EXCEPTION` | A network error | `NETWORK_OUT_OF_ORDER` | | `CALL_TIMEOUT` | The call timed out | `RECOVERY_ON_TIMER_EXPIRE` | | `MEDIA_TIMEOUT` | The media timed out | `MEDIA_TIMEOUT` | | `TEMPORARY_FAILURE` | A temporary failure | `NORMAL_TEMPORARY_FAILURE` | | `GATEWAY_DOWN` | A gateway failure | `GATEWAY_DOWN` | | `MESSAGE_EXCEPTION` | A message error | `MANDATORY_IE_MISSING` | | `SERVICE_UNSUPPORTED` | The service isn't available | `SERVICE_NOT_IMPLEMENTED` | | `CALL_STATE_EXCEPTION` | A call state error | `WRONG_CALL_STATE` | | `SYSTEM_SHUTDOWN` | The system service shut down | `SYSTEM_SHUTDOWN` | | `FORCED_TERMINATION` | The Platform ended the call | `MANAGER_REQUEST` | | `UNKNOWN_REASON` | An unknown reason | `NORMAL_UNSPECIFIED`, or a code you don't recognize | | `UNKNOWN_ERROR` | An unknown error | `UNKNOWN` | **Hangup reasons after the call connects** | `hangup_reason` | Meaning | `hangup_reason_code` values | | --------------------- | ------------------------------------------ | --------------------------- | | `USER_HANGUP` | The user hung up | `NORMAL_CLEARING` | | `CALLER_CANCEL` | The caller ended the call | `ORIGINATOR_CANCEL` | | `MAX_DURATION` | The call reached its maximum duration | `ALLOTTED_TIMEOUT` | | `VOICE_MAIL` | The call reached voicemail | `VOICE_MAIL` | | `SYSTEM_INTERRUPT` | A system interruption | `INTERNAL_ERROR` | | `AI_HANGUP` | The agent hung up | `AI_HANGUP` | | `AI_ASSISTANT_HANGUP` | A voice assistant on the other end hung up | `AI_ASSISTANT_HANGUP` | | `SILENCE_HANGUP` | The call ended after silence | `SILENCE_HANGUP` | ## Reference For more information, see the following pages: - [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent) - [Make outbound calls and run campaigns](/en/ai/platform/build/phone-calls/outbound-calls-campaigns) ### API reference - [Retrieve a session](/en/api-reference/api-ref/conversational-ai/platform/retrieve-session) - [Update a session](/en/api-reference/api-ref/conversational-ai/platform/update-session) # Pricing (/en/ai/platform/reference/pricing) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). This page describes how Agora calculates and bills for Conversational AI Platform (Preview) usage. When you use the Conversational AI Platform in your project, Agora charges a monthly fee based on your usage across all projects under your developer account. At the end of each month, the free quota is subtracted from your total usage, and the remaining minutes are multiplied by the unit price to calculate your bill, rounded to two decimal places. For general billing information, see [Billing](/en/introduction/billing). > **Info** > > If you have signed a sales contract with Agora, your billing follows the terms in your contract. ## Unit price Each agent session incurs an audio task fee at the following rate: | Usage Type | Pricing (USD / minute) | Free Minutes | | ----------------------------------- | ---------------------: | -------------------------- | | Conversational AI Engine Audio Task | 0.10\* | First 300 minutes are free | \* The unit price includes usage of selected ASR, LLM, and TTS models. You are charged the same price even if you bring your own key (BYOK). Usage of ASR, LLM, and TTS providers is included in the unit price when using an Agora managed key. Agora provides and manages the API keys for the following providers: - **ASR** - ARES - Deepgram nova-2 - Deepgram nova-3 - **LLM** - OpenAI GPT-4o-mini - OpenAI GPT-4.1-mini - OpenAI GPT-5-nano - OpenAI GPT-5-mini - **TTS** - MiniMax 2.6 Turbo - MiniMax 2.8 Turbo - OpenAI TTS-1 ## Examples The following examples demonstrate how billing is calculated for different agent configurations. ### Using ASR, LLM, and TTS managed by Agora An agent session runs either in an RTC channel or in telephony, and the audio task fee applies to both. This example uses an RTC session: User A joins a channel and starts a voice conversation with the agent. The interaction lasts for 10 minutes. User A and the agent exit the channel at the same time. Agora calculates the cost for this session as follows: | Usage Type | Duration (minutes) | Unit Price | Service Cost (USD) | | ---------------------------------------------------------- | -----------------: | ---------: | -----------------: | | User A: Audio RTC | 10 | 0.00099 | 0.0099 | | Conversational AI Engine Audio Task | 10 | 0.10 | 1.00 | | ASR: ARES, LLM: OpenAI GPT-4o-mini, TTS: MiniMax 2.8 Turbo | 10 | 0.00 | 0.00 | Total cost: 1.0099 USD # Platform release notes (/en/ai/platform/release-notes) > Documentation: Conversational AI. > Documentation version: Preview. > This document describes only this version. [Version index](/llms/doc-versions-convoai-guides-v2.txt). ## Conversational AI Platform (Preview) The Conversational AI Platform is a new API for building and running voice agents in apps and over the phone, from agent configurations that you save once and reuse. For details, see the [Conversational AI Platform overview](/en/ai/platform) and the API reference for the [Python SDK](/en/api-reference/api-ref/server-sdk/platform/python), [TypeScript SDK](/en/api-reference/api-ref/server-sdk/platform/typescript), [Go SDK](/en/api-reference/api-ref/server-sdk/platform/go), and [REST API](/en/api-reference/api-ref/conversational-ai/platform). #### 20261030 (Preview) Released on October 30, 2026. This release introduces a new API for building and running voice agents in apps and over the phone from shared agent configuration. #### New features Included in this release: - **Reusable agents** Save an agent's instructions, variables, greeting, and models once, and use the agent to start any number of sessions and campaigns. See [Create an agent and start a session](/en/ai/platform/get-started/start-stop-agent). - **Managed mode and BYOK** Choose separate ASR, LLM, and TTS models for each agent. Use managed mode to let Agora provide access to supported models, or bring your own provider keys. See [Use managed mode](/en/ai/platform/build/managed-mode) and [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). - **Project-scoped secrets** Store provider API keys in named secret sets, and reference them by name from your agents instead of including the keys in each configuration. See [Use your own provider keys](/en/ai/platform/build/use-your-own-keys). - **Phone calls** Import your SIP phone numbers, and run agents in inbound and outbound phone calls. Route each number's inbound calls to an agent, place outbound calls, and run scheduled outbound campaigns that you can pause, resume, and cancel. See [Import phone numbers](/en/ai/platform/build/phone-calls/import-phone-numbers), [Route inbound calls to an agent](/en/ai/platform/build/phone-calls/route-inbound-calls), and [Make outbound calls and run campaigns](/en/ai/platform/build/phone-calls/outbound-calls-campaigns). > **Info** > > During the Preview, agent sessions run in North America (US). Geofencing isn't supported.