Query conversation turn information

Updated

Retrieves conversation turn information and performance metrics.

GET
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

appidstring
Required

The App ID of the project.

agentIdstring
Required

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

Query Parameters

page_indexinteger

The page number. Starts from 1.

page_sizeinteger

The number of dialogue turns returned per page.

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

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

agent_idstring

The unique identifier of the agent.

namestring

The name of the agent.

channelstring

The name of the RTC channel the agent joined.

total_turn_countinteger

The total number of dialogue turns in the current session.

paginationobject

Pagination information.

turnsarray<object>

A list of conversation turns for the agent session.

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          }        ]      }    }  ]}