AgentParticipant

An AI agent that has joined the room as an ordinary participant.

An agent arrives through the normal participant path: it appears in Room.participants and fires onParticipantJoined like anyone else. isAgent tells it apart from a human participant:

override fun onParticipantJoined(participant: Participant) {
val agent = participant as? AgentParticipant ?: return
agent.addEventListener(object : ParticipantEventListener() {
override fun onAgentStateChanged(agentState: AgentState) {
showThinkingIndicator(agentState == AgentState.THINKING)
}
})
}

Reading an agent works like reading any participant — Participant.displayName, Participant.metaData, its streams, its audio and video stats. Controlling one does not: an agent's media is driven by the agent service, so enableMic, disableMic, enableCam, disableCam, setQuality, captureImage and getShareStats throw UnsupportedOperationException here.

Functions

Link copied to clipboard
open suspend override fun captureImage(width: Int, height: Int, flash: CaptureFlash): String
Link copied to clipboard
open suspend override fun disableCam()
Link copied to clipboard
open suspend override fun disableMic()
Link copied to clipboard
open suspend override fun enableCam()
Link copied to clipboard
open suspend override fun enableMic()
Link copied to clipboard

The agent's own identifier, which is separate from the participant id: it names the configured agent, not this run of it.

Link copied to clipboard

The agent's last reported AgentState. Starts at AgentState.IDLE and is updated just before onAgentStateChanged fires, so reading it from that callback already gives the new value.

Link copied to clipboard
open override fun getShareStats(): JSONObject?
Link copied to clipboard
open override fun isAgent(): Boolean

Always true, which is what tells this participant apart from a human one.

Link copied to clipboard
open suspend override fun setQuality(quality: VideoQuality)