# Conversational AI API — Main > Only Main documentation is included in this export. # Conversational AI Overview (/en/api-reference/api-ref/conversational-ai) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). The Conversational AI REST API lets you create, stop, update, query, interrupt, and inspect agent sessions from your server. ## API basics All requests are sent to the host `api.agora.io`. - **Authentication**: Use [RESTful authentication](authentication) for every request. - **Request**: Request and response bodies use JSON. - **Base URL**: `https://api.agora.io/api/conversational-ai-agent/v2/projects/`, where `` is the Agora App ID for your project. > **Info** > > Request URLs and request bodies are case-sensitive. ## REST APIs - [Start a conversational AI agent](join): Create and start a Conversational AI agent instance. - [Stop a conversational AI agent](leave): Stop the specified agent instance. - [Update agent configuration](update): Adjust agent parameters at runtime. - [Query agent status](query): Get the current status of the specified agent instance. - [Retrieve a list of agents](list): Retrieve agents that match specified conditions. - [Broadcast a message using TTS](speak): Broadcast a custom message through the TTS module. - [Interrupt the agent](interrupt): Interrupt an agent while it is speaking or thinking. - [Send a custom instruction](think): Send text instructions into the current conversation pipeline. - [Retrieve agent history](history): Retrieve short-term conversation history. - [Query conversation turn information](turns): Query turn-level conversation details and metrics. ## Client toolkit The client toolkit helps you build Conversational AI app clients with APIs that combine Agora RTC and Signaling capabilities for message subscription, conversation events, interruption, transcript updates, image messages, and audio best-practice settings. - [Android toolkit API](client-toolkit/android): Reference for Android toolkit classes, callbacks, structures, and enums. - [iOS toolkit API](client-toolkit/ios): Reference for iOS toolkit classes, callbacks, structures, and enums. - [Web toolkit API](client-toolkit/web): Reference for Web toolkit classes, event handlers, types, interfaces, and enums. # RESTful authentication (/en/api-reference/api-ref/conversational-ai/authentication) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Conversational AI REST API requests require authentication. Use one of the following methods: - **[Token authentication](#token-authentication) (recommended)**: Generate a token with your App ID and App Certificate, and set `Authorization: agora token=""`. - **[Basic HTTP authentication](#basic-http-authentication)**: Generate a Base64-encoded credential from your customer ID and customer secret, and set `Authorization: Basic `. > **Info** > > Implement authentication on the server to mitigate the risk of data leakage. ## Token authentication Token authentication uses a token generated on your server with your App ID and App Certificate. To authenticate with a token, include the `Authorization` header in each request: ```text Authorization: agora token="" ``` ### Prerequisites Before you begin, get the following values from [Agora Console](https://console.agora.io): - **App ID**: A unique string that identifies your project. - **App Certificate**: A string used to generate tokens. > **Warning** > > Never expose your App Certificate in client-side code or public repositories. Generate tokens on your server only. The Agora RESTful API only supports HTTPS with TLS 1.0, 1.1, or 1.2 for encrypted communication. Requests over plain HTTP are not supported and will fail to connect. Tokens expire after a maximum of 86400 seconds. ### Use the token Put the same token in both of the following places: - **`Authorization` header**: The token authenticates the REST API request. - **`properties.token` in the request body**: The token lets the agent join the RTC channel. The token parameters must match the agent request: - `channelName` must match `properties.channel`. - The account or UID must match `properties.agent_rtc_uid`. ### Use a temporary token for testing For testing, you can generate a temporary token in Agora Console. A temporary token is valid for 24 hours. For details, see [Credentials](/en/introduction/console-setup#credentials). Use the channel name you entered when you generated the token as `properties.channel` in your request. In production, generate tokens on your server using the Conversational AI SDK or the token builder library. ### Using the Conversational AI SDK If you already use the Conversational AI SDK in your project, use the SDK token generation utility to generate tokens. The utility generates a token with the RTC and RTM services. The token parameters must match the agent request: - `channelName` must match `properties.channel`. - `uid` must match `properties.agent_rtc_uid`. - The SDK token utility accepts only numeric UIDs. To use string UIDs, generate the token with the [token builder library](#using-the-token-builder-library) and set `enable_string_uid` to `true` in the request body. Install the SDK for your language: **Node.js** ```bash npm install agora-agents ``` **Golang** ```bash go get github.com/AgoraIO/agora-agents-go/v2/agentkit ``` **Python** ```bash pip install agora-agents ``` The following examples generate a token with the SDK and use it in the REST API `Authorization` header: **Node.js** ```js const https = require('https'); const { generateConvoAIToken } = require('agora-agents'); // Keep these credentials on the server and never expose them to clients. const appId = ''; const appCertificate = ''; const channelName = ''; const agentUid = ''; const tokenExpirationInSeconds = 86400; const token = generateConvoAIToken({ appId, appCertificate, channelName, uid: Number(agentUid), tokenExpire: tokenExpirationInSeconds, }); const data = JSON.stringify({ name: '', pipeline_id: '', properties: { channel: channelName, token, agent_rtc_uid: agentUid, remote_rtc_uids: [''], enable_string_uid: false, }, }); const options = { hostname: 'api.agora.io', path: `/api/conversational-ai-agent/v2/projects/${appId}/join`, method: 'POST', headers: { Authorization: `agora token="${token}"`, 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data), }, }; const req = https.request(options, (res) => { console.log(`Status code: ${res.statusCode}`); res.on('data', (d) => { process.stdout.write(d); }); }); req.on('error', (error) => { console.error(error); }); req.write(data); req.end(); ``` **Golang** ```go package main import ( "bytes" "encoding/json" "fmt" "io" "log" "net/http" "strconv" "github.com/AgoraIO/agora-agents-go/v2/agentkit" ) func main() { // Keep these credentials on the server and never expose them to clients. appID := "" appCertificate := "" channelName := "" agentUID := "" tokenExpirationInSeconds := 86400 uid, err := strconv.Atoi(agentUID) if err != nil { log.Fatal(err) } token, err := agentkit.GenerateConvoAIToken(agentkit.GenerateConvoAITokenOptions{ AppID: appID, AppCertificate: appCertificate, ChannelName: channelName, UID: uid, TokenExpire: tokenExpirationInSeconds, }) if err != nil { log.Fatal(err) } data, err := json.Marshal(map[string]any{ "name": "", "pipeline_id": "", "properties": map[string]any{ "channel": channelName, "token": token, "agent_rtc_uid": agentUID, "remote_rtc_uids": []string{""}, "enable_string_uid": false, }, }) if err != nil { log.Fatal(err) } url := fmt.Sprintf("https://api.agora.io/api/conversational-ai-agent/v2/projects/%s/join", appID) req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(data)) if err != nil { log.Fatal(err) } req.Header.Set("Authorization", `agora token="`+token+`"`) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { log.Fatal(err) } defer res.Body.Close() body, err := io.ReadAll(res.Body) if err != nil { log.Fatal(err) } fmt.Printf("Status code: %d\n", res.StatusCode) fmt.Println(string(body)) } ``` **Python** ```python import json import urllib.error import urllib.request from agora_agent.agentkit.token import generate_convo_ai_token # Keep these credentials on the server and never expose them to clients. app_id = "" app_certificate = "" channel_name = "" agent_uid = "" token_expiration_in_seconds = 86400 token = generate_convo_ai_token( app_id=app_id, app_certificate=app_certificate, channel_name=channel_name, uid=int(agent_uid), token_expire=token_expiration_in_seconds, ) data = json.dumps({ "name": "", "pipeline_id": "", "properties": { "channel": channel_name, "token": token, "agent_rtc_uid": agent_uid, "remote_rtc_uids": [""], "enable_string_uid": False, }, }).encode("utf-8") request = urllib.request.Request( f"https://api.agora.io/api/conversational-ai-agent/v2/projects/{app_id}/join", data=data, method="POST", headers={ "Authorization": f'agora token="{token}"', "Content-Type": "application/json", }, ) try: with urllib.request.urlopen(request) as response: print(f"Status code: {response.status}") print(response.read().decode("utf-8")) except urllib.error.HTTPError as error: print(f"Status code: {error.code}") print(error.read().decode("utf-8")) ``` ### Using the token builder library The [AgoraDynamicKey repository](https://github.com/AgoraIO/Tools/tree/master/DynamicKey/AgoraDynamicKey) provides open-source token generation libraries for multiple languages, including `ConvoAITokenBuilder` and the ConvoAI service. Install the token builder library for your language: **Node.js** ```bash npm install agora-token ``` **Golang** ```bash # Pins the latest commit on the feature/access-token2-convoai-stt-services branch go get github.com/AgoraIO/Tools/DynamicKey/AgoraDynamicKey/go/src@b75635c32d30 ``` **Python** ```bash git clone --branch feature/access-token2-convoai-stt-services https://github.com/AgoraIO/Tools.git cd Tools/DynamicKey/AgoraDynamicKey/python3 ``` The following examples use `ConvoAITokenBuilder.buildToken` to generate a token with the ConvoAI, RTC, and RTM services: **Node.js** ```js const https = require('https'); const { ConvoAITokenBuilder } = require('agora-token'); const appId = ''; const appCertificate = ''; const channelName = ''; const agentUid = ''; const tokenExpire = 86400; // Token lifetime, 24 hours, in seconds const privilegeExpire = 3600; // RTC and RTM privilege lifetime, 1 hour, in seconds const token = ConvoAITokenBuilder.buildToken( appId, appCertificate, channelName, agentUid, tokenExpire, privilegeExpire, ); const options = { hostname: 'api.agora.io', path: `/api/conversational-ai-agent/v2/projects/${appId}/join`, method: 'POST', headers: { Authorization: `agora token="${token}"`, 'Content-Type': 'application/json', }, }; https.request(options).end(); ``` **Golang** ```go import "github.com/AgoraIO/Tools/DynamicKey/AgoraDynamicKey/go/src/convoaitokenbuilder" const tokenExpire = 24 * 60 * 60 // Token lifetime, 24 hours, in seconds const privilegeExpire = 60 * 60 // RTC and RTM privilege lifetime, 1 hour, in seconds token, err := convoaitokenbuilder.BuildToken( appID, appCertificate, channelName, agentUID, tokenExpire, privilegeExpire, ) if err != nil { // Handle the error } ``` **Python** ```python from src.convoai_token_builder import ConvoAITokenBuilder token_expire = 86400 # Token lifetime, 24 hours, in seconds privilege_expire = 3600 # RTC and RTM privilege lifetime, 1 hour, in seconds token = ConvoAITokenBuilder.build_token( app_id, app_certificate, channel_name, agent_uid, token_expire, privilege_expire ) ``` The privilege lifetime must not exceed the token lifetime. To set the RTC role or each RTC and RTM privilege separately, use `buildTokenWithPrivilege` (`BuildTokenWithPrivilege` in Go, `build_token_with_privilege` in Python). It also adds the ConvoAI service automatically. ### Send a request with a token The following example starts an agent using a token with the ConvoAI, RTC, and RTM services, such as one from [`ConvoAITokenBuilder.buildToken`](#using-the-token-builder-library). It uses the same token in the `Authorization` header and in `properties.token`, and enables RTM. The example uses [managed mode](/en/ai/build/managed-mode) for ASR, LLM, and TTS, so it doesn't need provider API keys. ```bash curl --request POST \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects//join \ --header 'Authorization: agora token=""' \ --header 'Content-Type: application/json' \ --data '{ "name": "my-agent", "properties": { "channel": "", "token": "", "agent_rtc_uid": "1001", "remote_rtc_uids": ["1002"], "enable_string_uid": false, "idle_timeout": 120, "advanced_features": { "enable_rtm": true }, "asr": { "credential_mode": "managed", "vendor": "deepgram", "params": { "url": "wss://api.deepgram.com/v1/listen", "model": "nova-3", "language": "en-US" } }, "llm": { "credential_mode": "managed", "vendor": "openai", "style": "openai", "url": "https://api.openai.com/v1/chat/completions", "params": { "model": "gpt-4.1-mini" }, "system_messages": [ { "role": "system", "content": "You are a helpful assistant." } ], "greeting_message": "Hello! How can I help you today?", "max_history": 32 }, "tts": { "credential_mode": "managed", "vendor": "minimax", "params": { "url": "wss://api.minimax.io/ws/v1/t2a_v2", "model": "speech-2.6-turbo", "voice_setting": { "voice_id": "English_captivating_female1" } } } } }' ``` The token must be generated for `` and UID `1001`. ## Basic HTTP authentication Basic HTTP authentication uses your Agora customer ID and customer secret. Generate a Base64-encoded credential from the `customer_id:customer_secret` string, then include it in the `Authorization` header: ```text Authorization: Basic ``` ### Generate Customer ID and Customer Secret To generate a Customer ID and Customer Secret, do the following: 1. In [Agora Console](https://console.agora.io), click the username at the bottom of the navigation sidebar to open the account menu, then select **RESTful API Keys**. ![RESTful API keys](https://assets-docs.agora.io/images/console/restful-api-keys.png) 2. Select **Create API Key**. A Customer ID and Customer Secret are generated. 3. Select **Download** and save the file somewhere secure — you can download it only once. In the file, **Key** is your Customer ID and **Secret** is your Customer Secret. 4. Use the Customer ID (**Key**) and Customer Secret (**Secret**) to generate a Base64-encoded credential, and pass it to the `Authorization` parameter in the HTTP request header. ### Generate an authorization header using a third-party tool For testing and debugging, you can use a [third-party online tool](https://www.debugbear.com/basic-auth-header-generator) to quickly generate your Authorization header. Enter your Customer ID as the Username and your Customer Secret as the Password. Your generated header should look like this: ```text Authorization: Basic NDI1OTQ3N2I4MzYy...YwZjA= ``` ### Generate an authorization header using code The following examples read your customer ID and customer secret from the `AGORA_CUSTOMER_KEY` and `AGORA_CUSTOMER_SECRET` environment variables, and print the value to use in the `Authorization` header: **Java** ```java import java.nio.charset.StandardCharsets; import java.util.Base64; public class BasicAuthHeader { public static void main(String[] args) { // Read your customer ID and customer secret from environment variables String customerKey = System.getenv("AGORA_CUSTOMER_KEY"); String customerSecret = System.getenv("AGORA_CUSTOMER_SECRET"); // Join the customer ID and customer secret, then encode them with Base64 String plainCredentials = customerKey + ":" + customerSecret; String base64Credentials = Base64.getEncoder() .encodeToString(plainCredentials.getBytes(StandardCharsets.UTF_8)); // Create the Authorization header value String authorizationHeader = "Basic " + base64Credentials; System.out.println(authorizationHeader); } } ``` **Golang** ```go package main import ( "encoding/base64" "fmt" "os" ) func main() { // Read your customer ID and customer secret from environment variables customerKey := os.Getenv("AGORA_CUSTOMER_KEY") customerSecret := os.Getenv("AGORA_CUSTOMER_SECRET") // Join the customer ID and customer secret, then encode them with Base64 plainCredentials := customerKey + ":" + customerSecret base64Credentials := base64.StdEncoding.EncodeToString([]byte(plainCredentials)) // Create the Authorization header value authorizationHeader := "Basic " + base64Credentials fmt.Println(authorizationHeader) } ``` **PHP** ```php Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Retrieves conversation history for a running Conversational AI agent. - OpenAPI: /openapi/conversational-ai/rest-api.en.yaml - Operation ID: get-history - Method: GET - Path: /v2/projects/{appid}/agents/{agentId}/history - Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/history ## Servers - https://api.agora.io/api/conversational-ai-agent Call this endpoint while the agent is running to retrieve the conversation history between the user and the Conversational AI agent. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of the project. - `agentId` (path, required, string) - The agent instance ID you obtained after successfully calling `join` to [Start a conversational AI agent](/en/api-reference/api-ref/conversational-ai/join). ## Request body No request body. ## Request examples ### curl ```bash curl --request get \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/history \ --header 'Authorization: Basic ' ``` ### Python ```python import requests url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/history" headers = {"Authorization": "Basic "} response = requests.request("get", url, headers=headers) print(response.text) ``` ### Node.js ```javascript const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/history'; const options = {method: 'get', headers: {Authorization: 'Basic '}}; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error(err)); ``` ### Response - If the returned status code is `200`, the request was successful. The response body contains the result of the request. - If the returned status code is not `200`, the request failed. The response body includes the error code and description. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure. ## Responses ### 200 The request was successful. The response body contains the result of the request. - `agent_id` (string) - Unique identifier of the agent. - `start_ts` (integer) - Agent creation timestamp. - `status` (string) - Agent status. Only supports querying the running agent. - `contents` (array) - Agent history. - `contents.items` (object) - `contents.items.role` (string) - The message sender. - `user`: User - `assistant`: AI agent - Allowed: `user` | `assistant` - `contents.items.content` (string) - Message content. - `contents.items.speech_start_ms` (integer) - Unix timestamp in milliseconds indicating when the user started speaking or the agent started TTS playback. Only returned when `llm.vendor` is `custom`. - `contents.items.speech_end_ms` (integer) - Unix timestamp in milliseconds indicating when the user stopped speaking, or when TTS playback completed or was interrupted. Only returned when `llm.vendor` is `custom`. - `contents.items.speech_algorithmic_delay` (integer) - The total delay in milliseconds introduced by audio processing algorithms, including noise reduction, background voice suppression, and voiceprint locking, after audio is captured from the user's microphone. Use this value to align timestamps with cloud recording audio. Only returned when: - `llm.vendor` is `custom` - `contents[].role` is `user` - Actual voice input is present ### default The request failed. The response body includes the error details. - `detail` (string) - Detailed error information. - `reason` (string) - The reason for the failure. ## Response examples ### 200 ```json { "agent_id": "xxxx", "start_ts": 123, "status": "RUNNING", "contents": [ { "role": "user", "content": "hello." }, { "role": "assistant", "content": "hi, how can I help you?" } ] } ``` # Interrupt the agent (/en/api-reference/api-ref/conversational-ai/interrupt) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Interrupts a specified agent while it is speaking or thinking. - OpenAPI: /openapi/conversational-ai/rest-api.en.yaml - Operation ID: agent-interrupt - Method: POST - Path: /v2/projects/{appid}/agents/{agentId}/interrupt - Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/interrupt ## Servers - https://api.agora.io/api/conversational-ai-agent Use this endpoint to interrupt the specified agent while speaking or thinking. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of the project. - `agentId` (path, required, string) - The agent instance ID you obtained after successfully calling `join` to [Start a conversational AI agent](/en/api-reference/api-ref/conversational-ai/join). ### Request body The request body is empty. ## Request body No request body. ## Request examples ### curl ```bash curl --request POST \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/interrupt \ --header 'Authorization: Basic ' \ --data '{}' ``` ### Python ```python import requests url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/interrupt" payload = {} headers = {"Authorization": "Basic "} response = requests.request("POST", url, json=payload, headers=headers) print(response.text) ``` ### Node.js ```javascript const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/interrupt'; const options = { method: 'POST', headers: {Authorization: 'Basic '}, body: JSON.stringify({}) }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error(err)); ``` ### Response - If the returned status code is `200`, the request was successful. The response body contains agent information and the agent stops talking and thinking immediately. - If the returned status code is not `200`, the request failed. The response body includes the error code and description. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure. ## Responses ### 200 The request was successful. The response body contains agent information and the agent stops talking and thinking immediately. No schema. ### default The request failed. The response body includes the error details. - `detail` (string) - Detailed error information. - `reason` (string) - The reason for the failure. # Start a conversational AI agent (/en/api-reference/api-ref/conversational-ai/join) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Creates and starts a Conversational AI agent instance. - OpenAPI: /openapi/conversational-ai/rest-api.en.yaml - Operation ID: start-agent - Method: POST - Path: /v2/projects/{appid}/join - Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/join ## Servers - https://api.agora.io/api/conversational-ai-agent Use this endpoint to create and start a Conversational AI agent instance. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of the project. ## Request body - `name` (string, required) - The unique identifier of the agent. The same identifier cannot be used repeatedly. - `pipeline_id` (string) - The unique ID of a published agent in Conversational AI Studio. When provided, the saved agent configuration is used as the base configuration. Any fields specified in `properties` override the corresponding agent settings. When you specify a `pipeline_id`, the `asr`, `tts`, and `llm` fields in `properties` are optional. - `properties` (object, required) - Configuration details of the agent. - `properties.channel` (string, required) - The name of the channel to join. - `properties.token` (string, required) - The authentication token used by the agent to join the channel. - `properties.agent_rtc_uid` (string, required) - The user ID of the agent in the channel. All UIDs within an RTC channel must be unique. Ensure no other user or service bot is using this UID. A value of `0` means that a unique random UID is generated and assigned. Set the `token` accordingly. - `properties.remote_rtc_uids` (array, required) - A list of user IDs that the agent subscribes to in the channel. Only subscribed users can interact with the agent. :::info[Note] Currently, only one user ID is supported. ::: - `properties.remote_rtc_uids.items` (string) - `properties.enable_string_uid` (boolean) - Whether to enable String uid: - `true`: Both agent and subscriber user IDs use strings. - `false`: Both agent and subscriber user IDs must be integers. - Default: `false` - `properties.idle_timeout` (integer) - The maximum idle time in seconds after all users specified in `remote_rtc_uids` are detected to have left the channel. When the idle time exceeds this value, the agent automatically stops and exits the channel. The valid range is `0` to `259200` (72 hours). - When set to `0`, the agent does not exit due to channel idle timeout. - Regardless of the `idle_timeout` value, the maximum running time for a single session is 72 hours. The agent automatically exits after 72 hours. - Default: `30` - Range: `[0, 259200]` :::tip[Agent lifecycle best practice] For precise and reliable control over the agent's lifecycle, use the [`leave`](/en/api-reference/api-ref/conversational-ai/leave) API to terminate the agent as soon as its task is complete. ::: - `properties.geofence` (object) - Regional access restriction configuration. Use this to limit which Agora servers the Conversational AI Engine can access based on geographic regions. - `properties.geofence.area` (string, required) - The allowed region for server access. - Allowed: `GLOBAL` | `NORTH_AMERICA` | `EUROPE` | `ASIA` | `INDIA` | `JAPAN` - `properties.geofence.exclude_area` (string) - The excluded region. Only available when `area` is set to `GLOBAL`. - Allowed: `NORTH_AMERICA` | `EUROPE` | `ASIA` | `INDIA` | `JAPAN` - `properties.advanced_features` (object) - Advanced features configuration. - `properties.advanced_features.enable_mllm` (boolean, deprecated) - Use [mllm.enable](#request-body-properties-mllm-enable) instead. Enable Multimodal Large Language Model for voice-to-voice processing. Enabling MLLM automatically disables ASR, LLM, and TTS since the MLLM handles end-to-end voice processing directly. See `turn_detection.type` for turn detection options available with MLLM. - Default: `false` - `properties.advanced_features.enable_rtm` (boolean) - Whether to enable the Signaling (RTM) service. When enabled, the agent can combine the capabilities provided by Signaling to implement advanced functions, such as delivering [custom information](/en/ai/build/shape-the-conversation/custom-information). - Default: `false` :::info[Note] Before enabling the Signaling service, make sure the token includes both RTC and RTM privileges. When an agent joins an RTM channel, it reuses the token specified in the `token` field. For more information, see ["How can I generate a token with both RTC and Signaling privileges?"](/en/api-reference/faq/integration/rtc_rtm_token). ::: - `properties.advanced_features.enable_sal` (boolean) - Enable Selective Attention Locking (SAL). When enabled, configure the `sal` field to set up speaker recognition or locking modes. See the `sal` parameter for configuration details. - Default: `false` - `properties.advanced_features.enable_tools` (boolean) - Enable tool invocation. When enabled, the agent can invoke custom tools declared in `llm.tools` and MCP tools configured in `llm.mcp_servers` or `mllm.mcp_servers` to perform tasks such as querying business data or executing external actions. - `true`: Enable custom tool and MCP tool invocation. - `false` (default): Don't enable tool invocation. The agent doesn't access any tool endpoints. Even when this field is `false` or omitted, any `llm.tools` passed in the request are still validated for field type, size, template syntax, and duplicate tool names. - Default: `false` - `properties.asr` (object) - Automatic Speech Recognition (ASR) configuration. - `properties.asr.credential_mode` (string) - The credential mode for this provider: - `managed`: Use Agora-managed credentials. You do not need to provide an API key. See [Use managed mode](/en/ai/build/custom-model-integration/managed-mode). - `byok`: Bring your own key. Provide your own provider credentials, including the API key. - Allowed: `managed` | `byok` - Default: `byok` - `properties.asr.language` (string) - The BCP-47 language tag identifying the primary language used for agent interaction. If `params` contains a vendor-specific language code, it takes precedence over this setting. - Default: `en-US` - `properties.asr.vendor` (string) - ASR provider: - `ares`: [Adaptive Recognition Engine for Speech](/en/ai/models/asr/ares) - `microsoft`: [Microsoft Azure](/en/ai/models/asr/microsoft) - `deepgram`: [Deepgram](/en/ai/models/asr/deepgram) - `openai`: [OpenAI](/en/ai/models/asr/openai) - `speechmatics`: [Speechmatics](/en/ai/models/asr/speechmatics) - `assemblyai`: [AssemblyAI](/en/ai/models/asr/assembly-ai) - `amazon`: Amazon Transcribe - `google`: [Google](/en/ai/models/asr/google) - `gemini`: [Gemini](/en/ai/models/asr/gemini) - `sarvam`: [Sarvam](/en/ai/models/asr/sarvam) - `smallestai`: [Smallest AI](/en/ai/models/asr/smallest-ai) - `xai`: [xAI](/en/ai/models/asr/xai) - Allowed: `ares` | `microsoft` | `deepgram` | `openai` | `google` | `gemini` | `amazon` | `assemblyai` | `sarvam` | `smallestai` | `xai` - Default: `ares` - `properties.asr.keywords` (array) - ASR keywords used to improve recognition accuracy for specific terms. See [ARES](/en/ai/models/asr/ares) for details. - You can only set `properties.asr.keywords` when `properties.asr.vendor` is not set, `null`, an empty string, or `ares`. - You can configure up to 128 keywords. - Setting this field while explicitly using another ASR vendor causes the request to fail with: `Invalid value at properties.asr.keywords: can only be set when properties.asr.vendor is not set or ares.` Configuring keywords can affect recognition accuracy for other terms, so configure them carefully based on your use case. - Max items: `128` - `properties.asr.keywords.items` (string) - `properties.asr.params` (object, required) - The configuration parameters for the selected ASR vendor. For vendor-specific parameters, see the corresponding ASR provider page listed in `asr.vendor`. - `properties.tts` (object, required) - Text-to-speech (TTS) module configuration. - `properties.tts.credential_mode` (string) - The credential mode for this provider: - `managed`: Use Agora-managed credentials. You do not need to provide an API key. See [Use managed mode](/en/ai/build/custom-model-integration/managed-mode). - `byok`: Bring your own key. Provide your own provider credentials, including the API key. - Allowed: `managed` | `byok` - Default: `byok` - `properties.tts.vendor` (string, required) - TTS provider. - `amazon`: [Amazon Polly](/en/ai/models/tts/amazon) - `cartesia` : [Cartesia](/en/ai/models/tts/cartesia) - `deepgram`: [Deepgram](/en/ai/models/tts/deepgram) - `elevenlabs`: [ElevenLabs](/en/ai/models/tts/elevenlabs) - `fishaudio`: [Fish Audio](/en/ai/models/tts/fish-audio) - `gemini`: [Gemini](/en/ai/models/tts/gemini) - `generic_http`: [Generic TTS](/en/ai/models/tts/generic-http), integrated using the OpenAI TTS protocol. Requires `tts.url`, `tts.headers`, and `tts.params`. - `google`: [Google](/en/ai/models/tts/google) - `gradium`: [Gradium](/en/ai/models/tts/gradium) - `humeai`: [Hume AI](/en/ai/models/tts/humeai) - `microsoft`: [Microsoft Azure](/en/ai/models/tts/microsoft) - `minimax`: [MiniMax](/en/ai/models/tts/minimax) - `mistral`: [Mistral](/en/ai/models/tts/mistral) - `murf`: [Murf](/en/ai/models/tts/murf) - `openai`: [OpenAI](/en/ai/models/tts/openai) - `rime`: [Rime](/en/ai/models/tts/rime) - `sarvam`: [Sarvam](/en/ai/models/tts/sarvam) - `smallestai`: [Smallest AI](/en/ai/models/tts/smallest-ai) - `typecast`: [Typecast](/en/ai/models/tts/typecast) - `xai`: [xAI](/en/ai/models/tts/xai) - Allowed: `amazon` | `cartesia` | `deepgram` | `elevenlabs` | `fishaudio` | `gemini` | `generic_http` | `google` | `gradium` | `humeai` | `microsoft` | `minimax` | `mistral` | `murf` | `openai` | `rime` | `sarvam` | `smallestai` | `typecast` | `xai` - `properties.tts.url` (string) - The OpenAI TTS protocol compatible service endpoint. Required only when `tts.vendor` is `generic_http`. - `properties.tts.headers` (object) - Custom request headers to include in requests to the TTS service, such as authentication credentials. Required only when `tts.vendor` is `generic_http`. **Example:** ```json { "Authorization": "Bearer your_tts_api_key" } ``` - `properties.tts.params` (object, required) - The configuration parameters for the selected TTS vendor. For vendor-specific parameters, see the corresponding TTS provider page listed in `tts.vendor`. Required when `tts.vendor` is `generic_http`. - `properties.tts.skip_patterns` (array) - Controls whether the TTS module skips bracketed content when reading LLM response text. This prevents the agent from vocalizing structural prompt information like tone indicators, action descriptions, and system prompts, creating a more natural and immersive listening experience. Enable this feature by specifying one or more values: - `1`: Skip content in Chinese parentheses `()` - `2`: Skip content in Chinese square brackets `【】` - `3`: Skip content in parentheses `( )` - `4`: Skip content in square brackets `[ ]` - `5`: Skip content in curly braces `{ }` :::info[Note] - **Nested brackets**: When input text contains nested brackets and multiple bracket types are configured to be skipped, the system processes only the outermost brackets. The system matches from the beginning of the text and skips the first outermost bracket pair that meets the skip rule, including all nested content. - **Agent memory**: The agent's short-term memory always contains the complete, unfiltered LLM text, regardless of live captioning settings. - **Real-time transcript**: When enabled, transcript excludes filtered content during TTS playback but restores the complete text after each sentence finishes. ::: - `properties.tts.skip_patterns.items` (integer) - `properties.llm` (object, required) - Large language model (LLM) configuration. - `properties.llm.credential_mode` (string) - The credential mode for this provider: - `managed`: Use Agora-managed credentials. You do not need to provide an API key. See [Use managed mode](/en/ai/build/custom-model-integration/managed-mode). - `byok`: Bring your own key. Provide your own provider credentials, including the API key. - Allowed: `managed` | `byok` - Default: `byok` - `properties.llm.url` (string, required) - The LLM callback address. - `properties.llm.api_key` (string) - The LLM verification API key. The default value is an empty string. Ensure that you enable the API key in a production environment. - Default: `` - `properties.llm.system_messages` (array) - A set of predefined information used as input to the LLM, including prompt words and examples. - `properties.llm.system_messages.items` (object) - `properties.llm.params` (object) - Additional LLM configuration parameters, such as the `model` used, and the maximum token limit. For vendor-specific parameters, see the corresponding LLM provider page listed in `llm.vendor`. - `properties.llm.max_history` (integer) - The number of conversation history messages cached in the LLM. History includes user and agent dialog messages, tool call information, and timestamps. Agent and user messages are recorded separately. - Default: `32` - `properties.llm.input_modalities` (array) - LLM input modalities: - `["text"]`: Text only - `["text", "image"]`: Text plus image. Recommended configuration, requires the selected LLM to support visual input - Default: `["text"]` - `properties.llm.input_modalities.items` (string) - `properties.llm.output_modalities` (array) - LLM output modalities: - `["text"]`: The output text is converted to speech by the TTS module and then published to the RTC channel. - `["audio"]`: Voice only. Voice is published directly to the RTC channel. - `["text", "audio"]`: Text plus voice. Write your own logic to process the output of LLM as needed. - Default: `["text"]` - `properties.llm.output_modalities.items` (string) - `properties.llm.greeting_configs` (object) - Agent greeting broadcast configuration. - `properties.llm.greeting_configs.mode` (string) - Determines when the agent sends greeting messages to users joining the channel. - `single_every`: Broadcasts a greeting every time a user joins the channel. - `single_first`: Broadcasts a greeting only once to the first user who joins the channel. - Allowed: `single_every` | `single_first` - Default: `single_every` - `properties.llm.greeting_configs.delay_ms` (integer) - The delay in milliseconds before the agent plays the greeting message after a user joins the channel. - `properties.llm.greeting_configs.interruptable` (boolean) - - `true`: Follows the global `interruption` configuration. - `false`: Uninterruptible. The greeting plays in its entirety. If the user speaks multiple times while the greeting plays, the system merges the speech segments after the greeting ends and sends them to the LLM for a single response. - Default: `true` - `properties.llm.greeting_configs.audio_download_timeout_ms` (integer) - The timeout in milliseconds for downloading the greeting audio file. Only takes effect when `greeting_audio_url` is configured. If the download times out, the system falls back to TTS synthesis using `greeting_message`. - Default: `1000` - Range: `[200, 10000]` - `properties.llm.greeting_configs.audio_pcm_sample_rate` (integer) - The sample rate in Hz of the greeting audio file when the format is PCM. Only takes effect when `greeting_audio_url` is configured and the audio format is PCM. Not required for `mp3` or `wav` files. - Default: `16000` - `properties.llm.greeting_audio_url` (string) - The URL of a pre-recorded audio file to play as the agent's greeting. When configured, the system downloads and plays this recording instead of synthesizing the greeting via TTS. Supported formats: `mp3`, `wav`, `pcm`. - Only `http://` or `https://` URLs are supported. An empty string, non-URL string, or a URL exceeding `2048` bytes causes the request to return a `400` error. - For `pcm` files, set `greeting_configs.audio_pcm_sample_rate` to specify the sample rate. - The system resamples the imported audio to match `tts.params.sample_rate` before playback. You must also configure `greeting_message` as a fallback when using `greeting_audio_url`; otherwise the request returns a `400` error. If the recording fails to download, decode, or is in an unsupported format, the system automatically falls back to TTS synthesis using `greeting_message`. - `properties.llm.greeting_message` (string) - Agent greeting text. This field serves the following purposes: - **Standalone greeting**: If provided without `greeting_audio_url`, the agent greets the first user who joins the channel using TTS synthesis. - **Audio greeting fallback**: When `greeting_audio_url` is configured, this field is required as a fallback. If the audio file fails to download, decode, or is in an unsupported format, the agent falls back to TTS synthesis using this text. - **Interrupted greeting context**: When `greeting_configs.interruptable` is `true` and the audio greeting is interrupted, the system uses this text to estimate the portion already played and injects it into short-term memory to maintain conversation context. - `properties.llm.failure_message` (string) - Prompt for agent activation failure. If provided, it is returned through TTS when the custom LLM call fails. - `properties.llm.vendor` (string) - LLM provider, supports the following settings: - `openai`: [OpenAI](/en/ai/models/llm/openai) - `azure`: [Azure OpenAI](/en/ai/models/llm/azure-openai) - `xai`: [xAI Grok](/en/ai/models/llm/xai) - `custom`: [Custom LLM](/en/ai/build/custom-model-integration/custom-llm). When you set this option, the agent includes the following fields, in addition to `role` and `content` when making requests to the custom LLM: - `turn_id`: A unique identifier for each conversation turn. It starts from `0` and increments with each turn. One user-agent interaction corresponds to one `turn_id`. - `timestamp`: The request timestamp, in milliseconds. - Allowed: `openai` | `azure` | `xai` | `custom` - `properties.llm.style` (string) - The request style for chat completion: - `openai`: For OpenAI and OpenAI-compatible APIs - `gemini`: For Google Gemini and Google Vertex API format - `anthropic`: For Anthropic Claude API format - `dify`: For Dify API format For vendor-specific parameters, see the corresponding LLM provider page listed in `llm.vendor`. - Allowed: `openai` | `gemini` | `anthropic` | `dify` - Default: `openai` - `properties.llm.template_variables` (object) - Template parameter configuration used to insert variables into the agent's `system_messages`, `greeting_message`, `failure_message`, and `parameters.silence_config.content` text. Uses key-value pairs, where the key is the variable name and the value is the variable's value. Template variables, combined with prompt customization and SIP outbound calling functionality, enable dynamic content injection, automating processes such as automatic hang-up, voicemail recognition, automatic message leaving, and call transfer. To insert defined variables in the prompt text, use the syntax `{{variable_name}}`. The system automatically replaces each variable with the corresponding value defined in `template_variables`. :::info[Note] Variable values cannot reference other variables. For example, if you define `"farewell": "Looking forward to seeing you again, {{name}}"`, the `{{name}}` variable will not be resolved. ::: - `properties.llm.mcp_servers` (array) - MCP (Model Context Protocol) server configuration. By configuring MCP servers, agents can call tools provided by external services to implement advanced functionality. See [Use MCP tools](/en/ai/build/mcp-tools). - `properties.llm.mcp_servers.items` (object) - `properties.llm.mcp_servers.items.name` (string, required) - A unique identifier for the MCP server. Maximum 48 characters. Accepts only English letters and numbers. - `properties.llm.mcp_servers.items.endpoint` (string, required) - The endpoint address of the MCP server. The agent uses this to communicate with the MCP server. - `properties.llm.mcp_servers.items.transport` (string) - Transport protocol type. - `streamable_http`: Streaming HTTP protocol - `properties.llm.mcp_servers.items.headers` (object) - HTTP header information to include when requesting the MCP server, such as authentication information. - `properties.llm.mcp_servers.items.allowed_tools` (array) - A list of tools that the agent is allowed to invoke. The agent can only use tools on this list. **Behavior:** - **Empty or omitted**: All tools are enabled. - **Empty array `[]`**: No tools are enabled. - **`["*"]`**: All tools are enabled. - **Specific tools `["aa", "bb", "cc"]`**: Only `aa`, `bb`, and `cc` are enabled. - **Mix with wildcard `["aa", "bb", "*"]`**: All tools are enabled (wildcard takes precedence). - `properties.llm.mcp_servers.items.allowed_tools.items` (unknown) - `properties.llm.mcp_servers.items.timeout_ms` (integer) - The MCP server request timeout in milliseconds. After timeout, the agent stops waiting for the MCP server's response and continues executing subsequent logic. - `properties.llm.tools` (array) - A list of custom tools. When configured, the LLM can select a tool based on the conversation and generate its parameters. The Conversational AI Engine then validates the parameters, calls the corresponding HTTPS endpoint, and returns the result to the LLM to continue generating a response. Custom tools, MCP tools, built-in tools, and model-native tools share the same tool name namespace. Name comparisons aren't case-sensitive and use ASCII rules. After MCP discovery and filtering, a maximum of 32 tools total can be exposed to the LLM. If names conflict or the limit is exceeded, agent startup fails. The engine doesn't automatically overwrite, rename, or truncate tools. - Max items: `32` :::info[Note] - Set `advanced_features.enable_tools` to `true` before using tools. - Only supported for synchronous calls to standard text LLMs. Custom LLMs, Dify, asynchronous tools, and stored tool references aren't supported. For an MLLM agent, configure `mllm.tools` instead. ::: - `properties.llm.tools.items` (object) - A custom tool definition. The LLM decides whether to call the tool and generates its parameters; the Conversational AI Engine validates the parameters, makes one synchronous HTTP request, and returns the result to the LLM. - Only synchronous `GET` and `POST` requests are supported. Asynchronous calls, automatic retries, and HTTP redirects aren't supported. - The raw response body size is capped at 1 MiB and must be UTF-8 text. - `application/json` and `+json` responses preserve their original JSON type, including object, array, scalar, and `null`. Other responses are treated as UTF-8 strings. - An empty response body is returned as `[]`. A 2xx response is reported as `success` and a non-2xx response as `failed`. In both cases, the response content is returned to the LLM. - `properties.llm.tools.items.type` (string, required) - The tool type. Only `function` is supported. - Allowed: `function` - `properties.llm.tools.items.function` (object, required) - `properties.llm.tools.items.function.name` (string, required) - The tool name visible to the model. Must start with a letter and contain only letters and numbers, 1 to 64 characters long. Custom tools, MCP tools, built-in tools, and model-native tools can't share a name. Name comparisons aren't case-sensitive and use ASCII rules. Names can't use the `mcp` prefix or the value `ragsearch_tool`. - Pattern: `^[a-zA-Z][a-zA-Z0-9]{0,63}$` - `properties.llm.tools.items.function.description` (string, required) - A description of the tool, used to help the LLM decide when to call it and what it returns. Don't include sensitive information such as secrets. - Min length: `1` - Max length: `1024` - `properties.llm.tools.items.function.parameters` (object, required) - The tool's parameters, defined as JSON Schema and passed to the LLM using OpenAI's non-strict function-calling mode. See [OpenAI Function Calling](https://platform.openai.com/docs/guides/function-calling). Usage rules: - The root `type` must be `object`. - Common JSON Schema types are supported: `object`, `array`, `string`, `integer`, `number`, `boolean`, and `null`. - Standard JSON Schema keywords relevant to tool parameters are supported, such as `type`, `description`, `enum`, `properties`, `required`, `additionalProperties`, and `items`. - Objects can use `properties`, `required`, and `additionalProperties`. `additionalProperties` can be omitted; when omitted, extra properties are allowed per JSON Schema semantics. To disallow undeclared extra parameters, set it to `false` explicitly. - Array parameters should specify an element schema with `items`. Support for tuple schemas depends on the selected LLM. - Don't add optional parameters to `required`. Don't rely on a specific model's support for advanced keywords such as `$ref`, `$defs`, `format`, `pattern`, range constraints, or composition schemas. Confirm your LLM's compatibility before using them. - The serialized schema size is capped at 64 KiB. Example: ```json { "type": "object", "properties": { "order_id": { "type": "string", "description": "Order ID" } }, "required": ["order_id"], "additionalProperties": false } ``` - `properties.llm.tools.items.execution` (object) - The tool's execution mode. - `properties.llm.tools.items.execution.mode` (string) - The execution mode. Only synchronous `sync` execution is supported. - Allowed: `sync` - Default: `sync` - `properties.llm.tools.items.server` (object, required) - The HTTP request configuration for the custom tool. Templates use single-pass substitution; they aren't expanded recursively. The following variables are supported: - `{{args.}}`: A validated LLM tool parameter. Can be used in the URL path or query parameters and in the request body, but not in headers. - `{{template_variables.}}`: A template variable configured when creating the agent. Can be used in the URL path or query parameters, header values, and the request body. - `{{tool_call_id}}`: The ID correlating this tool call. Can be used in the URL, header values, or the request body. Template variable rules: - **Headers and request body**: Each value must be either a fixed value or one complete placeholder, such as `{{args.order_id}}`. Concatenating a placeholder with other text, such as `order-{{args.order_id}}`, isn't supported, and nested fields, array indexes, and recursive references aren't supported either. - **URL path and query parameters**: Placeholders can be used within a fixed URL, such as `/orders/{{args.order_id}}`. - If a placeholder references a variable that doesn't exist or is `null`, the tool call returns `UnresolvedTemplate`. - Variable values in the URL and headers must be a string, number, or boolean. Authentication information may only be passed as a complete header value. Don't put authentication information in the URL or request body. All header values are treated as sensitive and aren't passed to the LLM or written to regular logs, events, subtitles, or TTS output. - `properties.llm.tools.items.server.method` (string, required) - The HTTP request method: - `GET`: For querying data. Doesn't support a request body; configuring `body` causes request validation to fail. - `POST`: For submitting data. Supports URL query parameters, request headers, and a request body together. - Allowed: `GET` | `POST` - `properties.llm.tools.items.server.url` (string, required) - The absolute HTTPS URL for the custom tool request. The URL path and query parameters can embed single-level placeholders: - `{{args.}}` - `{{template_variables.}}` - `{{tool_call_id}}` For example: `https://api.example.com/orders/{{args.order_id}}?tenant={{template_variables.tenant_id}}`. Usage limits: - Placeholder names must be complete; nested fields, array indexes, and recursive expansion aren't supported. - Only the URL path and query parameters can use placeholders; the scheme, userinfo, host, and port can't be templated. - Usernames, passwords, or other authentication information can't be embedded in the URL. - Placeholder values in the URL must be a string, number, or boolean. - Each rendered path variable is capped at 1024 UTF-8 bytes, each query variable at 4096 UTF-8 bytes, and the final URL at 8192 UTF-8 bytes. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `properties.llm.tools.items.server.headers` (object) - Custom headers to send with the tool request, up to 32 entries. Header values support: - A static string, number, or boolean. - A complete `{{template_variables.}}` placeholder. - A complete `{{tool_call_id}}` placeholder. Usage limits: - Header names must be 1 to 128 characters and must conform to the HTTP token specification. - Header names can't be templated, and header values don't support `{{args.}}`. - A placeholder must be the entire header value; it can't be concatenated with other text, and nested fields, array indexes, or recursive expansion aren't supported. - Each rendered header value is capped at 4096 UTF-8 bytes, and all headers combined are capped at 16 KiB. - If a custom header name conflicts with a system-generated header, the system-generated value takes precedence. All header values are treated as sensitive: they aren't passed to the LLM and aren't written to regular logs, events, subtitles, or TTS output. - `properties.llm.tools.items.server.body` (unknown) - The HTTP request body for the custom tool. Only used with `POST`; configuring this field for `GET` causes request validation to fail. The request body supports object, array, string, number, boolean, and `null`, in any level of JSON structure. Leaf values in the request body can be: - A JSON constant. - A complete `{{args.}}` placeholder. - A complete `{{template_variables.}}` placeholder. - A complete `{{tool_call_id}}` placeholder. A placeholder must be the entire leaf value; it can't be concatenated with other text, and nested fields, array indexes, or recursive expansion aren't supported. After substitution, a placeholder keeps the variable's original JSON type; tool parameters are automatically escaped when serialized into the JSON request body. - `properties.llm.tools.items.server.timeout_ms` (integer) - The HTTP request timeout in milliseconds, in the range [1000, 100000]. Defaults to 10000. - Default: `10000` - Range: `[1000, 100000]` - `properties.llm.headers` (object) - Custom headers to include in requests to the LLM. Use this field to pass business-specific information such as custom fields or tenant identifiers. :::info[Note] - These headers are merged with the headers generated by the Conversational AI Engine. If a key conflict occurs, the engine-generated header takes precedence. For example, authentication-related headers. - Header keys are merged using exact string matching and are case-sensitive. Agora recommends using standard capitalization to avoid ambiguity from duplicate keys with different casing. ::: - `properties.mllm` (object) - Multimodal Large Language Model (MLLM) configuration for real-time audio and text processing. `mllm` is an exclusive alternative to the standard `asr` + `llm` + `tts` pipeline." - `properties.mllm.enable` (boolean) - Enable Multimodal Large Language Model for voice-to-voice processing. Enabling MLLM automatically disables ASR, LLM, and TTS since the MLLM handles end-to-end voice processing directly. Replaces the deprecated `advanced_features.enable_mllm`. - `properties.mllm.url` (string) - The MLLM WebSocket URL for real-time communication. - `properties.mllm.api_key` (string, required) - The API key used for MLLM authentication. - `properties.mllm.messages` (array) - Array of conversation items used for short-term memory management. Uses the same structure as `item.content` from the [OpenAI Realtime API](https://platform.openai.com/docs/api-reference/realtime-client-events/conversation/item/create). - `properties.mllm.messages.items` (object) - `properties.mllm.params` (object) - Additional MLLM configuration parameters. - **Modalities override**: The `modalities` setting in params is overridden by `input_modalities` and `output_modalities`. - **Turn detection override**: The `turn_detection` setting in `params` is overridden by `mllm.turn_detection`. For vendor-specific parameters, see the corresponding MLLM provider page listed in `mllm.vendor`. - `properties.mllm.input_modalities` (array) - MLLM input modalities: - `["audio"]`: Audio only - `["audio", "text"]`: Audio plus text - Default: `["audio"]` - `properties.mllm.input_modalities.items` (string) - `properties.mllm.output_modalities` (array) - MLLM output modalities: - `["text", "audio"]`: Text plus audio - Default: `["text","audio"]` - `properties.mllm.output_modalities.items` (string) - `properties.mllm.greeting_message` (string) - Agent greeting message. If provided, the first user in the channel is automatically greeted with this message upon joining. - `properties.mllm.vendor` (string) - MLLM provider. Currently supports: - `openai`: [OpenAI Realtime API](/en/ai/models/mllm/openai) - `azure`: [Azure OpenAI Realtime API](/en/ai/models/mllm/azure) - `gemini`: [Google Gemini Live](/en/ai/models/mllm/gemini) - `vertexai`: [Google Gemini Live (Vertex AI)](/en/ai/models/mllm/google-vertex-ai) - `xai`: [xAI Grok](/en/ai/models/mllm/xai) - `openai_gpt_live`: [OpenAI GPT-Live](/en/ai/models/mllm/openai-gpt-live) - Allowed: `openai` | `azure` | `gemini` | `vertexai` | `xai` | `openai_gpt_live` - `properties.mllm.mcp_servers` (array) - MCP (Model Context Protocol) server configuration for the MLLM module. By configuring MCP servers, agents can call tools provided by external services to implement advanced functionality. See [Use MCP tools](/en/ai/build/mcp-tools). - `properties.mllm.mcp_servers.items` (object) - `properties.mllm.mcp_servers.items.name` (string, required) - A unique identifier for the MCP server. Maximum 48 characters. Accepts only English letters and numbers. - `properties.mllm.mcp_servers.items.endpoint` (string, required) - The endpoint address of the MCP server. The agent uses this to communicate with the MCP server. - `properties.mllm.mcp_servers.items.transport` (string) - Transport protocol type. - `streamable_http`: Streaming HTTP protocol - `properties.mllm.mcp_servers.items.headers` (object) - HTTP header information to include when requesting the MCP server, such as authentication information. - `properties.mllm.mcp_servers.items.allowed_tools` (array) - A list of tools that the agent is allowed to invoke. The agent can only use tools on this list. **Behavior:** - **Empty or omitted**: All tools are enabled. - **Empty array `[]`**: No tools are enabled. - **`["*"]`**: All tools are enabled. - **Specific tools `["aa", "bb", "cc"]`**: Only `aa`, `bb`, and `cc` are enabled. - **Mix with wildcard `["aa", "bb", "*"]`**: All tools are enabled (wildcard takes precedence). - `properties.mllm.mcp_servers.items.allowed_tools.items` (unknown) - `properties.mllm.mcp_servers.items.timeout_ms` (integer) - The MCP server request timeout in milliseconds. After timeout, the agent stops waiting for the MCP server's response and continues executing subsequent logic. - `properties.mllm.tools` (array) - A list of custom tools. When configured, the MLLM can select a tool based on the conversation and generate its parameters. The Conversational AI Engine then validates the parameters, calls the corresponding HTTPS endpoint, and returns the result to the MLLM to continue generating a response. Custom tools, MCP tools, built-in tools, and model-native tools share the same tool name namespace. Name comparisons aren't case-sensitive and use ASCII rules. After MCP discovery and filtering, a maximum of 32 tools total can be exposed to the MLLM. If names conflict or the limit is exceeded, agent startup fails. The engine doesn't automatically overwrite, rename, or truncate tools. - Max items: `32` :::info[Note] - Set `advanced_features.enable_tools` to `true` before using tools. - Only supported for synchronous calls. Asynchronous tools and stored tool references aren't supported. For a cascading agent, configure `llm.tools` instead. ::: - `properties.mllm.tools.items` (object) - A custom tool definition. The MLLM decides whether to call the tool and generates its parameters; the Conversational AI Engine validates the parameters, makes one synchronous HTTP request, and returns the result to the MLLM. - Only synchronous `GET` and `POST` requests are supported. Asynchronous calls, automatic retries, and HTTP redirects aren't supported. - The raw response body size is capped at 1 MiB and must be UTF-8 text. - `application/json` and `+json` responses preserve their original JSON type, including object, array, scalar, and `null`. Other responses are treated as UTF-8 strings. - An empty response body is returned as `[]`. A 2xx response is reported as `success` and a non-2xx response as `failed`. In both cases, the response content is returned to the MLLM. - `properties.mllm.tools.items.type` (string, required) - The tool type. Only `function` is supported. - Allowed: `function` - `properties.mllm.tools.items.function` (object, required) - `properties.mllm.tools.items.function.name` (string, required) - The tool name visible to the model. Must start with a letter and contain only letters and numbers, 1 to 64 characters long. Custom tools, MCP tools, built-in tools, and model-native tools can't share a name. Name comparisons aren't case-sensitive and use ASCII rules. Names can't use the `mcp` prefix or the value `ragsearch_tool`. - Pattern: `^[a-zA-Z][a-zA-Z0-9]{0,63}$` - `properties.mllm.tools.items.function.description` (string, required) - A description of the tool, used to help the MLLM decide when to call it and what it returns. Don't include sensitive information such as secrets. - Min length: `1` - Max length: `1024` - `properties.mllm.tools.items.function.parameters` (object, required) - The tool's parameters, defined as JSON Schema and passed to the MLLM using OpenAI's non-strict function-calling mode. See [OpenAI Function Calling](https://platform.openai.com/docs/guides/function-calling). Usage rules: - The root `type` must be `object`. - Common JSON Schema types are supported: `object`, `array`, `string`, `integer`, `number`, `boolean`, and `null`. - Standard JSON Schema keywords relevant to tool parameters are supported, such as `type`, `description`, `enum`, `properties`, `required`, `additionalProperties`, and `items`. - Objects can use `properties`, `required`, and `additionalProperties`. `additionalProperties` can be omitted; when omitted, extra properties are allowed per JSON Schema semantics. To disallow undeclared extra parameters, set it to `false` explicitly. - Array parameters should specify an element schema with `items`. Support for tuple schemas depends on the selected MLLM. - Don't add optional parameters to `required`. Don't rely on a specific model's support for advanced keywords such as `$ref`, `$defs`, `format`, `pattern`, range constraints, or composition schemas. Confirm your MLLM's compatibility before using them. - The serialized schema size is capped at 64 KiB. Example: ```json { "type": "object", "properties": { "order_id": { "type": "string", "description": "Order ID" } }, "required": ["order_id"], "additionalProperties": false } ``` - `properties.mllm.tools.items.execution` (object) - The tool's execution mode. - `properties.mllm.tools.items.execution.mode` (string) - The execution mode. Only synchronous `sync` execution is supported. - Allowed: `sync` - Default: `sync` - `properties.mllm.tools.items.server` (object, required) - The HTTP request configuration for the custom tool. Templates use single-pass substitution; they aren't expanded recursively. The following variables are supported: - `{{args.}}`: A validated tool parameter. Can be used in the URL path or query parameters and in the request body, but not in headers. - `{{template_variables.}}`: A template variable configured when creating the agent. Can be used in the URL path or query parameters, header values, and the request body. - `{{tool_call_id}}`: The ID correlating this tool call. Can be used in the URL, header values, or the request body. Template variable rules: - **Headers and request body**: Each value must be either a fixed value or one complete placeholder, such as `{{args.order_id}}`. Concatenating a placeholder with other text, such as `order-{{args.order_id}}`, isn't supported, and nested fields, array indexes, and recursive references aren't supported either. - **URL path and query parameters**: Placeholders can be used within a fixed URL, such as `/orders/{{args.order_id}}`. - If a placeholder references a variable that doesn't exist or is `null`, the tool call returns `UnresolvedTemplate`. - Variable values in the URL and headers must be a string, number, or boolean. Authentication information may only be passed as a complete header value. Don't put authentication information in the URL or request body. All header values are treated as sensitive and aren't passed to the MLLM or written to regular logs, events, subtitles, or TTS output. - `properties.mllm.tools.items.server.method` (string, required) - The HTTP request method: - `GET`: For querying data. Doesn't support a request body; configuring `body` causes request validation to fail. - `POST`: For submitting data. Supports URL query parameters, request headers, and a request body together. - Allowed: `GET` | `POST` - `properties.mllm.tools.items.server.url` (string, required) - The absolute HTTPS URL for the custom tool request. The URL path and query parameters can embed single-level placeholders: - `{{args.}}` - `{{template_variables.}}` - `{{tool_call_id}}` For example: `https://api.example.com/orders/{{args.order_id}}?tenant={{template_variables.tenant_id}}`. Usage limits: - Placeholder names must be complete; nested fields, array indexes, and recursive expansion aren't supported. - Only the URL path and query parameters can use placeholders; the scheme, userinfo, host, and port can't be templated. - Usernames, passwords, or other authentication information can't be embedded in the URL. - Placeholder values in the URL must be a string, number, or boolean. - Each rendered path variable is capped at 1024 UTF-8 bytes, each query variable at 4096 UTF-8 bytes, and the final URL at 8192 UTF-8 bytes. - Min length: `1` - Max length: `2048` - Pattern: `^https://` - `properties.mllm.tools.items.server.headers` (object) - Custom headers to send with the tool request, up to 32 entries. Header values support: - A static string, number, or boolean. - A complete `{{template_variables.}}` placeholder. - A complete `{{tool_call_id}}` placeholder. Usage limits: - Header names must be 1 to 128 characters and must conform to the HTTP token specification. - Header names can't be templated, and header values don't support `{{args.}}`. - A placeholder must be the entire header value; it can't be concatenated with other text, and nested fields, array indexes, or recursive expansion aren't supported. - Each rendered header value is capped at 4096 UTF-8 bytes, and all headers combined are capped at 16 KiB. - If a custom header name conflicts with a system-generated header, the system-generated value takes precedence. All header values are treated as sensitive: they aren't passed to the MLLM and aren't written to regular logs, events, subtitles, or TTS output. - `properties.mllm.tools.items.server.body` (unknown) - The HTTP request body for the custom tool. Only used with `POST`; configuring this field for `GET` causes request validation to fail. The request body supports object, array, string, number, boolean, and `null`, in any level of JSON structure. Leaf values in the request body can be: - A JSON constant. - A complete `{{args.}}` placeholder. - A complete `{{template_variables.}}` placeholder. - A complete `{{tool_call_id}}` placeholder. A placeholder must be the entire leaf value; it can't be concatenated with other text, and nested fields, array indexes, or recursive expansion aren't supported. After substitution, a placeholder keeps the variable's original JSON type; tool parameters are automatically escaped when serialized into the JSON request body. - `properties.mllm.tools.items.server.timeout_ms` (integer) - The HTTP request timeout in milliseconds, in the range [1000, 100000]. Defaults to 10000. - Default: `10000` - Range: `[1000, 100000]` - `properties.mllm.turn_detection` (object) - Turn detection configuration for the MLLM module. :::info[Note] When `mllm.turn_detection` is defined, the top-level `turn_detection` object has no effect. ::: - `properties.mllm.turn_detection.mode` (string) - - `agora_vad`: Agora VAD-based detection. - `server_vad`: Vendor-side VAD-based detection. Supported by OpenAI Realtime API and Gemini Live. - `semantic_vad`: Semantic-based detection. Supported by OpenAI Realtime API only. - Allowed: `agora_vad` | `server_vad` | `semantic_vad` - `properties.mllm.turn_detection.agora_vad_config` (object) - Configuration for Agora VAD-based turn detection. Applicable when `mode` is `agora_vad`. - `properties.mllm.turn_detection.agora_vad_config.interrupt_duration_ms` (integer) - Minimum duration of speech in milliseconds required to trigger an interruption. - `properties.mllm.turn_detection.agora_vad_config.prefix_padding_ms` (integer) - Duration of audio in milliseconds to include before the detected speech start. - `properties.mllm.turn_detection.agora_vad_config.silence_duration_ms` (integer) - Duration of silence in milliseconds required to determine end of speech. - `properties.mllm.turn_detection.agora_vad_config.threshold` (number) - VAD sensitivity threshold. A higher value reduces false positives. - `properties.mllm.turn_detection.server_vad_config` (object) - Configuration for vendor-side VAD-based turn detection. Applicable when `mode` is `server_vad`. Parameters are passed through to the vendor. - `properties.mllm.turn_detection.server_vad_config.prefix_padding_ms` (integer) - Duration of audio in milliseconds to include before the detected speech start. - `properties.mllm.turn_detection.server_vad_config.silence_duration_ms` (integer) - Duration of silence in milliseconds required to determine end of speech. - `properties.mllm.turn_detection.server_vad_config.threshold` (number) - VAD sensitivity threshold. Applicable to OpenAI Realtime API only. - `properties.mllm.turn_detection.server_vad_config.idle_timeout_ms` (integer) - Idle timeout in milliseconds. Applicable to OpenAI Realtime API only. - `properties.mllm.turn_detection.server_vad_config.start_of_speech_sensitivity` (string) - Sensitivity for start of speech detection. Applicable to Gemini Live only. - Allowed: `START_SENSITIVITY_HIGH` | `START_SENSITIVITY_LOW` - `properties.mllm.turn_detection.server_vad_config.end_of_speech_sensitivity` (string) - Sensitivity for end of speech detection. Applicable to Gemini Live only. - Allowed: `END_SENSITIVITY_HIGH` | `END_SENSITIVITY_LOW` - `properties.mllm.turn_detection.semantic_vad_config` (object) - Configuration for semantic-based turn detection. Applicable when `mode` is `semantic_vad`. Supported by OpenAI Realtime API only. - `properties.mllm.turn_detection.semantic_vad_config.eagerness` (string) - Controls how eagerly the model ends its turn. - Allowed: `auto` | `low` | `medium` | `high` - `properties.avatar` (object) - Avatar configuration. - `properties.avatar.enable` (boolean) - Whether to enable the avatar function for the agent. To enable, set to `true` and configure the `vendor` and `params` fields. - Default: `false` - `properties.avatar.vendor` (string) - Avatar vendor. Supports the following values: - `akool`: [Akool](/en/ai/models/avatar/akool) - `liveavatar`: [LiveAvatar](/en/ai/models/avatar/heygen) - `anam`: [Anam](/en/ai/models/avatar/anam) - `generic`: [Generic](/en/ai/models/avatar/generic) - Allowed: `akool` | `liveavatar` | `anam` | `generic` - `properties.avatar.params` (object) - The configuration parameters for the selected avatar vendor. For vendor-specific parameters, see the corresponding avatar provider page listed in `avatar.vendor`. - `properties.turn_detection` (object) - Conversation turn detection settings. Controls the logic for voice activity detection and conversation turn determination. The previous version of `turn_detection` is deprecated. Refer to [Deprecated parameters](#deprecated-parameters) for details. Agora recommends switching to the latest parameters. :::info[Note] This object has no effect when `mllm.enable` is true. Use [mllm.turn_detection](#request-body-properties-mllm-turn-detection) instead. ::: :::info[Note] Starting with v2.6, `turn_detection` only handles Start of Speech (SoS) and End of Speech (EoS) detection. Interruption handling strategies, including keyword-based interruption and disabling interruption, have moved to the top-level [`interruption`](#request-body-properties-interruption) field. This configuration supports multiple combinations of detection modes: - **Start of Speech (SoS)**: Supports three modes: VAD, Keyword, and Disable. - **End of Speech (EoS)**: Supports VAD and Semantic modes. ::: - `properties.turn_detection.mode` (string) - Conversation turn detection mode: - `default`: Uses standard conversation turn detection configuration. - Default: `default` - `properties.turn_detection.type` (string, deprecated) - Deprecated turn detection mechanism. `agora_vad` uses Agora VAD, `server_vad` lets the model detect speech start and end based on audio volume, and `semantic_vad` uses semantic estimation with VAD. Compatible with both cascade (ASR/LLM/TTS) and MLLM modes. - Allowed: `agora_vad` | `server_vad` | `semantic_vad` - Default: `agora_vad` - `properties.turn_detection.interrupt_mode` (string, deprecated) - Deprecated interruption behavior when human voice interrupts the agent while it is speaking or thinking. Sets the agent's behavior when human voice interrupts the agent while it is interacting (speaking or thinking). - Allowed: `interrupt` | `append` | `ignore` | `keywords` | `adaptive` - Default: `interrupt` :::info[Note] Only the `interrupt` mode is supported when you integrate an `mllm`. ::: - `properties.turn_detection.interrupt_duration_ms` (number, deprecated) - The amount of time in milliseconds that the user's voice must exceed the VAD threshold before an interruption is triggered. - Default: `160` - `properties.turn_detection.interrupt_keywords` (array, deprecated) - Keywords that trigger an interruption when `turn_detection.interrupt_mode` is set to `keyword`. Specifies the list of keywords that trigger an interruption when the `turn_detection.interrupt_mode` is set to `"keyword"`. :::info[Note] - Keyword recognition capabilities, such as support for multiple languages or dialects, depend on the ASR provider you choose. - You can configure up to 128 keywords. ::: - `properties.turn_detection.interrupt_keywords.items` (string) - `properties.turn_detection.prefix_padding_ms` (integer, deprecated) - The extra forward padding time in milliseconds before processing starts. - Default: `800` - `properties.turn_detection.silence_duration_ms` (integer, deprecated) - The duration of audio silence in milliseconds after which the agent assumes the user has stopped speaking. - Default: `640` - `properties.turn_detection.threshold` (number, deprecated) - Voice activity detection sensitivity. The valid range is `(0.0, 1.0)`. Identification sensitivity determines the level of sound in the audio signal that is considered voice activity. - Default: `0.5` - Range: `(0, 1)` - `properties.turn_detection.config` (object) - Detailed configuration for conversation turn detection. - `properties.turn_detection.config.speech_threshold` (number) - Voice activity detection sensitivity. Determines the sound level in the audio signal that is considered voice activity. Lower values make it easier for the agent to detect speech, and higher values ignore weak sounds. - Default: `0.5` - Range: `(0, 1)` - `properties.turn_detection.config.start_of_speech` (object) - Start of Speech (SoS) detection configuration. Determines when a user begins speaking. - `properties.turn_detection.config.start_of_speech.mode` (string, required) - Start of speech detection mode: - `vad`: Based on VAD (Voice Activity Detection). Uses audio signal detection. - `manual`: Manual SoS mode. Disables automatic start-of-speech detection. The client explicitly signals the start of user speech via RTM. - `keywords`: Deprecated. Use [`interruption.mode = "keywords"`](#request-body-properties-interruption-mode) instead. - `disabled`: Deprecated. Use [`interruption.enable = false`](#request-body-properties-interruption-enable) with [`interruption.disabled_config.strategy`](#request-body-properties-interruption-disabled-config-strategy) to configure the handling strategy. - Allowed: `vad` | `manual` | `keywords` | `disabled` :::info[Note] When `mode` is `manual`, you must also set `advanced_features.enable_rtm = true` and `parameters.data_channel = "rtm"`. This mode does not support `manual_config`; no additional configuration is required. ::: - `properties.turn_detection.config.start_of_speech.{mode}_config` (object) - Start of speech detection configuration parameters. The structure and supported fields vary depending on the detection mode. **Configuration examples:** - `vad_config` ```json "vad_config": { "interrupt_duration_ms": 160, "speaking_interrupt_duration_ms": 160, "prefix_padding_ms": 800 } ``` - `keywords_config` ```json "keywords_config": { "interrupt_duration_ms": 160, "prefix_padding_ms": 800, "triggered_keywords": ["Are you there", "hello"] } ``` - `disabled_config` ```json "disabled_config": { "strategy": "append" } ``` :::info[Note] - The configuration type must match `mode`. For example, when `mode` is `vad`, you must provide `vad_config`. - You cannot provide multiple mode configurations simultaneously. ::: - `properties.turn_detection.config.start_of_speech.{mode}_config.interrupt_duration_ms` (integer) - The amount of time in milliseconds that the user's voice must exceed the VAD threshold before an interruption is triggered. - Default: `160` - `properties.turn_detection.config.start_of_speech.{mode}_config.speaking_interrupt_duration_ms` (integer) - Interruption duration in milliseconds while the agent is speaking. - Default: `160` - `properties.turn_detection.config.start_of_speech.{mode}_config.prefix_padding_ms` (integer) - The extra forward padding time in milliseconds before the processing system starts to process the speech input. This padding helps capture the beginning of speech. - Default: `800` - `properties.turn_detection.config.start_of_speech.{mode}_config.triggered_keywords` (array) - Specifies the list of keywords that trigger an interruption. When the agent detects any of these keywords in the user's speech, it immediately stops its current interaction and processes the new input. - `properties.turn_detection.config.start_of_speech.{mode}_config.triggered_keywords.items` (string) - `properties.turn_detection.config.start_of_speech.{mode}_config.strategy` (string) - Voice processing strategy when the agent is interacting (speaking or thinking): - `append`: Append mode. Human voice does not interrupt the agent. The agent processes the human voice input after the current interaction ends. - `ignore`: Ignore mode. The agent ignores human voice input. If the agent receives human voice while speaking or thinking, the agent discards the input without storing it in context. - Allowed: `append` | `ignore` - `properties.turn_detection.config.end_of_speech` (object) - End of Speech (EoS) detection configuration. Determines when a user ends their speech. - `properties.turn_detection.config.end_of_speech.mode` (string) - End of speech detection mode. Possible values: - `vad`: Based on VAD (Voice Activity Detection). Detects silence duration. - `semantic`: Based on semantic triggering. Uses semantic understanding to determine when conversation ends. - `manual`: Manual EoS mode. Disables automatic end-of-speech detection. The client explicitly signals the end of user speech via RTM. - Allowed: `vad` | `semantic` | `manual` :::info[Note] - When `mode` is `semantic`, EoS detection supports English and Chinese only. For unsupported languages, the engine falls back to VAD. - When `mode` is `manual`, you must also set `advanced_features.enable_rtm = true` and `parameters.data_channel = "rtm"`. This mode does not support `manual_config`; no additional configuration is required. ::: - `properties.turn_detection.config.end_of_speech.{mode}_config` (object) - End of speech detection configuration parameters. The structure and supported fields vary depending on the detection mode. **Configuration examples:** - `vad_config` ```json "vad_config": { "silence_duration_ms": 640 } ``` - `semantic_config` ```json "semantic_config": { "silence_duration_ms": 320, "max_wait_ms": 3000, "pause_state_enabled": true } ``` :::info[Note] - The configuration type must match `mode`. For example, when `mode` is `vad`, you must provide `vad_config`. - You cannot provide multiple mode configurations simultaneously. ::: - `properties.turn_detection.config.end_of_speech.{mode}_config.silence_duration_ms` (integer) - **Default**: `640` in `vad_config`, `320` in `semantic_config` Silence duration threshold in milliseconds. The minimum silence duration at the end of a speech segment, to ensure that a brief pause does not prematurely end the speech segment. - `properties.turn_detection.config.end_of_speech.{mode}_config.max_wait_ms` (integer) - `-1` means forever. Maximum wait time in milliseconds. The maximum time to wait for semantic determination. After timeout, the conversation end is determined based on the current state. - Default: `3000` - `properties.turn_detection.config.end_of_speech.{mode}_config.pause_state_enabled` (boolean) - Whether to detect user intent to pause the conversation: - `true`: The agent uses semantic understanding to determine if the user intends to pause the conversation. For example, when the user's input ends with phrases such as "hold on" or "just a moment", the agent waits for further input rather than treating the utterance as complete and sending it to the LLM. - `false`: The agent does not detect intent to pause the conversation. - Default: `true` - `properties.interruption` (object) - Interruption control configuration. Provides unified management of the agent's behavior when interrupted by the user. :::info[Note] This object has no effect when `mllm.enable` is true. Use [mllm.turn_detection](#request-body-properties-mllm-turn-detection) instead. ::: - `properties.interruption.enable` (boolean) - Whether to enable agent interruption: - `true`: Enable interruption. - `false`: Disable interruption. When disabled, the agent cannot be interrupted mid-response. - Default: `true` - `properties.interruption.mode` (string) - The interruption trigger mode: - `start_of_speech`: Trigger interruption when the user starts speaking. - `keywords`: Trigger interruption when the user speaks a specified keyword. Configure the trigger keywords in `keywords_config`. - Allowed: `start_of_speech` | `keywords` - Default: `start_of_speech` - `properties.interruption.keywords_config` (object) - Configuration for keyword-based interruption triggering. Applicable only when `mode` is `keywords`. - `properties.interruption.keywords_config.trigger_keywords` (array) - The list of keywords that trigger an interruption. A maximum of 128 keywords is supported. - `properties.interruption.keywords_config.trigger_keywords.items` (string) - `properties.interruption.disabled_config` (object) - Configuration for agent behavior when interruption is disabled. Applicable only when `interruption.enable` is `false`. - `properties.interruption.disabled_config.strategy` (string) - The processing strategy when interruption is disabled: - `append`: User speech does not interrupt the agent. The agent processes the user's input after the current interaction ends. - `ignore`: The agent ignores user speech. If the agent receives user speech while speaking or thinking, it discards the input without storing it in context. - Allowed: `append` | `ignore` - `properties.sal` (object) - Selective Attention Locking (SAL) configuration. **(Beta)** - `properties.sal.sal_mode` (string) - Selective attention lock mode. Supports the following options: - `locking`: Speaker Lock Mode. The agent locks onto the speaker, blocking 95% of ambient human voices and noise. You can enable this mode in two ways: - Seamless mode: When a user speaks loudly and clearly at the beginning of a conversation, the intelligent agent automatically recognizes the user as the speaker. - Personalized mode: When creating an agent, a speaker's voiceprint URL is pre-registered through the `sample_urls` field. The agent then locates the speaker based on the pre-registered voiceprint. - `recognition`: Voiceprint recognition mode. You can pre-register only one voiceprint URL using the `sample_urls` field. The agent identifies different speakers and suppresses other background voices and environmental noise. The target speaker is identified through the `vpids` field in the `metadata` field and sent to the LLM. Set `llm.vendor` to "custom" and refer to [Custom LLM](/en/ai/build/custom-model-integration/custom-llm) for instructions on how to make the LLM process speaker information. - Allowed: `locking` | `recognition` - Default: `locking` - `properties.sal.sample_urls` (object) - The registered voiceprint URL as a key-value pair, where the key is the voiceprint name and the value is the download URL for the speaker's voiceprint. Only one voiceprint URL is supported. Example: ```json { "speaker1": "https://example.com/speaker1.pcm" } ``` :::info[Note] - Do not set the incoming voiceprint name to "unknown"; this is a reserved keyword used to identify unknown speakers. - For a registered voiceprint, ensure that: - Size: The voiceprint file does not exceed 2 MB. - Duration: Contains 10 to 15 seconds of audio, with at least 8 seconds of effective audio excluding silent segments. - Format: 16kHz sampling rate, 16-bit depth, mono PCM audio file. The file name extension must be ".pcm". ::: - `properties.labels` (object) - Custom labels in key-value pair format, where the key is the label name and the value is the label value. Enables agents to carry custom business information. These labels are bound to the agent and returned in the `payload` field of all message notification callbacks from the conversational AI engine. Use them to implement custom business logic, such as tagging activity IDs, customer groups, and business scenarios. - `properties.rtc` (object) - RTC media encryption configuration. - `properties.rtc.encryption_key` (string) - The encryption key for RTC media content. The key has no length limit. Agora recommends using a 32-byte key. If no encryption key is set or if the key is empty, built-in encryption is not used. - `properties.rtc.encryption_salt` (string) - The salt value used for encryption. This is a Base64-encoded string that is 32 bytes long after decoding. This parameter only takes effect when `encryption_mode` is set to `7` (`AES_128_GCM2`) or `8` (`AES_256_GCM2`). Ensure that the salt parameter is not empty for these encryption modes. - `properties.rtc.encryption_mode` (integer) - The built-in encryption mode. - `1`: `AES_128_XTS` - 128-bit AES encryption, XTS mode. - `2`: `AES_128_ECB` - 128-bit AES encryption, ECB mode. - `3`: `AES_256_XTS` - 256-bit AES encryption, XTS mode. - `4`: `SM4_128_ECB` - 128-bit SM4 encryption, ECB mode. - `5`: `AES_128_GCM` - 128-bit AES encryption, GCM mode. - `6`: `AES_256_GCM` - 256-bit AES encryption, GCM mode. - `7`: `AES_128_GCM2` - 128-bit AES encryption, GCM mode. Requires setting `encryption_salt`. - `8`: `AES_256_GCM2` - 256-bit AES encryption, GCM mode. Requires setting `encryption_salt`. Agora recommends using either `7` (`AES_128_GCM2`) or `8` (`AES_256_GCM2`) mode. Both modes support cryptographic salts to enhance security. - Allowed: `1` | `2` | `3` | `4` | `5` | `6` | `7` | `8` - `properties.filler_words` (object) - Filler word configuration. Plays filler words while waiting for LLM responses to reduce user anxiety and improve conversation flow. Filler word playback follows these rules: - **Playback order**: When multiple filler words or LLM responses are waiting to be played, they are played in the order they arrive. - **Interruption control**: Inherits the interruption mode setting from the [`interruption`](#request-body-properties-interruption) field. - `properties.filler_words.enable` (boolean) - Whether to enable filler words: - `true`: Enable filler words. - `false`: Disable filler words. - Default: `false` - `properties.filler_words.trigger` (object) - Filler word trigger configuration. Defines when to trigger filler word playback. - `properties.filler_words.trigger.fixed_time_config` (object) - Fixed time trigger configuration. Triggers filler word playback when the LLM response wait time exceeds the threshold. When omitted, the default `1500` ms wait threshold applies. **Configuration example:** ```json "fixed_time_config": { "response_wait_ms": 1500 } ``` - `properties.filler_words.trigger.fixed_time_config.response_wait_ms` (integer) - LLM response wait threshold in milliseconds. Triggers filler word playback when the LLM waits this duration without generating a response, such as when waiting for RAG retrieval or tool call results. - Default: `1500` - `properties.filler_words.content` (object) - Filler word content configuration. Defines the source and selection rules for filler words. - `properties.filler_words.content.mode` (string) - Filler word content mode: - `static` (default): Static filler words. Uses a predefined list of filler words. - `generated`: Generated filler words. Agora-hosted generation produces one filler word phrase based on the current context. If the generated result isn't available in time, the static filler words in `static_config` are used as a fallback. - `properties.filler_words.content.static_config` (object) - Static filler word configuration. Required whenever filler words are enabled. When `mode` is `generated`, this configuration is used as the static fallback for when generation isn't available. :::info[Note] **Static filler word configuration example:** ```json "static_config": { "phrases": [ "Please wait.", "I'm looking into it." ], "selection_rule": "shuffle" } ``` ::: - `properties.filler_words.content.static_config.phrases` (array, required) - List of filler word phrases. **Limits:** - Supports 1 to 100 non-empty strings. - Each phrase supports up to 20 words (Latin scripts) or 20 characters (Chinese and other non-Latin scripts). - Min items: `1` - Max items: `100` - `properties.filler_words.content.static_config.phrases.items` (string) - `properties.filler_words.content.static_config.selection_rule` (string) - Filler word selection rule: - `shuffle`: Random shuffle. Already-used filler words are not repeated until all filler words have been used once. After all filler words are played, they are reshuffled randomly and a new round begins. - `round_robin`: Round-robin. Selects and plays filler words sequentially from the list. After all filler words are played once, a new cycle begins. - Allowed: `shuffle` | `round_robin` - Default: `shuffle` - `properties.filler_words.content.generated_config` (object) - Generated filler word configuration. Only takes effect when `mode` is `generated`. - When `mode` is `generated`, Agora generates a context-relevant filler word phrase in parallel with the main LLM request. - By default, the generator reads only the message that triggered the current turn. Set `context_message_limit` to a value from `2` to `6` to reach further back in the conversation. - If the generated result isn't available by `response_wait_ms`, the static filler words in `static_config` are used as a fallback. - The static filler words are also used as a fallback when the current message has no usable text, the current message can't be located, or the input exceeds the effective capacity of the hosted model. - If you provide `generated_config` while `mode` is `static` or omitted, the request returns `InvalidFieldValue`. - `properties.filler_words.content.generated_config.prompt` (string) - The prompt used to generate the filler word phrase. This field is an optional non-empty string. If provided, it fully replaces Agora's default prompt and applies over the same conversation context window. - `properties.filler_words.content.generated_config.context_message_limit` (integer) - How many of the most recent conversation messages to use to generate the filler word phrase, counting the message that triggered the current turn: - `1` (default): Use only the current turn's message. - `2` to `6`: Reach further back, using earlier user and agent text messages in chronological order up to this limit. - Default: `1` - Range: `[1, 6]` - `properties.filler_words.content.generated_config.history_character_limit` (integer) - Maximum combined characters of the earlier messages in the window. Counts Unicode code points, and doesn't count the current turn's message against the limit: - `0`: Don't limit the earlier messages. The complete input is still bounded by the effective input capacity of the hosted model. - `1` to `10000`: When the text exceeds this limit, the oldest messages in the window are dropped whole. Messages are never truncated. - Default: `1000` - Range: `[0, 10000]` - `properties.parameters` (object) - Agent configuration parameters. - `properties.parameters.silence_config` (object) - Settings related to agent silence behavior. :::info[Note] `silence_config` does not apply when you integrate a `mllm`. ::: - `properties.parameters.silence_config.timeout_ms` (integer) - Specifies the maximum duration (in milliseconds) that the agent can remain silent. After the agent is successfully created and the user joins the channel, any time during which the agent is not listening, thinking, or speaking is considered silent time. When the silent time reaches the specified value, the agent broadcasts a silent reminder message. This feature is useful for prompting users when they become inactive. - `0`: Disables the silent reminder feature. - `(0, 60000]`: Enables the silent reminder. You must also set `content`; otherwise, the configuration is invalid. - Default: `0` - `properties.parameters.silence_config.action` (string) - Specifies how the agent behaves when the silent timeout is reached. Valid values: - `speak`: Uses the TTS module to announce the silent prompt (`content`). - `think`: Appends the silent prompt (`content`) to the context and passes it to the LLM. - Default: `speak` - `properties.parameters.silence_config.content` (string) - Specifies the silent prompt message. The message use depends on the value of `action` parameter. - `properties.parameters.farewell_config` (object) - Graceful hang-up settings for the agent. - `properties.parameters.farewell_config.graceful_enabled` (boolean) - Enable graceful leave: * `true`: Enabled. When enabled, calling the POST method to stop the agent ensures that the agent is in an `IDLE` state before leaving the channel. * `false`: Disabled. - Default: `false` - `properties.parameters.farewell_config.graceful_timeout_seconds` (integer) - Graceful exit timeout (in seconds). Represents the maximum time to wait for the agent to enter an `IDLE` state before exiting the channel. After this time, the agent will exit the channel immediately, even if it is not in an idle state. This field is only effective when `graceful_enabled` is `true`. - Default: `30` - `properties.parameters.data_channel` (string) - Agent data transmission channel: - `rtm`: Use RTM transmission. This configuration takes effect only when `advanced_features.enable_rtm` is `true`. - `datastream`: Use RTC data stream transport. - Default: `datastream` - `properties.parameters.enable_metrics` (boolean) - Whether to receive agent performance data: - `true`: Receive agent performance data. - `false`: Do not receive agent performance data. This setting only takes effect when `advanced_features.enable_rtm` is `true`. See [Listen to agent events](/en/ai/build/handle-runtime-events/webhooks) to learn how to use client components to receive agent performance data. - Default: `false` - `properties.parameters.enable_error_message` (boolean) - Whether to receive agent error events: - `true`: Receive agent error events. - `false`: Do not receive agent error events. This setting only takes effect when `advanced_features.enable_rtm` is `true`. See [Listen to agent events](/en/ai/build/handle-runtime-events/webhooks) to learn how to use client components to receive agent error events. - Default: `false` - `properties.parameters.audio_scenario` (string) - The audio scenario for the RTC channel. - `default`: Maps to `aiserver`. - `chorus`: Real-time chorus scenario, where users have good network conditions and require ultra-low latency. - `aiserver`: Optimized for interactions between the user and the conversational AI agent in terms of latency and network resilience. - Allowed: `default` | `chorus` | `aiserver` - Default: `default` - `properties.parameters.opt_out` (boolean) - Whether to disable data retention for the current session. - `false`: (Default) Data retention is enabled. - `true`: Data retention is disabled. When disabled, session interaction text and audio are not retained, which means troubleshooting, performance review, and agent optimization based on session history will not be available. - Default: `false` :::info[Note] To support service operation, agent optimization, and troubleshooting, session interaction text and audio are temporarily retained for the minimum necessary period by default. If your business has strict security or compliance requirements, enable this setting to prevent session data from being stored. ::: - `preset` (string, deprecated) - Deprecated. Use `credential_mode: "managed"` within the `asr`, `llm`, or `tts` block instead. See [Use managed mode](/en/ai/build/custom-model-integration/managed-mode). A comma-separated string of one or more presets. Each preset provides a predefined configuration for ASR, LLM, and TTS. You can specify a preset for any or all of ASR, LLM, and TTS. When a preset is specified, you do not need to provide the endpoint URL, API key, or model for the preset providers. Use the `asr`, `llm`, and `tts` fields to configure additional settings. ## Request examples ### Basic configuration #### curl ```bash curl --request post \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join \ --header 'Authorization: Basic ' \ --data ' { "name": "unique_name", "properties": { "channel": "channel_name", "token": "token", "agent_rtc_uid": "1001", "remote_rtc_uids": [ "1002" ], "idle_timeout": 120, "llm": { "url": "https://api.openai.com/v1/chat/completions", "api_key": "", "system_messages": [ { "role": "system", "content": "You are a helpful chatbot." } ], "max_history": 32, "greeting_message": "Hello, how can I assist you today?", "failure_message": "Please hold on a second.", "params": { "model": "gpt-4o-mini" } }, "tts": { "vendor": "microsoft", "params": { "key": "", "region": "eastus", "voice_name": "en-US-AndrewMultilingualNeural" } }, "asr": { "language": "en-US" } } }' ``` #### Python ```python import requests import json url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join" headers = {"Authorization": "Basic "} data = { "name": "unique_name", "properties": { "channel": "channel_name", "token": "token", "agent_rtc_uid": "1001", "remote_rtc_uids": ["1002"], "idle_timeout": 120, "llm": { "url": "https://api.openai.com/v1/chat/completions", "api_key": "", "system_messages": [ { "role": "system", "content": "You are a helpful chatbot." } ], "max_history": 32, "greeting_message": "Hello, how can I assist you today?", "failure_message": "Please hold on a second.", "params": { "model": "gpt-4o-mini" } }, "tts": { "vendor": "microsoft", "params": { "key": "", "region": "eastus", "voice_name": "en-US-AndrewMultilingualNeural" } }, "asr": { "language": "en-US" } } } response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.status_code) print(response.json()) ``` #### Node.js ```js const axios = require("axios"); const url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join"; const headers = { "Authorization": "Basic " }; const data = { name: "unique_name", properties: { channel: "channel_name", token: "token", agent_rtc_uid: "1001", remote_rtc_uids: ["1002"], idle_timeout: 120, llm: { url: "https://api.openai.com/v1/chat/completions", api_key: "", system_messages: [ { role: "system", content: "You are a helpful chatbot." } ], max_history: 32, greeting_message: "Hello, how can I assist you today?", failure_message: "Please hold on a second.", params: { model: "gpt-4o-mini" } }, tts: { vendor: "microsoft", params: { key: "", region: "eastus", voice_name: "en-US-AndrewMultilingualNeural" } }, asr: { language: "en-US" } } }; axios .post(url, data, { headers }) .then(response => { console.log("Status:", response.status); console.log("Response:", response.data); }) .catch(error => { console.error("Error:", error.response ? error.response.data : error.message); }); ``` ### Saved agent configuration #### curl ```bash curl -X POST 'https://api.agora.io/api/conversational-ai-agent/v2/projects//join' \ -H 'Content-Type: application/json' \ -H 'Authorization: agora token=""' \ -d '{ "name": "", "pipeline_id": "", "properties": { "channel": "", "token": "", "agent_rtc_uid": "1001", "agent_rtm_uid": "", "remote_rtc_uids": ["1002"], "enable_string_uid": false } }' ``` #### Python ```python import requests import json url = "https://api.agora.io/api/conversational-ai-agent/v2/projects//join" headers = { "Content-Type": "application/json", "Authorization": "agora token=\"\"" } data = { "name": "", "pipeline_id": "", "properties": { "channel": "", "token": "", "agent_rtc_uid": "1001", "agent_rtm_uid": "", "remote_rtc_uids": ["1002"], "enable_string_uid": False } } response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.json()) ``` #### Node.js ```js const url = "https://api.agora.io/api/conversational-ai-agent/v2/projects//join"; const headers = { "Content-Type": "application/json", "Authorization": 'agora token=""' }; const data = { name: "", pipeline_id: "", properties: { channel: "", token: "", agent_rtc_uid: "1001", agent_rtm_uid: "", remote_rtc_uids: ["1002"], enable_string_uid: false } }; fetch(url, { method: "POST", headers: headers, body: JSON.stringify(data) }) .then(response => response.json()) .then(json => console.log(json)) .catch(error => console.error("Error:", error)); ``` ### Advanced configuration #### curl ```bash curl --request POST \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join \ --header 'Authorization: Basic ' \ --data ' { "name": "full_config_agent", "properties": { "channel": "full_channel_name", "token": "full_token_value", "agent_rtc_uid": "12345", "remote_rtc_uids": [ "67890" ], "enable_string_uid": false, "idle_timeout": 180, "advanced_features": { "enable_rtm": true, "enable_sal": true }, "asr": { "language": "en-US", "vendor": "microsoft", "params": { "key": "your_microsoft_key", "region": "eastus", "language": "en-US", "phrase_list": [ "agora", "fengming" ] } }, "tts": { "vendor": "microsoft", "skip_patterns": [ 1, 2 ], "params": { "key": "your_microsoft_key", "region": "eastus", "voice_name": "en-US-AndrewMultilingualNeural", "speed": 1, "volume": 70, "sample_rate": 24000 } }, "llm": { "url": "https://api.openai.com/v1/chat/completions", "api_key": "your_openai_api_key", "system_messages": [ { "role": "system", "content": "You are a professional AI assistant. User name is {{user_name}}." } ], "greeting_message": "Hello {{user_name}}, I am your smart assistant. How can I help you?", "greeting_configs": { "mode": "single_every" }, "failure_message": "Sorry, there was a system problem. Please try again later.", "max_history": 64, "input_modalities": [ "text", "image" ], "output_modalities": [ "text" ], "params": { "model": "gpt-4o", "temperature": 0.8, "max_tokens": 2048, "stream": true }, "template_variables": { "user_name": "John", "company_name": "Agora" } }, "avatar": { "vendor": "heygen", "enable": true, "params": { "api_key": "", "quality": "medium", "agora_uid": "", "agora_token": "", "avatar_id": "", "disable_idle_timeout": false, "activity_idle_timeout": 60 } }, "turn_detection": { "mode": "default", "config": { "speech_threshold": 0.5, "start_of_speech": { "mode": "vad", "vad_config": { "interrupt_duration_ms": 160, "speaking_interrupt_duration_ms": 320, "prefix_padding_ms": 800 } }, "end_of_speech": { "mode": "semantic", "semantic_config": { "silence_duration_ms": 320, "max_wait_ms": 3000 } } } }, "sal": { "sal_mode": "locking", "sample_urls": { "speaker1": "https://example.com/voiceprint1.pcm" } }, "labels": { "campaign_id": "spring_2025", "customer_group": "vip", "region": "eastus" }, "rtc": { "encryption_key": "your_32_byte_encryption_key_here", "encryption_salt": "TsP4fLLyxxxxxxxxxroLA9oE=", "encryption_mode": 8 }, "filler_words": { "enable": true, "trigger": { "fixed_time_config": { "response_wait_ms": 1500 } }, "content": { "mode": "generated", "static_config": { "phrases": [ "Please wait a moment.", "I'm looking into it." ], "selection_rule": "shuffle" }, "generated_config": { "prompt": "Generate a short, natural filler phrase indicating you are processing the request. Do not answer the question directly.", "context_message_limit": 4, "history_character_limit": 1000 } } }, "parameters": { "silence_config": { "timeout_ms": 15000, "action": "think", "content": "User has not responded for an extended period. Please inquire whether continued service is needed." }, "farewell_config": { "graceful_enabled": true, "graceful_timeout_seconds": 60 }, "data_channel": "rtm", "enable_metrics": true, "enable_error_message": true, "opt_out": false } } }' ``` #### Python ```python import requests url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join" payload = { "name": "full_config_agent", "properties": { "channel": "full_channel_name", "token": "full_token_value", "agent_rtc_uid": "12345", "remote_rtc_uids": ["67890"], "enable_string_uid": False, "idle_timeout": 180, "advanced_features": { "enable_rtm": True, "enable_sal": True }, "asr": { "language": "en-US", "vendor": "microsoft", "params": { "key": "your_microsoft_key", "region": "eastus", "language": "en-US", "phrase_list": ["agora", "fengming"] } }, "tts": { "vendor": "microsoft", "skip_patterns": [1, 2], "params": { "key": "your_microsoft_key", "region": "eastus", "voice_name": "en-US-AndrewMultilingualNeural", "speed": 1, "volume": 70, "sample_rate": 24000 } }, "llm": { "url": "https://api.openai.com/v1/chat/completions", "api_key": "your_openai_api_key", "system_messages": [ { "role": "system", "content": "You are a professional AI assistant. User name is {{user_name}}." } ], "greeting_message": "Hello {{user_name}}, I am your smart assistant. How can I help you?", "greeting_configs": { "mode": "single_every" }, "failure_message": "Sorry, there was a system problem. Please try again later.", "max_history": 64, "input_modalities": ["text", "image"], "output_modalities": ["text"], "params": { "model": "gpt-4o", "temperature": 0.8, "max_tokens": 2048, "stream": True }, "template_variables": { "user_name": "John", "company_name": "Agora" } }, "avatar": { "vendor": "heygen", "enable": True, "params": { "api_key": "", "quality": "medium", "agora_uid": "", "agora_token": "", "avatar_id": "", "disable_idle_timeout": False, "activity_idle_timeout": 60 } }, "turn_detection": { "mode": "default", "config": { "speech_threshold": 0.5, "start_of_speech": { "mode": "vad", "vad_config": { "interrupt_duration_ms": 160, "speaking_interrupt_duration_ms": 320, "prefix_padding_ms": 800 } }, "end_of_speech": { "mode": "semantic", "semantic_config": { "silence_duration_ms": 320, "max_wait_ms": 3000 } } } }, "sal": { "sal_mode": "locking", "sample_urls": { "speaker1": "https://example.com/voiceprint1.pcm" } }, "labels": { "campaign_id": "spring_2025", "customer_group": "vip", "region": "eastus" }, "rtc": { "encryption_key": "your_32_byte_encryption_key_here", "encryption_salt": "TsP4fLLyxxxxxxxxxroLA9oE=", "encryption_mode": 8 }, "filler_words": { "enable": True, "trigger": { "fixed_time_config": { "response_wait_ms": 1500 } }, "content": { "mode": "generated", "static_config": { "phrases": ["Please wait a moment.", "I'm looking into it."], "selection_rule": "shuffle" }, "generated_config": { "prompt": "Generate a short, natural filler phrase indicating you are processing the request. Do not answer the question directly.", "context_message_limit": 4, "history_character_limit": 1000 } } }, "parameters": { "silence_config": { "timeout_ms": 15000, "action": "think", "content": "User has not responded for an extended period. Please inquire whether continued service is needed." }, "farewell_config": { "graceful_enabled": True, "graceful_timeout_seconds": 60 }, "data_channel": "rtm", "enable_metrics": True, "enable_error_message": True } } } headers = {"Authorization": "Basic "} response = requests.post(url, json=payload, headers=headers) print(response.text) ``` #### Node.js ```js const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join'; const options = { method: 'POST', headers: {Authorization: 'Basic '}, body: JSON.stringify({ name: 'full_config_agent', properties: { channel: 'full_channel_name', token: 'full_token_value', agent_rtc_uid: '12345', remote_rtc_uids: ['67890'], enable_string_uid: false, idle_timeout: 180, advanced_features: {enable_rtm: true, enable_sal: true}, asr: { language: 'en-US', vendor: 'microsoft', params: { key: 'your_microsoft_key', region: 'eastus', language: 'en-US', phrase_list: ['agora', 'fengming'] } }, tts: { vendor: 'microsoft', skip_patterns: [1, 2], params: { key: 'your_microsoft_key', region: 'eastus', voice_name: 'en-US-AndrewMultilingualNeural', speed: 1, volume: 70, sample_rate: 24000 } }, llm: { url: 'https://api.openai.com/v1/chat/completions', api_key: 'your_openai_api_key', system_messages: [ { role: 'system', content: 'You are a professional AI assistant. User name is {{user_name}}.' } ], greeting_message: 'Hello {{user_name}}, I am your smart assistant. How can I help you?', greeting_configs: {mode: 'single_every'}, failure_message: 'Sorry, there was a system problem. Please try again later.', max_history: 64, input_modalities: ['text', 'image'], output_modalities: ['text'], vendor: 'custom', params: {model: 'gpt-4o', temperature: 0.8, max_tokens: 2048, stream: true}, template_variables: {user_name: 'John', company_name: 'Agora'} }, avatar: { vendor: 'heygen', enable: true, params: { api_key: '', quality: 'medium', agora_uid: '', agora_token: '', avatar_id: '', disable_idle_timeout: false, activity_idle_timeout: 60 } }, turn_detection: { mode: 'default', config: { speech_threshold: 0.5, start_of_speech: { mode: 'vad', vad_config: { interrupt_duration_ms: 160, speaking_interrupt_duration_ms: 320, prefix_padding_ms: 800 } }, end_of_speech: { mode: 'semantic', semantic_config: {silence_duration_ms: 320, max_wait_ms: 3000} } } }, sal: { sal_mode: 'locking', sample_urls: {speaker1: 'https://example.com/voiceprint1.pcm'} }, labels: {campaign_id: 'spring_2025', customer_group: 'vip', region: 'eastus'}, rtc: { encryption_key: 'your_32_byte_encryption_key_here', encryption_salt: 'TsP4fLLyxxxxxxxxxroLA9oE=', encryption_mode: 8 }, filler_words: { enable: true, trigger: {fixed_time_config: {response_wait_ms: 1500}}, content: { mode: 'generated', static_config: {phrases: ['Please wait a moment.', "I'm looking into it."], selection_rule: 'shuffle'}, generated_config: {prompt: 'Generate a short, natural filler phrase indicating you are processing the request. Do not answer the question directly.', context_message_limit: 4, history_character_limit: 1000} } }, parameters: { silence_config: {timeout_ms: 15000, action: 'think', content: 'User has not responded for an extended period. Please inquire whether continued service is needed.'}, farewell_config: {graceful_enabled: true, graceful_timeout_seconds: 60}, data_channel: 'rtm', enable_metrics: true, enable_error_message: true } } }) }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error(err)); ``` ### String UID #### curl ```bash curl --request POST \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join \ --header 'Authorization: Basic ' \ --data ' { "name": "unique_name", "properties": { "channel": "channel_name", "token": "token", "agent_rtc_uid": "friday", "remote_rtc_uids": [ "1002" ], "enable_string_uid": true, "idle_timeout": 120, "llm": { "url": "https://api.openai.com/v1/chat/completions", "api_key": "", "system_messages": [ { "role": "system", "content": "You are a helpful chatbot." } ], "greeting_message": "Hello, how can I help you?", "failure_message": "I'm sorry, I can't answer that question.", "max_history": 32, "params": { "model": "gpt-4o-mini" } }, "asr": { "language": "en-US" }, "tts": { "vendor": "microsoft", "params": { "key": "", "region": "eastus", "voice_name": "en-US-AndrewMultilingualNeural" } } } }' ``` #### Python ```python import requests url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join" payload = { "name": "unique_name", "properties": { "channel": "channel_name", "token": "token", "agent_rtc_uid": "friday", "remote_rtc_uids": ["1002"], "enable_string_uid": True, "idle_timeout": 120, "llm": { "url": "https://api.openai.com/v1/chat/completions", "api_key": "", "system_messages": [ { "role": "system", "content": "You are a helpful chatbot." } ], "greeting_message": "Hello, how can I help you?", "failure_message": "I'm sorry, I can't answer that question.", "max_history": 32, "params": { "model": "gpt-4o-mini" } }, "asr": { "language": "en-US" }, "tts": { "vendor": "microsoft", "params": { "key": "", "region": "eastus", "voice_name": "en-US-AndrewMultilingualNeural" } } } } headers = {"Authorization": "Basic "} response = requests.post(url, json=payload, headers=headers) print(response.text) ``` #### Node.js ```js const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join'; const options = { method: 'POST', headers: {Authorization: 'Basic '}, body: JSON.stringify({ name: 'unique_name', properties: { channel: 'channel_name', token: 'token', agent_rtc_uid: 'friday', remote_rtc_uids: ['1002'], enable_string_uid: true, idle_timeout: 120, llm: { url: 'https://api.openai.com/v1/chat/completions', api_key: '', system_messages: [{role: 'system', content: 'You are a helpful chatbot.'}], greeting_message: 'Hello, how can I help you?', failure_message: 'I'm sorry, I can't answer that question.', max_history: 32, params: {model: 'gpt-4o-mini'} }, asr: {language: 'en-US'}, tts: { vendor: 'microsoft', params: { key: '', region: 'eastus', voice_name: 'en-US-AndrewMultilingualNeural' } } } }) }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error(err)); ``` ### MCP server integration #### curl ```bash curl --request POST \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join \ --header 'Authorization: Basic ' \ --data ' { "name": "unique_name", "properties": { "channel": "channel_name", "token": "token", "agent_rtc_uid": "1001", "remote_rtc_uids": [ "1002" ], "idle_timeout": 120, "llm": { "url": "https://api.openai.com/v1/chat/completions", "api_key": "", "system_messages": [ { "role": "system", "content": "You are a helpful assistant. User name is {{user_name}}, and their account ID is {{account_id}}." } ], "greeting_message": "Hello {{user_name}}, how can I help you?", "failure_message": "Sorry, {{user_name}}, I cannot answer this question. Please try again later.", "max_history": 32, "params": { "model": "gpt-4o-mini" }, "template_variables": { "user_name": "John", "account_id": "ACC123456", "silent_prompt": "If the user does not respond for an extended period, please inquire whether you require continued service." }, "mcp_servers": [ { "name": "mcpserver", "transport": "streamable_http", "endpoint": "https://registry.run.mcp.com.ai/mcp", "allowed_tools": [ "getV01Servers" ], } ] }, "asr": { "language": "en-US" }, "tts": { "vendor": "minimax", "skip_patterns": [ 1 ], "params": { "group_id": "xxxx", "key": "xxxx", "model": "speech-01-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1, "vol": 1, "pitch": 0, "emotion": "happy" }, "audio_setting": { "sample_rate": 16000 } } }, "parameters": { "silence_config": { "timeout_ms": 10000, "action": "think", "content": "{{silent_prompt}}" }, "opt_out": false } } }' ``` #### Python ```python import requests url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join" payload = { "name": "unique_name", "properties": { "channel": "channel_name", "token": "token", "agent_rtc_uid": "1001", "remote_rtc_uids": ["1002"], "idle_timeout": 120, "llm": { "url": "https://api.openai.com/v1/chat/completions", "api_key": "", "system_messages": [ { "role": "system", "content": "You are a helpful assistant. User name is {{user_name}}, and their account ID is {{account_id}}." } ], "greeting_message": "Hello {{user_name}}, how can I help you?", "failure_message": "Sorry, {{user_name}}, I cannot answer this question. Please try again later.", "max_history": 32, "params": { "model": "gpt-4o-mini" }, "template_variables": { "user_name": "John", "account_id": "ACC123456", "silent_prompt": "If the user does not respond for an extended period, please inquire whether you require continued service." }, "mcp_servers": [ { "name": "mcpserver", "transport": "streamable_http", "endpoint": "https://registry.run.mcp.com.ai/mcp", "allowed_tools": ["getV01Servers"] } ] }, "asr": { "language": "en-US" }, "tts": { "vendor": "minimax", "skip_patterns": [1], "params": { "group_id": "xxxx", "key": "xxxx", "model": "speech-01-turbo", "voice_setting": { "voice_id": "English_captivating_female1", "speed": 1, "vol": 1, "pitch": 0, "emotion": "happy" }, "audio_setting": { "sample_rate": 16000 } } }, "parameters": { "silence_config": { "timeout_ms": 10000, "action": "think", "content": "{{silent_prompt}}" } } } } headers = {"Authorization": "Basic "} response = requests.post(url, json=payload, headers=headers) print(response.text) ``` #### Node.js ```js const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join'; const options = { method: 'POST', headers: {Authorization: 'Basic '}, body: JSON.stringify({ name: 'unique_name', properties: { channel: 'channel_name', token: 'token', agent_rtc_uid: '1001', remote_rtc_uids: ['1002'], idle_timeout: 120, llm: { url: 'https://api.openai.com/v1/chat/completions', api_key: '', system_messages: [ { role: 'system', content: 'You are a helpful assistant. User name is {{user_name}}, and their account ID is {{account_id}}.' } ], greeting_message: 'Hello {{user_name}}, how can I help you?', failure_message: 'Sorry, {{user_name}}, I cannot answer this question. Please try again later.', max_history: 32, params: {model: 'gpt-4o-mini'}, template_variables: { user_name: 'John', account_id: 'ACC123456', silent_prompt: 'If the user does not respond for an extended period, please inquire whether you require continued service.' }, mcp_servers: [ { name: 'mcpserver', transport: 'streamable_http', endpoint: 'https://registry.run.mcp.com.ai/mcp', allowed_tools: ['getV01Servers'] } ] }, asr: {language: 'en-US'}, tts: { vendor: 'minimax', skip_patterns: [1], params: { group_id: 'xxxx', key: 'xxxx', model: 'speech-01-turbo', voice_setting: {voice_id: 'English_captivating_female1', speed: 1, vol: 1, pitch: 0, emotion: 'happy'}, audio_setting: {sample_rate: 16000} } }, parameters: { silence_config: {timeout_ms: 10000, action: 'think', content: '{{silent_prompt}}'} } } }) }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error(err)); ``` ### Preset models #### curl ```bash curl --request POST \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join \ --header 'Authorization: Basic ' \ --data ' { "name": "unique_name", "preset": "deepgram_nova_3,openai_gpt_5_mini,minimax_speech_2_6_turbo", "properties": { "channel": "channel_name", "token": "token", "agent_rtc_uid": "1001", "remote_rtc_uids": [ "1002" ], "idle_timeout": 120, "llm": { "system_messages": [ { "role": "system", "content": "You are a helpful chatbot." } ], "max_history": 32, "greeting_message": "Hello, how can I assist you today?", "failure_message": "Please hold on a second." }, "tts": { "vendor": "minimax", "params": { "voice_setting": { "voice_id": "English_captivating_female1" } } }, "asr": { "vendor": "deepgram", "params": { "language": "en", "keyterm": "agora" } } } }' ``` #### Python ```python import requests import base64 app_id = "" credentials = "" url = f"https://api.agora.io/api/conversational-ai-agent/v2/projects/{app_id}/join" headers = { "Authorization": f"Basic {credentials}", "Content-Type": "application/json" } payload = { "name": "unique_name", "preset": "deepgram_nova_3,openai_gpt_5_mini,minimax_speech_2_6_turbo", "properties": { "channel": "channel_name", "token": "token", "agent_rtc_uid": "1001", "remote_rtc_uids": ["1002"], "idle_timeout": 120, "llm": { "system_messages": [ { "role": "system", "content": "You are a helpful chatbot." } ], "max_history": 32, "greeting_message": "Hello, how can I assist you today?", "failure_message": "Please hold on a second." }, "tts": { "vendor": "minimax", "params": { "voice_setting": { "voice_id": "English_captivating_female1" } } }, "asr": { "vendor": "deepgram", "params": { "language": "en", "keyterm": "agora" } } } } response = requests.post(url, headers=headers, json=payload) print(response.status_code) print(response.json()) ``` #### Node.js ```js const appId = ""; const credentials = ""; const url = `https://api.agora.io/api/conversational-ai-agent/v2/projects/${appId}/join`; const payload = { name: "unique_name", preset: "deepgram_nova_3,openai_gpt_5_mini,minimax_speech_2_6_turbo", properties: { channel: "channel_name", token: "token", agent_rtc_uid: "1001", remote_rtc_uids: ["1002"], idle_timeout: 120, llm: { system_messages: [ { role: "system", content: "You are a helpful chatbot." } ], max_history: 32, greeting_message: "Hello, how can I assist you today?", failure_message: "Please hold on a second." }, tts: { vendor: "minimax", params: { voice_setting: { voice_id: "English_captivating_female1" } } }, asr: { vendor: "deepgram", params: { language: "en", keyterm: "agora" } } } }; const response = await fetch(url, { method: "POST", headers: { "Authorization": `Basic ${credentials}`, "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); console.log(response.status); console.log(data); ``` ### Response - If the returned status code is `200`, the request was successful. The response body contains the result of the request. - If the returned status code is not `200`, the request failed. The response body includes the `detail` and `reason` for failure. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure. - The following turn detection configuration is deprecated. To create more natural conversations and reduce unintended interruptions, Agora recommends using the latest version of `turn_detection` above. ## Responses ### 200 The request was successful. The response body contains the result of the request. - `agent_id` (string) - Unique id of the agent instance - `create_ts` (integer) - Timestamp of when the agent was created - `status` (string) - Current status. - `IDLE` (0): Agent is idle. - `STARTING` (1): The agent is being started. - `RUNNING` (2): The agent is running. - `STOPPING` (3): The agent is stopping. - `STOPPED` (4): The agent has exited. - `FAILED` (6): The agent failed to execute. - Allowed: `IDLE` | `STARTING` | `RUNNING` | `STOPPING` | `STOPPED` | `FAILED` ### default The request failed. The response body includes the error details. - `detail` (string) - Detailed error information. - `reason` (string) - The reason for the failure. ## Response examples ### 200 ```json { "agent_id": "1NT29X10YHxxxxxWJOXLYHNYB", "create_ts": 1737111452, "status": "RUNNING" } ``` # Stop a conversational AI agent (/en/api-reference/api-ref/conversational-ai/leave) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Stops a specified Conversational AI agent instance. - OpenAPI: /openapi/conversational-ai/rest-api.en.yaml - Operation ID: stop-agent - Method: POST - Path: /v2/projects/{appid}/agents/{agentId}/leave - Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/leave ## Servers - https://api.agora.io/api/conversational-ai-agent Use this endpoint to stop the specified Conversational AI agent instance. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of the project. - `agentId` (path, required, string) - The agent instance ID you obtained after successfully calling `join` to [Start a conversational AI agent](/en/api-reference/api-ref/conversational-ai/join). ## Request body No request body. ## Request examples ### curl ```bash curl --request POST \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/leave \ --header 'Authorization: Basic ' ``` ### Python ```python import requests url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/leave" headers = { "Authorization": "Basic ", "Content-Type": "application/json" } response = requests.post(url, headers=headers) print(response.text) ``` ### Node.js ```javascript const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/leave'; const options = { method: 'POST', headers: { 'Authorization': 'Basic ', 'Content-Type': 'application/json' } }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error(err)); ``` ### Response - If the returned status code is `200`, the request was successful. The response body is empty. - If the returned status code is not `200`, the request failed. The response body includes the error code and description. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure. ## Responses ### 200 The request was successful. The response body contains the result of the request. No schema. ### default The request failed. The response body includes the error details. - `detail` (string) - Detailed error information. - `reason` (string) - The reason for the failure. # Retrieve a list of agents (/en/api-reference/api-ref/conversational-ai/list) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Retrieves Conversational AI agents that match specified conditions. - OpenAPI: /openapi/conversational-ai/rest-api.en.yaml - Operation ID: get-agent-list - Method: GET - Path: /v2/projects/{appid}/agents - Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents ## Servers - https://api.agora.io/api/conversational-ai-agent Get a list of Conversational AI agents that meet the specified conditions. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of the project. - `channel` (query, optional, string) - The channel to query for a list of agents. - `from_time` (query, optional, number) - The start timestamp (in seconds) for the query. Defaults to `2 hours ago`. - `to_time` (query, optional, number) - The end timestamp (in seconds) for the query. Defaults to the current time. - `state` (query, optional, array) - The agent state to filter by. Specify one or more states as a comma-separated list. For example, `state=0,1,2`. - `0`: `IDLE` Agent is idle. - `1`: `STARTING` The agent is starting. - `2`: `RUNNING` The agent is running. - `3`: `STOPPING` The agent is stopping. - `4`: `STOPPED` The agent has exited. - `6`: `FAILED` The agent failed to execute. - Default: `2` - `limit` (query, optional, integer) - The maximum number of entries returned per page. - Default: `20` - `cursor` (query, optional, string) - The paging cursor, indicating the starting position (`agent_id`) of the next page of results. ## Request body No request body. ## Request examples ### curl ```bash curl --request get \ --url 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents?state=0,1,2&limit=20' \ --header 'Authorization: Basic ' ``` ### Python ```python import requests url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents' params = { 'state': '0,1,2', 'limit': '20' } headers = { 'Authorization': 'Basic ' } response = requests.get(url, headers=headers, params=params) print(response.status_code) print(response.json()) ``` ### Node.js ```javascript const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents?state=0,1,2&limit=20'; const options = { method: 'GET', headers: { 'Authorization': 'Basic ' } }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error(err)); ``` ### Response - If the returned status code is `200`, the request was successful. The response body contains the result of the request. - If the returned status code is not `200`, the request failed. The response body includes the `detail` and `reason` for failure. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure. ## Responses ### 200 The request was successful. The response body contains the result of the request. - `data` (object) - Agent data. - `data.count` (integer) - The number of agents returned. - `data.list` (array) - A list of agents that meets the criteria. - `data.list.items` (object) - `data.list.items.start_ts` (integer) - Agent creation timestamp. - `data.list.items.status` (string) - The current state of the agent. - Allowed: `IDLE` | `STARTING` | `RUNNING` | `STOPPING` | `STOPPED` | `FAILED` - `data.list.items.agent_id` (string) - The agent ID. - `meta` (object) - Returns meta information about the list. - `meta.cursor` (string) - Paging cursor. - `meta.total` (integer) - The total number of agents that meet the query conditions. - `status` (string) - Request status. ### default The request failed. The response body includes the error details. - `detail` (string) - Detailed error information. - `reason` (string) - The reason for the failure. ## Response examples ### 200 ```json { "data": { "count": 1, "list": [ { "start_ts": 1735035893, "status": "RUNNING", "agent_id": "1234567890ABCDE1CVGZNU80BEIN56XF" } ] }, "meta": { "cursor": "", "total": 1 }, "status": "ok" } ``` # Query agent status (/en/api-reference/api-ref/conversational-ai/query) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Retrieves the current status of a specified Conversational AI agent instance. - OpenAPI: /openapi/conversational-ai/rest-api.en.yaml - Operation ID: query-agent-status - Method: GET - Path: /v2/projects/{appid}/agents/{agentId} - Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId} ## Servers - https://api.agora.io/api/conversational-ai-agent Use this endpoint to get the current status of the specified Conversational AI agent instance. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of the project. - `agentId` (path, required, string) - The agent instance ID you obtained after successfully calling `join` to [Start a conversational AI agent](/en/api-reference/api-ref/conversational-ai/join). ## Request body No request body. ## Request examples ### curl ```bash curl --request get \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId \ --header 'Authorization: Basic ' ``` ### Python ```python import requests url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId" headers = {"Authorization": "Basic "} response = requests.get(url, headers=headers) print(response.text) ``` ### Node.js ```javascript const axios = require("axios"); const url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId"; const headers = { Authorization: "Basic " }; axios.get(url, { headers }) .then(response => console.log(response.data)) .catch(error => console.error(error.response ? error.response.data : error.message)); ``` ### Response - If the returned status code is `200`, the request was successful. The response body contains the result of the request. - If the returned status code is not `200`, the request failed. The response body includes the `detail` and `reason` for failure. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure. ## Responses ### 200 The request was successful. The response body contains the result of the request. - `message` (string) - Request message. - `start_ts` (integer) - Agent creation timestamp. - `stop_ts` (integer) - Agent stop timestamp. - `name` (string) - The agent name provided when calling [Start a conversational AI agent](/en/api-reference/api-ref/conversational-ai/join). Unique within a channel. - `status` (string) - Current status. `IDLE` (0): Agent is idle. `STARTING` (1): The agent is being started. `RUNNING` (2): The agent is running. `STOPPING` (3): The agent is stopping. `STOPPED` (4): The agent has exited. `FAILED` (6): The agent failed to execute. - Allowed: `IDLE` | `STARTING` | `RUNNING` | `STOPPING` | `STOPPED` | `FAILED` - `agent_id` (string) - Unique id of the agent instance ### default The request failed. The response body includes the error details. - `detail` (string) - Detailed error information. - `reason` (string) - The reason for the failure. ## Response examples ### 200 ```json { "message": "agent exits with reason: xxxx", "start_ts": 1735035893, "stop_ts": 1735035900, "status": "FAILED", "name": "support_agent_001", "agent_id": "1NT29X11GQSxxxxxNU80BEIN56XF" } ``` # Broadcast a message using TTS (/en/api-reference/api-ref/conversational-ai/speak) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Broadcasts a custom message through the TTS module. - OpenAPI: /openapi/conversational-ai/rest-api.en.yaml - Operation ID: agent-speak - Method: POST - Path: /v2/projects/{appid}/agents/{agentId}/speak - Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/speak ## Servers - https://api.agora.io/api/conversational-ai-agent Use this endpoint to broadcast a custom message using the TTS module. During a conversation with a Conversational AI agent, call this endpoint to immediately broadcast a custom message using the TTS module. Upon receiving the request, Conversational AI interrupts the agent’s speech and thought process to deliver the message. This broadcast can be interrupted by human voice. :::info[Note] The speak API is not supported when using `mllm` configuration. ::: ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of the project. - `agentId` (path, required, string) - The agent instance ID you obtained after successfully calling `join` to [Start a conversational AI agent](/en/api-reference/api-ref/conversational-ai/join). ## Request body - `text` (string, required) - The broadcast message text. The maximum length of the text content is 512 bytes. - `priority` (string) - Sets the priority of the message broadcast. - `INTERRUPT`: High priority. The agent immediately interrupts the current interaction to announce the message. - `APPEND`: Medium priority. The agent announces the message after the current interaction ends. - `IGNORE`: Low priority. If the agent is busy interacting, it ignores and discards the broadcast; the message is only announced if the agent is not interacting. - Allowed: `INTERRUPT` | `APPEND` | `IGNORE` - Default: `INTERRUPT` - `interruptable` (boolean) - Whether to allow users to interrupt the agent's broadcast by speaking: - `true`: Allow - `false`: Don't allow - Default: `true` ## Request examples ### curl ```bash curl --request post \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/speak \ --header 'Authorization: Basic ' \ --data ' { "text": "Sorry, the conversation content is not compliant.", "priority": "INTERRUPT", "interruptable": false }' ``` ### Python ```python import requests url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/speak" payload = { "text": "Sorry, the conversation content is not compliant.", "priority": "INTERRUPT", "interruptable": False } headers = {"Authorization": "Basic "} response = requests.request("post", url, json=payload, headers=headers) print(response.text) ``` ### Node.js ```javascript const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/speak'; const options = { method: 'post', headers: { Authorization: 'Basic ' }, body: JSON.stringify({ text: 'Sorry, the conversation content is not compliant.', priority: 'INTERRUPT', interruptable: false }) }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error(err)); ``` ### Response - If the returned status code is `200`, the request was successful. The response body is empty, and the agent starts to broadcast the specified message. - If the returned status code is not `200`, the request failed. The response body includes the error code and description. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure. ## Responses ### 200 The request was successful. The response body contains the result of the request. - `agent_id` (string) - Unique id of the agent instance. - `channel` (integer) - The name of the channel. - `start_ts` (integer) - Agent creation timestamp. ### default The request failed. The response body includes the error details. - `detail` (string) - Detailed error information. - `reason` (string) - The reason for the failure. ## Response examples ### 200 ```json { "agent_id": "1NT29XxxxxxxxxELWEHC8OS", "channel": "test_channel", "start_ts": 1744877089 } ``` # Status codes and error messages (/en/api-reference/api-ref/conversational-ai/status-codes) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Use HTTP status codes together with the `reason` and `detail` fields in error responses to troubleshoot failed Conversational AI REST API requests. ## HTTP status codes | Status code | Description | Suggested action | | ----------- | ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `200` | OK | The request was successful. | | `400` | Invalid request parameters | Check the `detail` field for specific information. | | `401` | Authentication failed | If you use token authentication, check that the token starts with `007` and was generated with your App ID and App Certificate. If you use Basic HTTP authentication, check the `Authorization` header and credentials. | | `403` | Unauthorized access | Resolve account or billing issues, or contact technical support to activate the service. | | `404` | Agent not found or has exited | Check whether the agent started successfully or has already stopped. | | `409` | Agent conflict | Use the task information returned by the server to continue, or retry with a different agent name. | | `422` | Access limit exceeded | Contact technical support to raise your quota. | | `429` | Request rate limit exceeded | Retry using a backoff strategy. | | `500` | Internal server error | If the problem persists, contact technical support. | | `502` | Gateway error | Contact technical support. | | `503` | Agent startup failure | Retry using a backoff strategy. | | `504` | Request timeout | Retry using a backoff strategy. | ## Error reasons | Reason | Description | | ---------------------------- | ----------------------------------------------------------------------------------------- | | `ServiceNotEnabled` | The service is not enabled for the current project. | | `AccountSuspended` | The account has been suspended and the service is unavailable. | | `InternalError` | Internal error on the server. | | `InvalidPermission` | The service is not activated. | | `InvalidRequestBody` | The request body is not valid JSON. | | `MissingRequiredField` | A required field is missing from the request. | | `InvalidFieldValue` | A request field contains an invalid value. | | `ResourceQuotaLimitExceeded` | Too many concurrent requests, exceeding the quota limit. | | `ConcurrencyLimitExceeded` | Too many concurrent requests, exceeding the quota limit. | | `ServiceUnavailable` | The service is temporarily unavailable. | | `ResourceAllocationFailed` | The required resources cannot be allocated at this time. | | `TaskConflict` | An agent with the same name already exists, or a conflicting task is already running. | | `TaskNotFound` | The task was not started successfully, was aborted after starting, or has been destroyed. | | `TaskOperationTimeout` | Internal error on the server. | | `NotImplemented` | Internal error on the server. | # Send a custom instruction (/en/api-reference/api-ref/conversational-ai/think) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Sends a custom text instruction to a specified Conversational AI agent instance. - OpenAPI: /openapi/conversational-ai/rest-api.en.yaml - Operation ID: agent-think - Method: POST - Path: /v2/projects/{appid}/agents/{agentId}/think - Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/think ## Servers - https://api.agora.io/api/conversational-ai-agent Use this endpoint to send a custom text instruction to the specified Conversational AI agent instance. The instruction is injected into the current conversation pipeline as user input, and the agent processes and responds to it following the standard user input logic. Use this endpoint for the following scenarios: - **Implicit instruction injection**: Inject hidden context or directives into the conversation. - **Client-side event triggering**: Notify the agent of client-side events, such as a user clicking a button. - **Voice and text collaboration**: Combine text instructions with voice input for richer interaction. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of the project. - `agentId` (path, required, string) - The agent instance ID you obtained after successfully calling `join` to [Start a conversational AI agent](/en/api-reference/api-ref/conversational-ai/join). ## Request body - `text` (string, required) - The custom instruction text to inject into the current conversation pipeline. The system processes this as user input. - `on_listening_action` (string) - The action to take when the agent is in a listening state: - `inject`: Inject the custom text instruction into the current turn without interrupting it. - `interrupt`: Immediately interrupt the current flow and initiate a new round of dialogue. - `append`: Don't interrupt the current user input. After the LLM finishes responding to it, append the custom text instruction as a separate user message and initiate a new round of dialogue. - `ignore`: Ignore the request. - Allowed: `inject` | `interrupt` | `append` | `ignore` - Default: `interrupt` - `on_thinking_action` (string) - The action to take when the agent is in a thinking state: - `interrupt`: Interrupt the current state and start a new conversation turn. - `append`: Don't interrupt the current LLM inference. After the current turn's LLM output finishes, append the custom text instruction as a separate user message and start a new conversation turn. - `ignore`: Ignore the request. - Allowed: `interrupt` | `append` | `ignore` - Default: `interrupt` - `on_speaking_action` (string) - The action to take when the agent is in a speaking state: - `interrupt`: Interrupt the current state and start a new conversation turn. - `append`: Don't interrupt the current TTS playback. After the current turn's LLM output finishes, append the custom text instruction as a separate user message and start a new conversation turn. - `ignore`: Ignore the request. - Allowed: `interrupt` | `append` | `ignore` - Default: `ignore` - `interruptable` (boolean) - Whether user speech can interrupt the injected instruction: - `true`: User speech can interrupt the instruction. - `false`: User speech cannot interrupt the instruction. - Default: `true` - `metadata` (object) - Custom metadata in key-value pair format. Use this field to pass additional business information such as identifiers or model references. ## Request examples ### curl ```bash curl --request POST \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/think \ --header 'Authorization: Basic ' \ --header 'Content-Type: application/json' \ --data '{ "text": "The user just clicked the purchase button.", "on_listening_action": "interrupt", "on_thinking_action": "interrupt", "on_speaking_action": "ignore", "interruptable": true, "metadata": { "publisher": "user123", "model": "deepseek-r1" } }' ``` ### Python ```python import requests url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/think" headers = { "Authorization": "Basic ", "Content-Type": "application/json" } payload = { "text": "The user just clicked the purchase button.", "on_listening_action": "interrupt", "on_thinking_action": "interrupt", "on_speaking_action": "ignore", "interruptable": True, "metadata": { "publisher": "user123", "model": "deepseek-r1" } } response = requests.post(url, json=payload, headers=headers) print(response.text) ``` ### Node.js ```javascript const axios = require("axios"); const url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/think"; const headers = { Authorization: "Basic ", "Content-Type": "application/json" }; const payload = { text: "The user just clicked the purchase button.", on_listening_action: "interrupt", on_thinking_action: "interrupt", on_speaking_action: "ignore", interruptable: true, metadata: { publisher: "user123", model: "deepseek-r1" } }; axios.post(url, payload, { headers }) .then(response => console.log(response.data)) .catch(error => console.error(error.response ? error.response.data : error.message)); ``` ### Response - If the returned status code is `200`, the request was successful. The response body contains the result of the request. - If the returned status code is not `200`, the request failed. The response body includes the `detail` and `reason` for failure. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure. ## Responses ### 200 The request was successful. The response body contains the result of the request. - `agent_id` (string) - Unique identifier of the agent instance. - `channel` (string) - The name of the RTC channel where the agent is located. - `start_ts` (integer) - Timestamp indicating when the agent was created. ### default The request failed. The response body includes the error details. - `detail` (string) - Detailed error information. - `reason` (string) - The reason for the failure. ## Response examples ### 200 ```json { "agent_id": "1NT29XxxxxxxxxELWEHC8OS", "channel": "test_channel", "start_ts": 1744877089 } ``` # Query conversation turn information (/en/api-reference/api-ref/conversational-ai/turns) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Retrieves conversation turn information and performance metrics. - OpenAPI: /openapi/conversational-ai/rest-api.en.yaml - Operation ID: get-turns - Method: GET - Path: /v2/projects/{appid}/agents/{agentId}/turns - Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/turns ## Servers - https://api.agora.io/api/conversational-ai-agent After a conversation with the agent ends, use this endpoint to query the conversation turn information, including the start information, end information, and performance metrics of each conversation turn. :::info[Note] You can query sessions within the last 7 days. ::: ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of the project. - `agentId` (path, required, string) - The agent instance ID you obtained after successfully calling `join` to [Start a conversational AI agent](/en/api-reference/api-ref/conversational-ai/join). - `page_index` (query, optional, integer) - The page number. Starts from 1. - Default: `1` - `page_size` (query, optional, integer) - The number of dialogue turns returned per page. - Default: `50` ## Request body No request body. ## Request examples ### curl ```bash curl --request GET \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/turns \ --header 'Authorization: Basic ' ``` ### Python ```python import requests url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/turns" headers = { "Authorization": "Basic ", "Content-Type": "application/json" } response = requests.get(url, headers=headers) print(response.text) ``` ### Node.js ```javascript const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/turns'; const options = { method: 'GET', headers: { 'Authorization': 'Basic ', 'Content-Type': 'application/json' } }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error(err)); ``` ### Response - If the returned status code is `200`, the request was successful. - If the returned status code is not `200`, the request failed. The response body includes the error code and description. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure. ## Responses ### 200 The request was successful. The response body contains the result of the request. - `agent_id` (string) - The unique identifier of the agent. - `name` (string) - The name of the agent. - `channel` (string) - The name of the RTC channel the agent joined. - `total_turn_count` (integer) - The total number of dialogue turns in the current session. - `pagination` (object) - Pagination information. - `pagination.page_index` (integer) - The current page number; starts from 1. - `pagination.total_pages` (integer) - The total number of pages. - `pagination.is_last_page` (boolean) - True if the current page is the last page. - `turns` (array) - A list of conversation turns for the agent session. - `turns.items` (object) - `turns.items.agent_id` (string) - The unique identifier of the agent. - `turns.items.channel` (string) - The name of the RTC channel the agent joined. - `turns.items.turn_id` (number) - The sequential index of the turn within the session. Starts at `1`. - `turns.items.start` (object) - Details about the start of the turn. - `turns.items.start.start_at` (number) - The Unix timestamp in milliseconds (UTC time) when the turn started. - `turns.items.start.type` (string) - The type of event that initiated the turn. - `voice_input`: The turn was initiated by user voice input. - `greeting`: The turn was initiated by an agent greeting. - `silence_timeout`: The turn was initiated due to a silence timeout. - `api_speak`: The turn was initiated by a call to the speak API. - Allowed: `voice_input` | `greeting` | `silence_timeout` | `api_speak` - `turns.items.start.metadata` (object) - Additional context about the turn start event. Included fields depend on the value of the `type` field. - `turns.items.start.metadata.speech_duration_ms` (integer) - The duration of the user's voice input in milliseconds. Included only when `type` is `voice_input`. - `turns.items.start.metadata.interrupt_duration_ms` (integer) - The minimum voice duration in milliseconds required to trigger an interruption. Included only when `type` is `voice_input`. - `turns.items.start.metadata.greeting_nth` (integer) - The index of the current greeting occurrence. Included only when `type` is `greeting`. - `turns.items.start.metadata.action` (string) - The action taken in response to the silence timeout. Included only when `type` is `silence_timeout`. - `speak`: Plays the silence prompt message to the user. - `think`: Appends the silence message to the conversation context and passes it to the LLM. - `turns.items.start.metadata.transport` (string) - The transport protocol used to deliver the speak request. Included only when `type` is `api_speak`. - `http`: Delivered over HTTP. - `rtm`: Delivered through the RTM Presence channel. - `turns.items.end` (object) - Details about the end of the turn. - `turns.items.end.end_at` (number) - The Unix timestamp in milliseconds (UTC time) when the turn ended. - `turns.items.end.type` (string) - The type of event that ended the turn. - `ok`: The turn ended normally. - `interrupted`: The turn was interrupted. - `ignored`: The turn was ignored. - `error`: The turn ended due to an error. - Allowed: `ok` | `interrupted` | `ignored` | `error` - `turns.items.end.metadata` (object) - Additional context about the turn end event. Included fields depend on the value of the `type` field. - `turns.items.end.metadata.playback_duration_ms` (integer) - The audio playback duration in milliseconds. Included when `type` is `ok` or `interrupted`. For an interrupted turn, this is the PCM audio actually played before the interruption, and it doesn't exceed `intended_playback_duration_ms`. - `turns.items.end.metadata.intended_playback_duration_ms` (integer) - The total duration in milliseconds of PCM audio the engine received and scheduled to play for the turn, including queued audio that hadn't played yet. Included only when `type` is `interrupted`. - `turns.items.end.metadata.caused_by` (string) - The cause of the turn ending. When `type` is `interrupted`, possible values are: - `start_of_speech`: A new voice input interrupted the turn. - `api_speak`: The turn was interrupted by a call to the speak API. - `api_interrupt`: The turn was interrupted by a call to the interrupt API. - `api_leave`: The turn was interrupted because the agent left the channel. When `type` is `ignored`, possible values are: - `semantic`: The turn was ignored because semantic end-of-speech detection determined no response was required. Applies when [`turn_detection.config.end_of_speech.mode`](/en/api-reference/api-ref/conversational-ai/join#request-body-properties-turn-detection-config-end-of-speech-mode) is set to `semantic`. - `keywords`: The turn was ignored because the start keyword was not detected. Applies when [`turn_detection.config.start_of_speech.mode`](/en/api-reference/api-ref/conversational-ai/join#request-body-properties-turn-detection-config-start-of-speech-mode) is set to `keywords`. - `disable`: The turn was ignored because interruption is disabled for this turn. - `turns.items.end.metadata.transport` (string) - The transport protocol used to deliver the request. Included only when `caused_by` is `api_speak` or `api_interrupt`. - `http`: Delivered over HTTP. - `rtm`: Delivered through the RTM Presence channel. - `turns.items.end.metadata.reason` (string) - The error type. Included only when `type` is `error`. - `LLM_REQUEST_ERR`: LLM request error. - `INTERNAL_ERR`: Internal error. - `turns.items.end.metadata.details` (string) - Additional error details. Included only when `type` is `error`. - `turns.items.metrics` (object) - Latency metrics for the turn. - `turns.items.metrics.e2e_latency_ms` (integer) - The end-to-end latency in milliseconds for the turn. - `turns.items.metrics.segmented_latency_ms` (array) - A breakdown of latency by segment. - `turns.items.metrics.segmented_latency_ms.items` (object) - `turns.items.metrics.segmented_latency_ms.items.name` (string) - The name of the latency segment. When the LLM input modality is `text`, the returned segments are: - `algorithm_processing`: Algorithm processing delay. - `asr_ttlw`: The ASR Time To Last Word (TTLW) in milliseconds. Represents the delay from when the user finishes speaking to when the ASR module outputs the last word. - `llm_ttft`: The LLM Time To First Token (TTFT) in milliseconds. Represents the delay from when the LLM receives the request to when it outputs the first token. - `llm_ftfs`: The LLM First Token To First Sentence (FTFS) in milliseconds. Represents the delay from when the LLM outputs the first token to when it outputs the first complete sentence. - `tts_ttfb`: The TTS Time To First Byte (TTFB) in milliseconds. Represents the delay from when the TTS module receives a text request to when it outputs the first audio byte. - `transport`: Network transmission delay in milliseconds. Not returned when the user is connected using the RTC Web SDK. When the LLM input modality is `audio`, the returned segments are: - `algorithm_processing`: Algorithm processing delay. - `asr_ttlw`: The ASR Time To Last Word (TTLW) in milliseconds. Represents the delay from when the user finishes speaking to when the ASR module outputs the last word. - `llm_ttfa`: The LLM Time To First Audio Byte (TTFA) in milliseconds. Represents the delay from when the LLM receives a request until it outputs the first audio byte. - `transport`: Network transmission delay in milliseconds. Not returned when the user is connected using the RTC Web SDK. - `turns.items.metrics.segmented_latency_ms.items.latency` (number) - The latency in milliseconds for the segment. ### default The request failed. The response body includes the error details. - `detail` (string) - Detailed error information. - `reason` (string) - The reason for the failure. ## Response examples ### 200 ```json { "agent_id": "A42Axxxxxxxxx37MT56J", "name": "support_agent_001", "channel": "test_channel", "total_turn_count": 250, "pagination": { "page_index": 1, "total_pages": 5, "is_last_page": false }, "turns": [ { "agent_id": "A42Axxxxxxxxx37MT56J", "channel": "test_channel", "turn_id": 1, "start": { "start_at": 1774579820147, "type": "greeting", "metadata": { "greeting_nth": 1 } }, "end": { "end_at": 1774579822412, "type": "interrupted", "metadata": { "caused_by": "api_interrupt", "transport": "rtm", "playback_duration_ms": 1200, "intended_playback_duration_ms": 2400 } }, "metrics": { "e2e_latency_ms": 337, "segmented_latency_ms": [ { "name": "tts_ttfb", "latency": 337 } ] } } ] } ``` # Update agent configuration (/en/api-reference/api-ref/conversational-ai/update) > Documentation: Conversational AI API. > Documentation version: Main. > This document describes only this version. [Version index](/llms/doc-versions-convoai-api-v1.txt). Updates runtime parameters of a Conversational AI agent instance. - OpenAPI: /openapi/conversational-ai/rest-api.en.yaml - Operation ID: agent-update - Method: POST - Path: /v2/projects/{appid}/agents/{agentId}/update - Endpoint: https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/update ## Servers - https://api.agora.io/api/conversational-ai-agent Use this endpoint to adjust Conversational AI agent instance parameters at runtime. ## Authorization This endpoint requires authentication. - `tokenAuth` - `basicAuth` ## Parameters - `appid` (path, required, string) - The App ID of the project. - `agentId` (path, required, string) - The agent instance ID you obtained after successfully calling `join` to [Start a conversational AI agent](/en/api-reference/api-ref/conversational-ai/join). ## Request body - `properties` (object) - `properties.token` (string) - The dynamic key used by the agent to join the RTC channel. If your project has App Certificate enabled, you must provide a valid token. When the agent receives a [`104 agent expire`](/en/ai/reference/event-types#104-agent-expire) event, call this endpoint with a new token to refresh it before it expires. - `properties.llm` (object) - Large Language Model (LLM) settings. - `properties.llm.system_messages` (array) - A set of predefined messages appended to the beginning of each LLM request. These messages help control the LLM’s output and can include role definitions, prompts, response examples, and more. This field must be compatible with the OpenAI protocol. - `properties.llm.system_messages.items` (object) - `properties.llm.params` (object) - Additional LLM information included in the message body, such as the model used, the maximum number of tokens, and more. Supported configurations vary by LLM provider. Refer to the provider’s documentation for details. :::info[Note] Updating this field overwrites the configuration set when the agent was created. When updating, make sure to pass the complete `params` field. ::: - `properties.mllm` (object) - Multimodal Large Language Model (MLLM) configuration for real-time audio and text processing. - `properties.mllm.params` (object) - Additional MLLM configuration parameters. For vendor-specific parameters, see the corresponding MLLM provider page listed in `mllm.vendor`. ## Request examples ### curl ```bash curl --request post \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/update \ --header 'Authorization: Basic ' \ --data ' { "properties": { "token": "007eJxTYxxxxxxxxxxIaHMLAAAA0ex66", "llm": { "system_messages": [ { "role": "system", "content": "You are a helpful assistant. xxx" }, { "role": "system", "content": "Previously, user has talked about their favorite hobbies with some key topics: xxx" } ], "params": { "model": "abab6.5s-chat", "max_token": 1024 } } } }' ``` ### Python ```python import requests import json url = "https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/update" headers = { "Authorization": "Basic ", "Content-Type": "application/json" } data = { "properties": { "token": "007eJxTYxxxxxxxxxxIaHMLAAAA0ex66", "llm": { "system_messages": [ { "role": "system", "content": "You are a helpful assistant. xxx" }, { "role": "system", "content": "Previously, user has talked about their favorite hobbies with some key topics: xxx" } ], "params": { "model": "abab6.5s-chat", "max_token": 1024 } } } } response = requests.post(url, headers=headers, json=data) print(response.status_code) print(response.json()) ``` ### Node.js ```javascript const fetch = require('node-fetch'); const url = 'https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/update'; const headers = { 'Authorization': 'Basic ', 'Content-Type': 'application/json' }; const data = { properties: { token: "007eJxTYxxxxxxxxxxIaHMLAAAA0ex66", llm: { system_messages: [ { role: "system", content: "You are a helpful assistant. xxx" }, { role: "system", content: "Previously, user has talked about their favorite hobbies with some key topics: xxx" } ], params: { model: "abab6.5s-chat", max_token: 1024 } } } }; fetch(url, { method: 'POST', headers: headers, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` ### Response - If the returned status code is `200`, the request was successful. The response body contains the result of the request. - If the returned status code is not `200`, the request failed. The response body includes the `detail` and `reason` for failure. Refer to [status codes](/en/api-reference/api-ref/conversational-ai/status-codes) to understand the possible reasons for failure. ## Responses ### 200 The request was successful. The response body contains the result of the request. - `agent_id` (string) - Unique id of the agent instance - `create_ts` (integer) - Timestamp of when the agent was created - `status` (string) - Current status. - `IDLE` (0): Agent is idle. - `STARTING` (1): The agent is being started. - `RUNNING` (2): The agent is running. - `STOPPING` (3): The agent is stopping. - `STOPPED` (4): The agent has exited. - `FAILED` (6): The agent failed to execute. - Allowed: `IDLE` | `STARTING` | `RUNNING` | `STOPPING` | `STOPPED` | `FAILED` ### default The request failed. The response body includes the error details. - `detail` (string) - Detailed error information. - `reason` (string) - The reason for the failure. ## Response examples ### 200 ```json { "agent_id": "1NT29X10YHxxxxxWJOXLYHNYB", "create_ts": 1737123456, "status": "RUNNING" } ```