big-action-73484
11/29/2025, 11:06 PMtall-airline-16756
11/29/2025, 11:06 PMtall-airline-16756
11/29/2025, 11:06 PMwait_for_playout() is an instance method and needs to be called on the RunContext instance passed into your function, not on the RunContext class. In other words, your function must accept ctx: RunContext and you should call await ctx.wait_for_playout().
Example:
@function_tool
async def end_call(self, ctx: RunContext):
"""Called when the user wants to end the call"""
await ctx.wait_for_playout() # wait for agent speech to finish
await hangup_call() # then hang up / delete the room
If your end_call currently has no ctx parameter (or you call RunContext.wait_for_playout() directly), update the signature and call as shown. Would you like me to review your current end_call code if you paste it here?
Sources: Agent speech and audio | LiveKit docs | Agents telephony integration | LiveKit docs