can two ai agents join the meeting
# ask-ai
s
can two ai agents join the meeting
t
Thanks for reaching out, Mostafa. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Yes, multiple AI agents can join a meeting in LiveKit. The platform supports multi-agent scenarios, allowing multiple agents to connect to the same room as participants. For example, there are use cases like AI camera monitoring where multiple entities, including agents, can join and interact in the same room. If you need further details or examples, feel free to ask! Sources: Agents Overview | LiveKit Docs | Realtime media | LiveKit Docs | Tree View: | dse-workbench
b
I want to add 2 agents in a room where 1 agent only responds to 1 participant and the other agent only responds to the other participant is this possible? any examples to look at?
t
Yes, it is possible to add two agents in a room where each agent responds to a specific participant. Here are two approaches you can use: 1. Setting a Fixed Participant for Audio Processing: You can specify which participant's audio track the agent should process by using the
RoomIO
constructor. For example:
Copy code
session = AgentSession(llm=openai.realtime.RealtimeModel())
room_io = RoomIO(session, room=ctx.room, participant="participant-identity")
await room_io.start()
await session.start(agent=MyAgent())
This ensures the agent only processes audio from the specified participant identity. 2. Explicit Agent Dispatch on Participant Connection: You can configure a participant's token to dispatch specific agents when they connect. For example:
Copy code
from livekit.api import (
    AccessToken,
    RoomAgentDispatch,
    RoomConfiguration,
    VideoGrants,
)

room_name = "my-room"
agent_name = "test-agent"
def create_token_with_agent_dispatch() -> str:
    token = (
        AccessToken()
        .with_identity("my_participant")
        .with_grants(VideoGrants(room_join=True, room=room_name))
        .with_room_config(
            RoomConfiguration(
                agents=[
                    RoomAgentDispatch(agent_name="test-agent", metadata='{"user_id": "12345"}')
                ],
            ),
        )
        .to_jwt()
    )
    return token
This approach allows you to dispatch specific agents to handle particular participants. Let me know if you need further assistance or additional examples!