rapid-honey-43838
02/12/2026, 10:29 PMtall-airline-16756
02/12/2026, 10:29 PMtall-airline-16756
02/12/2026, 10:30 PMctx.wait_for_participant() does; here's a concise explanation and a short example.
What it does
• ctx.wait_for_participant() pauses the agent’s execution until at least one participant joins the LiveKit room.
• When a participant joins, the method returns that first participant object so the agent can inspect properties (for example identity) or begin interacting with them.
Why you’d use it
• Use this when your workflow needs a real user or participant present before continuing (e.g., to send a greeting, start media operations, or collect participant-specific info).
Simple example
participant = await ctx.wait_for_participant()
print(f"Participant {participant.identity} has joined the room")
# Now you can access participant attributes or start interaction
If you want, tell me whether you need:
• Behavior when multiple participants join (how to track subsequent participants), or
• How to time out or cancel waiting if no one joins within a certain period. Sources: Job lifecycle | LiveKit Documentationrapid-honey-43838
02/12/2026, 10:31 PMtall-airline-16756
02/12/2026, 10:31 PMctx.wait_for_participant() and then checking the participant’s kind, looping until you get a SIP participant. Below are concise examples and a couple of options (looping vs. event-based) so you can pick what fits your workflow.
Python (simple loop)
from livekit import rtc
from livekit.agents import JobContext
async def entrypoint(ctx: JobContext):
while True:
participant = await ctx.wait_for_participant()
if participant.kind == rtc.ParticipantKind.PARTICIPANT_KIND_SIP:
print(f"SIP participant joined: {participant.identity}")
break
# otherwise continue waiting for the next participant
Node.js / TypeScript (simple loop)
import { ParticipantKind } from 'livekit-server-sdk';
export default defineAgent({
entry: async (ctx: JobContext) => {
let participant = await ctx.waitForParticipant();
while (participant.kind !== ParticipantKind.SIP) {
participant = await ctx.waitForParticipant();
}
console.log(`SIP participant joined: ${participant.identity}`);
},
});
Event-based alternative
• Listen for the participant_connected event and inspect participant.kind. This avoids awaiting repeatedly and may be cleaner if you already use room events.
Timeout / cancellation considerations
• If you need to stop waiting after a certain time, add a timeout or cancellation check around the loop so your job doesn’t block indefinitely.
If you’d like, tell me which of these you prefer and:
• Whether you need a timeout example, or
• If you want to filter further using participant metadata or identity (I can show that). Sources: Job lifecycle | LiveKit Documentation | SIP Lifecycle Management Agent | LiveKit Documentation