`@ctx.room.on("track_subscribed")` `def on_tra...
# agents
m
@ctx.room.on("track_subscribed")
def on_track_subscribed(
Copy code
track: rtc.Track,
publication: rtc.RemoteTrackPublication,
participant: rtc.RemoteParticipant,
) -> None:
try:
if  appointment_scheduling_assistant._activity:
logger.warning("[on_track_subscribed] Appointment scheduling assistant is not initialized.")
# Extract session GUID from participant metadata
if participant.metadata:
import json
metadata = json.loads(participant.metadata)
session_guid = metadata.get("sessionGuid")
if session_guid:
logger.info(f"[on_track_subscribed] Session GUID: {session_guid}")
else:
logger.debug("[on_track_subscribed] No session GUID found in metadata.")
# Update user information in the assistant session
user_data = appointment_scheduling_assistant.session.userdata
Hi All ,When I stop the call,I start again in some seconds,Getting error as agent is not runnings ,not able to get the activity,getting error while accessing the agent inside this on_track_subscribed function.After starting the call for the first time it works fine.Please help me to resolve this🙏🏻
l
Have you seen our scheduling agent example at https://github.com/livekit/agents/blob/main/examples/frontdesk/frontdesk_agent.py ? I wonder if
track_subscribed
is the right way to approach this, since I would have expected an approach more similar to that example with standard agent lifecycle and tool calls