Query conversation turn information

Updated

Retrieves conversation turn information and performance metrics.

gethttps://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.

Default1
page_size#?integer

The number of dialogue turns returned per page.

Default50

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

200application/json

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

agent_id#optionalstring

The unique identifier of the agent.

name#optionalstring

The name of the agent.

channel#optionalstring

The name of the RTC channel the agent joined.

total_turn_count#optionalinteger

The total number of dialogue turns in the current session.

pagination#optionalobject

Pagination information.

turns#optionalarray

A list of conversation turns for the agent session.

defaultapplication/json

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

detail#optionalstring

Detailed error information.

reason#optionalstring

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          }        ]      }    }  ]}
{  "detail": "string",  "reason": "string"}