Retrieve agent history
Updated
Retrieves conversation history for a running Conversational AI agent.
https://api.agora.io/api/conversational-ai-agent/v2/projects/{appid}/agents/{agentId}/historyCall this endpoint while the agent is running to retrieve the conversation history between the user and the Conversational AI agent.
Path Parameters
appidstringThe App ID of the project.
agentIdstringThe agent instance ID you obtained after successfully calling join to Start a conversational AI agent.
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 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_idstringUnique identifier of the agent.
start_tsintegerAgent creation timestamp.
statusstringAgent status. Only supports querying the running agent.
contentsarray<object>Agent history.
rolestringThe message sender.
user: Userassistant: AI agent
contentstringMessage content.
speech_start_msintegerUnix timestamp in milliseconds indicating when the user started speaking or the agent started TTS playback. Only returned when llm.vendor is custom.
speech_end_msintegerUnix timestamp in milliseconds indicating when the user stopped speaking, or when TTS playback completed or was interrupted. Only returned when llm.vendor is custom.
speech_algorithmic_delayintegerThe total delay in milliseconds introduced by audio processing algorithms, including noise reduction, background voice suppression, and voiceprint locking, after audio is captured from the user's microphone. Use this value to align timestamps with cloud recording audio.
Only returned when:
llm.vendoriscustomcontents[].roleisuser- Actual voice input is present
Request examples
curl --request get \ --url https://api.agora.io/api/conversational-ai-agent/v2/projects/:appid/agents/:agentId/history \ --header 'Authorization: Basic <credentials>'Response example
{ "agent_id": "xxxx", "start_ts": 123, "status": "RUNNING", "contents": [ { "role": "user", "content": "hello." }, { "role": "assistant", "content": "hi, how can I help you?" } ]}