cuddly-crowd-48028
09/07/2025, 4:49 PMtall-airline-16756
09/07/2025, 4:49 PMtall-airline-16756
09/07/2025, 4:50 PMAgentSession class doesn’t take a room parameter when you create it. Instead, you’ll want to pass the room to the start() method of your AgentSession instance.
Here’s how you can fix it: just create the AgentSession without the room parameter, and then pass the room when you call start(), like this:
session = AgentSession(vad=..., stt=..., llm=..., tts=...)
await session.start(agent=my_agent, room=ctx.room)
Give that a try, and it should sort things out!
Sources: livekit-plugins/livekit-plugins-hedra/livekit/plugins/hedra/avatar.py | pipeline-llm/ollama_llm.pycuddly-crowd-48028
09/07/2025, 4:52 PMtall-airline-16756
09/07/2025, 4:53 PMTR_AMqRTh5cbbehyf, but it can’t find that SID in the local participant's track_publications dictionary. Usually, this happens because of a timing hiccup—where the local_track_published event fires before the publication is fully stored.
Here’s how you can fix it:
1. Use the Event Arguments: When you’re handling the local_track_published event, grab the LocalTrackPublication object that’s passed as an argument instead of reaching into track_publications directly.
2. Verify Track Publication: Double-check that you’re publishing the track with the right SDK method (like publish_track in Python).
3. Check for Premature Access: Make sure your code isn’t trying to access or remove the publication too early.
4. Defensive Programming: To be safe, use track_publications.get(sid) or wrap your code in a try-except block to handle missing keys without a fuss.
Give these a shot, and you should be all set. If you hit any snags, just let me know—I’m here to help!
Sources: examples/basic_room.py | packages/livekit-rtc/src/proto/room_pb.ts | livekit-ffi/protocol/room.proto