onAgentMetrics

open fun onAgentMetrics(metrics: JSONObject)

Called after each conversational turn with the agent's own timings, model choices and the text of the turn. Register it on an AgentParticipant, like onAgentTranscriptionReceived.

The payload is the server's, forwarded as-is, so read defensively:

latencymilliseconds: e2eLatency, ttfb, ttft, sttLatency, eouLatency
providersllmProviderClass/llmModelName, and the same pair for stt and tts
speechuser.text (what the agent heard) and agent.text (what it replied)
systemInstructionsthe prompt the agent is running under