is it only possible to get participant attributes ...
# ask-ai
i
is it only possible to get participant attributes after running ctx.connect or are they available before?
✅ 1
t
Thanks for reaching out, Ed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Good question — you can access participant attributes before
ctx.connect()
. The job
ctx
gives you participant information as soon as the job starts. For example, calling
ctx.wait_for_participant()
returns a
Participant
object whose
attributes
you can read (e.g.,
participant.attributes.get("key")
) before calling
ctx.connect()
. You can also attach a
participant_attributes_changed
listener on the room object prior to connecting to observe updates. If you want, tell me which SDK/language you’re using and I’ll show a short code example. Sources: Job lifecycle | LiveKit Documentation, with interactive elements
i
if i use ctx.wait_for_participant right after ctx.connect() is there a window of time where the participant object might be available but participant attributes wouldnt be?
t
Short answer: no — there isn’t a window where the Participant object exists but its attributes are unavailable. Details: when
ctx.wait_for_participant()
returns a
Participant
, that object already includes
attributes
(you can call
participant.attributes.get("key")
immediately). Attributes can still change afterward, so if you need updates, subscribe to the
participant_attributes_changed
event on the room. If you want, tell me your SDK/language and I’ll show a brief code example. , with interactive elements
i
take a look at issue #2510
t
Thanks — I can look into issue #2510. Could you share a link or paste the issue description (or tell me which repo it’s in)? Also tell me which SDK/language and a short reproduction scenario (steps or code) so I can check whether that issue affects the behavior we discussed. , with interactive elements
i
are you sure that i can call ctx.wait_for_participant before calling ctx.connect? or do i need the room connection to be active
t
Good question — here's a clear answer. You can call
ctx.wait_for_participant()
before `ctx.connect()`; a
Participant
returned by
ctx.wait_for_participant()
includes its
attributes
immediately. You do not need an active room connection to retrieve that participant object or read its attributes. Attributes can still change later, so if you need updates subscribe to the
participant_attributes_changed
event after you have a room (or when you call
ctx.connect()
). If you’re seeing different behavior (e.g., from issue #2510), please paste the issue text or a link and state which SDK/language and a short repro so I can investigate. , with interactive elements