Query conversation turn information

Updated

Retrieves conversation turn information and performance metrics.

https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/turns

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.

Note

You can query sessions within the last 7 days.

Path Parameters

appid
*
string

The App ID of the project.

agentId
*
string

The agent instance ID you obtained after successfully calling join to Start a conversational AI agent.

Query Parameters

page_index
?
integer

The page number. Starts from 1.

Default
1
page_size
?
integer

The number of dialogue turns returned per page.

Default
50

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 to understand the possible reasons for failure.

Response Body

application/json

application/json

Response schema

200
application/json

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

agent_id
optional
string

The unique identifier of the agent.

name
optional
string

The name of the agent.

channel
optional
string

The name of the RTC channel the agent joined.

total_turn_count
optional
integer

The total number of dialogue turns in the current session.

pagination
optional
object

Pagination information.

turns
optional
array

A list of conversation turns for the agent session.

default
application/json

The request failed. The response body includes the error details.

detail
optional
string

Detailed error information.

reason
optional
string

The reason for the failure.

Authorization

This endpoint requires authentication.

tokenAuthbasicAuth

Request examples

curl --request GET \
        --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/turns \
        --header 'Authorization: Basic <your_base64_encoded_credentials>'

Response example

{  "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"        }      },      "metrics": {        "e2e_latency_ms": 337,        "segmented_latency_ms": [          {            "name": "tts_ttfb",            "latency": 337          }        ]      }    }  ]}