Agent Participant
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
The agent's own identifier, which is separate from the participant id: it names the configured agent, not this run of it.
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.