why is the participant_connected event not firing ...
# ask-ai
w
why is the participant_connected event not firing when using agent playground?
t
Thanks for reaching out, Sunil. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Just a quick heads-up: the
participant_connected
event might not fire in the Agent Playground because the
RoomIO
class filters participants based on certain criteria. This filtering is managed through
RoomInputOptions
when you set up
RoomIO
. To make sure the event triggers for the participants you want, here are a few things you can try: • Adjust `participant_kinds`: You can include participant kinds like
AGENT
if that fits your needs. For example:
Copy code
from livekit import rtc
from livekit.agents.voice.room_io import RoomInputOptions

input_options = RoomInputOptions(
    participant_kinds=[
        rtc.ParticipantKind.PARTICIPANT_KIND_SIP,
        rtc.ParticipantKind.PARTICIPANT_KIND_STANDARD,
        rtc.ParticipantKind.PARTICIPANT_KIND_AGENT  # Include agents
    ]
)
• Set `participant_identity`: If you want the event to fire for a specific participant, just set their identity like this:
Copy code
input_options = RoomInputOptions(
    participant_identity="desired-participant-identity"
)
• Initialize
RoomIO
with options:
When you create your
RoomIO
instance, be sure to pass in the
RoomInputOptions
you configured:
Copy code
room_io = RoomIO(
    agent_session=agent_session,
    room=room,
    input_options=input_options
)
One more thing to keep in mind: make sure the participant connecting doesn’t have the
publish_on_behalf
attribute set to the agent's identity, since those participants get filtered out. Sources: livekit-agents/livekit/agents/voice/room_io/room_io.py