Start a conversational AI agent

Updated

Creates and starts a Conversational AI agent instance.

POST
https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/join

Use this endpoint to create and start a Conversational AI agent instance.

Path Parameters

appidstring
Required

The App ID of the project.

Request Body

application/json

namestring
Required

The unique identifier of the agent. The same identifier cannot be used repeatedly.

pipeline_idstring

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.

propertiesobject
Required

Configuration details of the agent.

channelstring
Required

The name of the channel to join.

tokenstring
Required

The authentication token used by the agent to join the channel.

agent_rtc_uidstring
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.

remote_rtc_uidsarray<string>
Required

A list of user IDs that the agent subscribes to in the channel. Only subscribed users can interact with the agent.

Note

Currently, only one user ID is supported.

enable_string_uidboolean

Whether to enable String uid:

  • true: Both agent and subscriber user IDs use strings.

  • false: Both agent and subscriber user IDs must be integers.

idle_timeoutinteger

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.

Agent lifecycle best practice

For precise and reliable control over the agent's lifecycle, use the leave API to terminate the agent as soon as its task is complete.

geofenceobject

Regional access restriction configuration. Use this to limit which Agora servers the Conversational AI Engine can access based on geographic regions.

advanced_featuresobject

Advanced features configuration.

asrobject

Automatic Speech Recognition (ASR) configuration.

ttsobject
Required

Text-to-speech (TTS) module configuration.

llmobject
Required

Large language model (LLM) configuration.

mllmobject

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."

avatarobject

Avatar configuration.

turn_detectionobject

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 for details. Agora recommends switching to the latest parameters.

Note

This object has no effect when mllm.enable is true. Use mllm.turn_detection instead.

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 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.

interruptionobject

Interruption control configuration. Provides unified management of the agent's behavior when interrupted by the user.

Note

This object has no effect when mllm.enable is true. Use mllm.turn_detection instead.

salobject

Selective Attention Locking (SAL) configuration. (Beta)

labelsobject

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.

rtcobject

RTC media encryption configuration.

filler_wordsobject

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 field.
parametersobject

Agent configuration parameters.

presetstring
Deprecated

Deprecated. Use credential_mode: "managed" within the asr, llm, or tts block instead. See Use 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.

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 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.

Response Body

The request was successful. The response body contains the result of the request.

agent_idstring

Unique id of the agent instance

create_tsinteger

Timestamp of when the agent was created

statusstring

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.

Authorization

This endpoint requires authentication.

tokenAuthbasicAuth

Request examples

curl --request post \--url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/join \--header 'Authorization: Basic <your_base64_encoded_credentials>' \--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": "<your_llm_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": "<your_tts_api_key>",                "region": "eastus",                "voice_name": "en-US-AndrewMultilingualNeural"            }        },        "asr": {            "language": "en-US"        }    }}'

Response example

{  "agent_id": "1NT29X10YHxxxxxWJOXLYHNYB",  "create_ts": 1737111452,  "status": "RUNNING"}