React Native Api Reference - v2.0.0
    Preparing search index...

    Class AgentParticipant

    AgentParticipant is an AI agent in the room.

    Agents and people arrive through the same useRoom onParticipantJoined event and sit in the same participants map, so isAgent is the first place they can be told apart. Branch on it before choosing a hook: useParticipant throws for an agent id, and useAgentParticipant is the one that takes it.

    Prefer useAgentParticipant in a component — it exposes this state as tracked React state plus the agent's own events. This class documents what the raw object carries.

    Index
    agentId: string
    • Id of the agent this participant is an instance of, as configured server-side.

    • Distinguishes which agent joined, where id identifies this particular participant.

    agentState: "IDLE" | "LISTENING" | "THINKING" | "SPEAKING"
    • What the agent is doing right now, one of AgentState.

    • Kept in sync from the agent-state-changed event, which useAgentParticipant surfaces as onAgentStateChanged.

    displayName: string
    • Display name the agent joined with.
    id: string
    • Unique id of this agent participant in the room.
    isAgent: boolean
    • Always true, which is what separates this from a Participant.
    metaData: object
    • Custom metadata attached to this agent participant when it joined.
    micOn: boolean
    • The agent's current microphone status.
    mode: "SEND_AND_RECV" | "SIGNALLING_ONLY" | "RECV_ONLY"
    • How the agent's media behaves. There are 3 types of Mode.
    streams: Map<string, RTCStream>
    • Every RTCStream the agent is currently producing, keyed by stream id.
    webcamOn: boolean
    • The agent's current webcam status.
      • Removes a listener added with on.

      Parameters

      • eventType:
            | "stream-enabled"
            | "stream-disabled"
            | "media-status-changed"
            | "agent-state-changed"
            | "agent-transcription-received"
            | "agent-metrics"

        The event to unsubscribe from.

      • listener: (data: any) => void

        The same function that was passed to on.

      Returns void

      • Subscribes to this agent's own events.

      • The three agent-specific ones are what useAgentParticipant surfaces as onAgentStateChanged, onAgentTranscriptionReceived and onAgentMetrics.

      Parameters

      • eventType:
            | "stream-enabled"
            | "stream-disabled"
            | "media-status-changed"
            | "agent-state-changed"
            | "agent-transcription-received"
            | "agent-metrics"

        The event to subscribe to.

      • listener: (data: any) => void

        Called when the event fires.

      Returns void