brash-computer-7193
11/27/2025, 5:15 PMlively-winter-88668
11/28/2025, 11:26 AMlively-winter-88668
11/28/2025, 11:30 AMbrash-computer-7193
12/02/2025, 10:02 PMbrash-computer-7193
12/02/2025, 10:04 PMbrash-computer-7193
12/02/2025, 10:05 PMbrash-computer-7193
12/02/2025, 10:05 PMlively-winter-88668
12/03/2025, 9:20 AMbrash-computer-7193
12/08/2025, 3:12 PMbrash-computer-7193
12/08/2025, 3:14 PMlively-winter-88668
12/09/2025, 9:18 AMagent.py you provided at https://gist.github.com/D-sense/e77fe10748d50a477c686d5bd1b76fac, modified it slightly to remove the agent name, and run it in isolation... I was able to hear the agent. Initially I had suspected tts=None, # RealtimeModel has built-in TTS was somehow confusing things, but I didn't need to delete it. I tried running your agent with python agent.py console and also using the agents playground with python agent.py dev then https://agents-playground.livekit.io/.
I recommend reproducing what I did, so you know this isn't an agent code issue. Then double-checking the agent is definitely joining your room (a frequent error is users seeing an agent join their room, but it is actually a previously deployed agent - I'm not saying that's the issue here, I'm just saying it's a common issue 🙂 )
I remember we have an outstanding issue on React native: https://github.com/livekit-examples/agent-starter-react-native/issues/8 - this affects Android emulators, so be aware of that.
Another possibility is an issue with token permissions, perhaps - you could try validating your token at http://www.yepher.com/livekit/validate_token.html to double-check your front-end has the correct permissions.brash-computer-7193
12/10/2025, 3:44 PMbrash-computer-7193
12/10/2025, 3:45 PMError: Cannot read properties of undefined (reading 'digest')brash-computer-7193
12/10/2025, 3:45 PMbrash-computer-7193
12/10/2025, 3:45 PMfunc (c *Client) CreateRoomWithAgentDispatch(roomName string, agentName string, metadata string) (*livekit.Room, error) {
agentDispatch := &livekit.RoomAgentDispatch{
AgentName: agentName,
Metadata: metadata,
}
room, err := c.roomServiceClient.CreateRoom(c.ctx, &livekit.CreateRoomRequest{
EmptyTimeout: 30,
DepartureTimeout: 60 * 60, // duration of 1 hour per session
Name: roomName,
Agents: []*livekit.RoomAgentDispatch{agentDispatch},
})
if err != nil {
if c.logger != nil {
c.logger.Errorw("error creating room with agent dispatch",
"room_name", roomName,
"agent_name", agentName,
"error", err)
}
return nil, err
}
if c.logger != nil {
c.logger.Infow("created room with agent dispatch",
"room_name", roomName,
"room_sid", room.Sid,
"agent_name", agentName)
}
return room, nil
}brash-computer-7193
12/10/2025, 3:46 PMbrash-computer-7193
12/10/2025, 3:46 PMbrash-computer-7193
12/11/2025, 10:57 AMexplicitly dispatch an agent and it joins the room, it waits for about 3 seconds max for a track to be published by the client, if none, it becomes inactive (although, it still remains in the room which is a big issue here) and gets killed by the worker/job-/scheduler/something else. What this means is, if a client fails to join within 3 seconds from when the agent is explicitly dispatched, they might find themselves in a situation where, when they eventually joined the room, they see the agent in the room but can’t hear any audio from the agent; why? because the agent has been marked inactive and has been scheduled to be killed soon. But they will never know!brash-computer-7193
12/11/2025, 11:03 AMexplicit agent dispatch here. So it’s either this is a bad design of how client and agent join a room or a bug that should be fixed (more like, agent should not be allowed to join a room if the client has not joined yet). One solution I thought of this morning [but yet to be implemented] is to split the process of generating token and dispatching agent into 2 steps/endpoints: `step/endpoint 1`: client calls backend to generate token and uses that token to join the room. `step/endpoint 2`: client makes another call to ask for an agent to be dispatched to the room: so backend confirms the client has joined the room and process the explicit agent dispatch request. [this approach i think, might work…I will share more update later today/tomorrow]lively-winter-88668
12/11/2025, 11:40 AMOne solution I thought of this morning [but yet to be implemented] is to split the process of generating token...This seems sensible. Alternatively, did you see this: https://docs.livekit.io/agents/server/agent-dispatch/#dispatch-on-participant-connection
I tried it but it failed withStrange - I haven't tried that tool myself - we have an internal tool for also checking tokens, so I can try there if you have further issuesError: Cannot read properties of undefined (reading 'digest')
brash-computer-7193
12/11/2025, 11:46 AMfunc (c *Client) AccessTokenWithJobMetadata(userId string, grant *auth.VideoGrant, agentName string, metadata string) (string, error) {
// Validate that API key and secret are set
if c.apiKey == "" {
return "", fmt.Errorf("LiveKit API key is not set")
}
if c.secretKey == "" {
return "", fmt.Errorf("LiveKit API secret is not set")
}
at := auth.NewAccessToken(c.apiKey, c.secretKey)
roomConfig := &livekit.RoomConfiguration{
Agents: []*livekit.RoomAgentDispatch{
{
AgentName: agentName,
Metadata: metadata, // This becomes ctx.job.metadata in the agent
},
},
}
at.SetVideoGrant(grant).
SetIdentity(userId).
SetName(userId).
SetRoomConfig(roomConfig).
SetValidFor(time.Hour)
token, err := at.ToJWT()
if err != nil {
return "", fmt.Errorf("failed to generate JWT token: %w", err)
}
return token, nil
}