AgentParticipant class
Represents an AI agent participant in the room.
AgentParticipant extends Participant and provides agent-specific
functionality such as state tracking (idle, listening, thinking,
speaking) and transcription events.
Agent-specific events:
- Events.agentStateChanged — emitted when the agent's state changes.
- Events.agentTranscriptionReceived — emitted when a transcription segment is received from the agent.
- Events.agentMetrics — emitted when metrics data is received from the agent.
Supported methods: remove, pin, unpin, getVideoStats and getAudioStats. Methods that do not apply to an agent throw an UnsupportedError.
Example
agent.on(Events.agentStateChanged, (AgentState state) {
print('Agent state: ${state.name}');
});
agent.on(
Events.agentTranscriptionReceived,
(TranscriptionSegment segment, Participant participant) {
print('Transcription: ${segment.text}');
},
);
- Inheritance
-
- Object
- Participant
- AgentParticipant
Properties
- displayName ↔ String
-
The display name of the participant who has joined the room.
getter/setter pairinherited
- id ↔ String
-
The unique identifier of the participant who has joined the room.
getter/setter pairinherited
- isLocal ↔ bool
-
Indicates whether this participant is the local participant.
getter/setter pairinherited
-
metaData
↔ Map<
String, dynamic> ? -
Additional metadata associated with the participant.
getter/setter pairinherited
- mode ↔ Mode
-
The participant's current mode.
getter/setter pairinherited
- pinState ↔ ParticipantPinState
-
Represents the current pin state of the participant.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
streams
↔ Map<
String, RTCStream> -
The participant's streams — audio, video and screen share — keyed by
stream id, not by kind.
getter/setter pairinherited
- videoQuality → VideoQuality?
-
The quality requested for this participant with setQuality, or null
if none was set.
no setterinherited
Methods
-
getAgentId(
) → String? -
The unique agent identifier, from the engine or
metaData['agent_id']. -
getAgentState(
) → AgentState - The agent's current state; AgentState.IDLE until it reports one.
-
getAudioStats(
) → List? -
Retrieves real-time audio statistics for the agent participant.
override
-
getTransportStats(
) → Future< Map< String, dynamic> ?> -
Retrieves ICE/DTLS transport statistics for the participant.
inherited
-
getVideoStats(
) → List? -
Retrieves real-time video statistics for the agent participant.
override
-
isAgent(
) → bool -
Always
truefor an AgentParticipant.override -
off(
Events event, Function handler) → void -
Removes a previously registered event listener from this AgentParticipant.
override
-
on(
Events event, Function handler) → void -
Registers an event listener on this AgentParticipant.
override
-
pin(
[PinType pinType = PinType.SHARE_AND_CAM]) → Future< void> -
Pins the agent participant's media streams.
override
-
remove(
) → Future< void> -
Removes the agent participant from the room.
override
-
removeAllEventListeners(
) → void -
Removes every handler added with on.
override
-
unpin(
[PinType pinType = PinType.SHARE_AND_CAM]) → Future< void> -
Unpins the agent participant's media streams.
override