Agent class
Represents a LiveKit Agent.
The Agent class models the state of a LiveKit agent within a Session. It exposes information about the agent's connection status, conversational state, and the media tracks that belong to the agent. Consumers should observe Agent to update their UI when the agent connects, disconnects, or transitions between conversational states such as listening, thinking, and speaking.
The associated Participant's attributes are inspected to derive the agent-specific metadata (such as agentState). Audio and avatar video tracks are picked from the agent participant and its associated avatar worker (if any).
- Inheritance
-
- Object
- ChangeNotifier
- Agent
Constructors
- Agent()
Properties
- agentState → AgentState?
-
The current conversational state of the agent.
no setter
- audioTrack → RemoteAudioTrack?
-
The agent's audio track, if available.
no setter
- avatarVideoTrack → RemoteVideoTrack?
-
The agent's avatar video track, if available.
no setter
- canListen → bool
-
Whether the agent can currently listen for user input.
no setter
- error → AgentFailure?
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isBuffering → bool
-
Whether the agent is buffering audio prior to connecting.
no setter
- isConnected → bool
-
Indicates whether the agent is connected and ready for conversation.
no setter
- isFinished → bool
-
Whether the agent finished or failed its session.
no setter
- isPending → bool
-
Whether the agent is pending initialization.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
connected(
RemoteParticipant participant) → void -
Updates the agent with information from the connected
participant. -
connecting(
{required bool buffering}) → void - Marks the agent as connecting.
-
disconnected(
) → void - Marks the agent as disconnected.
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
failed(
AgentFailure failure) → void - Marks the agent as failed.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited