I have a video conference with multiagent transcri...
# ask-ai
f
I have a video conference with multiagent transcribers. why do i still get an agent dispatched into the room as a participant? is there any way to make the agent not join as a participant in video conferences?
t
Thanks for reaching out, Gad. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I understand you'd like to prevent an agent from joining as a participant in video conferences with multiagent transcribers. A good approach is to implement application-level filtering. LiveKit helps with this by identifying agents using the specific participant kind
ParticipantKind.AGENT
, so you can easily distinguish them from regular participants in your application logic. For instance, in the
on_participant_connected
method, you can simply skip processing agent participants like this:
Copy code
def on_participant_connected(self, participant: rtc.RemoteParticipant):
    # Skip if the participant is an agent
    if participant.kind == rtc.ParticipantKind.AGENT:
        logger.info(f"Ignoring agent participant: {participant.identity}")
        return

    if participant.identity in self._sessions:
        return

    logger.info(f"starting session for {participant.identity}")
    task = asyncio.create_task(self._start_session(participant))
    self._tasks.add(task)
    # ... rest of the method
Also, a helpful tip is to use token-based permissions to limit what agents can do. For example, setting
canPublish: false
and
canSubscribe: true
in their tokens allows agents to listen to audio without being able to publish. This adds an extra layer of control. If you'd like, I’m here to help you implement these changes or answer any questions you might have. Just let me know! Sources: src/lib/controller.ts | examples/other/transcription/multi-user-transcriber.py | livekit-android-sdk/src/main/java/io/livekit/android/room/participant/Parti... | agent/game_host.py | Node.js Agents Architecture | livekit/livekit_composite | DeepWiki
f
where in my livekit enterypoint code can i tweack the agnet permission
t
I'd be happy to help you tweak agent permissions in your LiveKit entrypoint code! You can easily configure the
permissions
parameter within the
WorkerOptions
when you initialize the agent. This lets you control capabilities like
canPublish
,
canSubscribe
,
canPublishData
, and
canUpdateMetadata
to suit your needs. Here’s a friendly example in Python that shows how to define custom permissions:
Copy code
from livekit.agents import WorkerPermissions, WorkerOptions, cli

permissions = WorkerPermissions(
    can_publish=True,        # Allow publishing audio/video
    can_subscribe=True,      # Allow subscribing to other participants
    can_publish_data=False,  # Disallow sending data messages
    can_update_metadata=True # Allow updating own metadata
)

cli.run_app(WorkerOptions(
    entrypoint_fnc=entrypoint,  # Your entrypoint function
    permissions=permissions
))
Within your entrypoint function, these permissions will be respected. So, for instance, if
canPublish
is set to
False
, any attempts to publish tracks won’t go through. If you’d like, I’m here to walk you through implementing this in your specific setup or answer any questions you might have! Sources: Worker options | LiveKit Docs | Job lifecycle | LiveKit Docs | agent/main.py
f
can i change those permission later on in the enterypoint code?
t
Hey there! Just wanted to share a bit about how agent permissions work in LiveKit. They’re set up at the worker level using the
WorkerOptions
class and, once set, they stay the same throughout the worker’s lifecycle. This means they can’t be changed later within the agent’s entrypoint code, and these permissions apply to all agents created by that worker. If you’re looking to adjust permissions dynamically during a session, the best way is to handle that outside the agent’s entrypoint—like through an external service or an API call using a server SDK. I’m here to help if you want some guidance on how to set this up, just let me know! Sources: Worker options | LiveKit Docs | Authentication | LiveKit Docs
f
can i set agent permission through the room config in the server when generating the token?
t
Hi there! Just to clarify, agent permissions can't be set directly through the room configuration when you're generating a token. Instead, you'll want to define those permissions within the agent's own access token using the
VideoGrant
fields like
canPublish
,
canSubscribe
, and
canPublishData
. This approach gives you more precise control. For example, when you're generating the agent's token, it might look something like this:
Copy code
grant := &auth.VideoGrant{
    RoomJoin:             true,
    Agent:                true,
    Room:                 roomName,
    CanPublish:           true,          // allows publishing tracks
    CanSubscribe:         true,          // allows subscribing to others
    CanPublishData:       true,          // allows sending data messages
    Hidden:               true,          // hides agent from participant list
    CanUpdateOwnMetadata: true           // allows updating its own metadata
}

at := auth.NewAccessToken(apiKey, secret).
    SetVideoGrant(grant).
    SetIdentity("agent-123").
    SetKind("agent").
    ToJWT()
Also, just a quick note: the
RoomConfiguration.agents
field in the participant's token is used only to dispatch the agent to join the room—it doesn’t actually control the permissions. If you have any questions or need a hand with token generation or setting up agent permissions, please don’t hesitate to ask. I’m here to help! Sources: Authentication | LiveKit Docs | app/api/connection-details/route.ts | examples/agent_dispatch.py | client/web/src/app/api/connection-details/route.ts | protobufs/livekit_token_source.proto
f
can you show me how to hide tracks by hiding some tracks sent to the gridlayout
t
I'd love to help you with this! Could you please let me know if you'd like to hide tracks for everyone, just for certain participants, or maybe based on specific details like the type of track or who the participant is? This way, I can make sure to find the best solution for your grid layout. Sources: template-default/src/Room.tsx | Camera & microphone | LiveKit Docs | Subscribing to tracks | LiveKit docs
f
just the agent tracks
t
To help you hide only the agent tracks in the grid layout, a good approach is to filter them out before passing the tracks to your layout component. If you're working with a React-based UI, for example, you can filter the tracks by checking the participant kind or identity like this:
Copy code
const allTracks = useTracks(
  [Track.Source.Camera, Track.Source.ScreenShare, Track.Source.Unknown],
  { onlySubscribed: true }
);

const filteredTracks = allTracks.filter(
  (tr) => tr.participant.kind !== ParticipantKind.AGENT
);

<GridLayout tracks={filteredTracks}>
  <ParticipantTile />
</GridLayout>
In this example, tracks from participants with the kind
ParticipantKind.AGENT
are removed from the grid layout, so they won’t be shown. If you’d like, I’m here to help you step-by-step with implementing this or to answer any other questions you might have!