Skip to main content

Connect your agent

After publishing your agent, you can integrate it into your applications using the Conversational AI Engine API. The Embed option in Studio provides a pre-configured API call with your agent's identifiers already populated.

Prerequisites

Get the embed code

To get the API call for your agent:

  1. In Agent Studio, select Agents from the sidebar.
  2. From the agent list, open the Actions menu for your agent and select Embed Agent.
  3. Copy the generated code snippet. It includes your agent's name, pipeline_id, channel settings, and a valid RTC token.

Use this as the starting point for integrating the agent into your backend service. For full API reference, see Start a conversational AI agent.

Authentication

This endpoint requires Basic Auth. Generate a Base64-encoded credential with your Customer ID and Customer Secret. The generated code snippet includes an RTC token under properties which is valid for 24 hours.

Sample code

The following examples show how to start an agent call using your embed credentials. Replace <BASE64_ENCODED_CREDENTIALS> with your Base64-encoded Agora Customer ID and Customer secret.


_14
curl --request POST \
_14
--url https://api.agora.io/api/conversational-ai-agent/v2/projects/<appid>/join \
_14
--header 'Authorization: Basic <BASE64_ENCODED_CREDENTIALS>' \
_14
--header 'Content-Type: application/json' \
_14
--data '{
_14
"name": "<agent_name>",
_14
"pipeline_id": "<pipeline_id>",
_14
"properties": {
_14
"channel": "<channel_name>",
_14
"agent_rtc_uid": "<agent_rtc_uid>",
_14
"remote_rtc_uids": ["*"],
_14
"token": "<token>"
_14
}
_14
}'

About pipeline_id

The pipeline_id in the embed code is the internal identifier for your published agent configuration. It is automatically populated when you copy the embed code from the Embed Agent option in Studio.

See also