is there a way to tell which participant gets set ...
# ask-ai
l
is there a way to tell which participant gets set as the main participant for the bot?
t
Thanks for reaching out, Daniel. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m replying about which participant becomes the “main” (linked) participant for the bot and how to tell or change who that is. Short answer • By default, the first participant to join the room is set as the linked (main) participant. • You can read which participant is currently linked from the AgentSession’s
RoomIO
via
session.room_io.linked_participant
. How to identify the linked participant 1. After the session starts (Python example):
Copy code
participant = session.room_io.linked_participant
participant
will be the participant the agent is currently interacting with. Ways to set or change the linked participant • Set when starting the session: pass
participant_identity
in
RoomOptions
, e.g.:
Copy code
RoomOptions(participant_identity="user-123")
• Change dynamically at runtime: call `RoomIO.set_participant()`:
Copy code
await session.room_io.set_participant("user-456")
• Fix a specific participant by constructing
RoomIO
with a participant identity and starting it:
Copy code
room_io = RoomIO(session, room=ctx.room, participant="user-123")
await room_io.start()
That setup restricts the agent’s audio processing to that participant. If you want, tell me which SDK/language you’re using and whether you want the linked participant to be chosen automatically or forced to a specific user — I can give the exact code snippet for your setup. Sources: Agent session | LiveKit Documentation | How to set a fixed participant for agent audio processing | LiveKit
l
can i get the room_io object from the Room
t
Thanks — you’re asking whether
room_io
can be retrieved directly from a
Room
object. Good clarification. Short answer • No:
RoomIO
is not retrieved from the
Room
itself.
RoomIO
is created/managed as part of the AgentSession and is accessed from the session via
session.room_io
, not via
room
. What that means for you • You should create or keep a reference to the
RoomIO
instance when you start the agent session (or construct a custom
RoomIO
), and then access it from the session:
Copy code
participant = session.room_io.linked_participant
await session.room_io.set_participant("user-456")
• The
Room
object represents the room state, but it does not expose the
RoomIO
wrapper that handles audio routing and the linked participant logic. If you want • Tell me which SDK/language you’re using (Python, JS, etc.) and whether you’re creating
RoomIO
yourself or relying on the session to create it. I can provide a short code example showing proper creation/usage and how to wire the
Room
,
RoomIO
, and
AgentSession
together.