Hello. We are experiencing an issue with controlli...
# agents
m
Hello. We are experiencing an issue with controlling the visibility of an LiveKit Agent. We want to hide the agent from the screen, so we set the hidden option to True in the permissions. However, when we test it, the agent still appears on the screen as a participant about 50% of the time. Could you let us know if any additional configuration is required?
Copy code
if __name__ == "__main__":
    agents.cli.run_app(
        agents.WorkerOptions(
            entrypoint_fnc=entrypoint,
            agent_name="test-agent",
            permissions=agents.WorkerPermissions(
                can_publish=False,
                can_subscribe=True,
                can_publish_data=False,
                can_publish_sources=[],
                hidden=True,
            )
        )
    )
ListParticipant API Response says that Agent hidden option is set to True.
Copy code
2025/11/28 11:14:48   - Participants (3):
2025/11/28 11:14:48     [1] Participant Details:
2025/11/28 11:14:48       * SID: PA_pYMBfL7fM56C
2025/11/28 11:14:48       * Identity: agent-AJ_r6BFTriEXekj
2025/11/28 11:14:48       * Name: 
2025/11/28 11:14:48       * State: ACTIVE
2025/11/28 11:14:48       * Joined At: 2025-11-28 11:14:20 JST (1764296060)
2025/11/28 11:14:48       * Is Publisher: false
2025/11/28 11:14:48       * Permission: hidden:true
2025/11/28 11:14:48       * Region: otokyo1b
2025/11/28 11:14:48       * Metadata: 
2025/11/28 11:14:48       * Tracks: None
l
Are you able to reproduce this with our meet example? https://github.com/livekit-examples/meet
m
Thanks, I will try that.
@lively-winter-88668 I reproduced it, and the issue still exists. The item in the upper-right corner is the LiveKit Agent.
Sometimes it is displayed, and other times it is not.
l
It's strange, you are setting hidden in the code of your worker agent and so this should not be visible to others in the room. I tried again this morning but still couldn't reproduce - the one difference from your setup is that I was not using explicit dispatch, but that should not matter.
m
@lively-winter-88668 So, you think that the fact that the hidden option is not working is not a bug, and that there is likely some kind of misconfiguration on our side?
I also tried the plane javascript sdk, but the same issue occued. https://github.com/livekit/client-sdk-js
l
So, you think that the fact that the hidden option is not working is not a bug, and that there is likely some kind of misconfiguration on our side?
It's difficult to say without being able to reproduce the issue - I also don't see other reports of this issue, nor do I see anything obvious in the server logs associated with that screenshot you sent above. Wait, I thought you were on our build tier pricing, but now I'm not so sure... are you on scale tier?
m
We've been Ship tier.
And use Kubernetes (Amazon EKS) for deploying LiveKit Agent.
l
.
r
What version of agents libs are you running?
pip freeze |grep livekit
or
uv pip freeze |grep livekit
Also which Avatar service are you using? I don't believe we added the hide agent functionality to the meet app. Can you test with Agent Playground instead?
Have you reviewed this part of the guide for how to select with audio/video stream to render on the client? https://docs.livekit.io/agents/models/avatar/#avatar-workers
Also, how did you end up with the code in your agent
hidden=True
was that in an example somewhere? You should not need that unless I am mis-understanding your usecase. You should remove that.
q
@magnificent-petabyte-38524 Hi Togo, this is me testing on my side using Anam and not seeing the issue that you are suggesting, the 1st picture is the play ground and the 2nd picture from the nextjs react app. questions: 1. which avatar service you are using? Anam/Tavus/Bey? 2. what s the exact set up?
replicated the issue with the meet app (I think this app is outdated though). @magnificent-petabyte-38524 looking forwards to hear what custom set up you got at your end
m
@refined-appointment-81829
pip freeze |grep livekit
Copy code
livekit==1.0.12
livekit-agents==1.2.1
livekit-api==1.0.4
livekit-blingfire==1.0.0
livekit-protocol==1.0.4
Have you reviewed this part of the guide for how to select with audio/video stream to render on the client?
Not, yet. So there are two participants, the Agent and the Agent Worker, participating in the room.
@refined-appointment-81829 @quaint-ambulance-32873 I’m not using the plugin provided by the LiveKit Agent; instead, I’m using another avatar service (I can’t disclose the service name due to confidentiality). Using the LiveKit Agent, I forward the user’s audio to the avatar service via websocket. The audio and video generated by the avatar service are then displayed in the room via LiveKit Ingress.
@quaint-ambulance-32873
looking forwards to hear what custom set up you got at your end.
Let me share my frontend code using React SDK. I managed to hide the LiveKit Agent by filtering its tracks. However, I believe this is not the method the LiveKit development team intends or recommends.
Copy code
....
....  
....
  return (
    <RoomContext.Provider value={room}>
      <div data-lk-theme="default" style={{ height: '100vh' }}>
        <MyVideoConference />
        <RoomAudioRenderer />
        <ControlBar />
      </div>
    </RoomContext.Provider>
  );
}

function MyVideoConference() {
  const tracks = useTracks(
    [
      { source: Track.Source.Camera, withPlaceholder: true },
      { source: Track.Source.ScreenShare, withPlaceholder: false },
    ],
    { onlySubscribed: false },
  );

  // Filter out tracks from LiveKit Agents (IDs starting with "agent")
  const filteredTracks = tracks.filter(
    (track) => !track.participant.identity.startsWith('agent')
  );

  return (
    <GridLayout tracks={filteredTracks} style={{ height: 'calc(100vh - var(--lk-control-bar-height))' }}>
      <ParticipantTile />
    </GridLayout>
  );
}
Also, let me share my
agent.py
code. Like I said, this agent is responsible only for streaming the individual participants’ audio and the mixed room audio over WebSocket. (It has lots of Japanese comments, sorry...)
Dispatch the agent from Go server.
Copy code
// Dispatch LiveKit Agent
		dispatchClient := lksdk.NewAgentDispatchServiceClient(
			lkApiUrl,
			lkApiKey,
			lkApiSecret,
		)

		type agentMeta struct {
			RoomName  string `json:"room_name"`
			OutputURL string `json:"output_url"`
			AvatarID  string `json:"avatar_id,omitempty"`
			PrivateIP string `json:"private_ip,omitempty"`
		}
		metaBytes, _ := json.Marshal(agentMeta{
			RoomName: roomName, OutputURL: req.OutputURL, AvatarID: req.AvatarID, PrivateIP: ec2.PrivateIPAddress,
		})
		agentReq := &livekit.CreateAgentDispatchRequest{
			Room: roomName, AgentName: "test-agent", Metadata: string(metaBytes),
		}

		dispatch, err = dispatchClient.CreateDispatch(lockCtx, agentReq)
		if err != nil {
			u.rollbackCreateLiveKitRoom(lockCtx, ec2, roomName, ingress, roomModel)
			return apperr.NewError(
				apperr.InternalError,
				err,
			)
		}
q
@magnificent-petabyte-38524 I think doing the filtering on the frontend is a decent solution as it look like we are doing something similar on our standard nextjs-starter example and it would be the approach I would use personally too.
m
It's correct that the filtering on the front end — understood. Thank you also for the sample code.