brainy-continent-98791
09/16/2025, 11:48 AM@session.on("response_done")
def on_response_done(response: openai.realtime.RealtimeResponse):
variant: Literal["warning", "destructive"]
description: str | None = None
title: str
print("on_response_done: %s", response.status)
print("on_response_done: %s", response.status_details)
if response.status == "incomplete":
if response.status_details and response.status_details.get("reason"):
reason = response.status_details["reason"]
if reason == "max_output_tokens":
variant = "warning"
title = "Max output tokens reached"
description = "Response may be incomplete"
elif reason == "content_filter":
variant = "warning"
title = "Content filter applied"
description = "Response may be incomplete"
else:
variant = "warning"
title = "Response incomplete"
else:
variant = "warning"
title = "Response incomplete"
elif response.status == "failed":
if response.status_details and response.status_details.get("error"):
error_code = response.status_details["error"]["code"]
if error_code == "server_error":
variant = "destructive"
title = "Server error"
elif error_code == "rate_limit_exceeded":
variant = "destructive"
title = "Rate limit exceeded"
else:
variant = "destructive"
title = "Response failed"
else:
variant = "destructive"
title = "Response failed"
else:
return
asyncio.create_task(show_toast(title, description, variant))tall-airline-16756
09/16/2025, 11:48 AMtall-airline-16756
09/16/2025, 11:49 AMVoicePipelineAgent or MultimodalAgent with the new AgentSession class, which now acts as a unified agent orchestrator.
• Update your pipeline behavior by incorporating the new llm_node and `tts_node`—these will help you modify chat context and customize the TTS pipeline more effectively.
• Switch to using the @function_tool decorator for defining functions accessible to the LLM, as it replaces the previous @llm.ai_callable decorator.
• Take a fresh look at how you manage chat context, since the API has been redesigned to offer greater flexibility and reliability.
• Adjust your event handling for state changes, keeping in mind that the APIs have been revamped for better performance.
• Don’t forget to check the migration guide for a helpful list of removed features along with their alternatives.
If you'd like detailed instructions and examples, the full migration guide and the code examples are fantastic resources. And of course, if you have any questions or need more support, just let me know—I'm here to help!
Sources: Agents 0.x migration guide | LiveKit Docs | How to Get Help from LiveKit | Agents v0.x migration guide - Node.js | LiveKit Docsbrainy-continent-98791
09/16/2025, 11:51 AMtall-airline-16756
09/16/2025, 11:52 AM@session.on("response_done") isn’t directly supported in LiveKit 1.x. Could you share a bit more about what you’re hoping to achieve with this event? For instance, are you trying to manage response statuses, handle errors, or something else? Understanding this will really help me guide you on the best way to implement it in 1.x. I’m here to help!brainy-continent-98791
09/16/2025, 11:55 AMtall-airline-16756
09/16/2025, 11:56 AM@session.on("response_done") event isn't directly supported, but don't worry—we can still handle response statuses and details using the updated event handling methods. Here's a friendly guide on how you can achieve similar functionality:
• When response.status == "incomplete", take a look at response.status_details for reasons like max_output_tokens or content_filter, and handle them as needed.
• If response.status == "failed", check response.status_details["error"] for error codes such as server_error or rate_limit_exceeded, and respond accordingly.
• For other statuses like cancelled, it’s helpful to log the event ID and response status to assist with debugging.
You can implement this by using the updated APIs to listen for the relevant events and process the response details. If you'd like, I’m here to help with more guidance or even some code examples—just let me know!
Sources: livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real... | plugins/google/src/beta/realtime/realtime_api.tsbrainy-continent-98791
09/16/2025, 11:58 AMtall-airline-16756
09/16/2025, 11:58 AMasync def handle_response_done(response):
if response.status == "incomplete":
reason = response.status_details.get("reason") if response.status_details else None
if reason == "max_output_tokens":
title = "Max output tokens reached"
description = "Response may be incomplete"
elif reason == "content_filter":
title = "Content filter applied"
description = "Response may be incomplete"
else:
title = "Response incomplete"
description = None
variant = "warning"
elif response.status == "failed":
error_code = response.status_details.get("error", {}).get("code") if response.status_details else None
if error_code == "server_error":
title = "Server error"
elif error_code == "rate_limit_exceeded":
title = "Rate limit exceeded"
else:
title = "Response failed"
variant = "destructive"
else:
# Assume "completed", no action needed
return
# Trigger a toast notification or similar UI feedback
await show_toast(title, description, variant)
Feel free to replace show_toast with your own way of displaying notifications or managing the response outcome. If you have any questions or need more help, I’m here for you—just let me know!
Sources: agent/main.py | livekit-plugins/livekit-plugins-inworld/livekit/plugins/inworld/tts.py | linux/flutter/include/flutter/method_result.h | Sources/LiveKit/Protos/livekit_rtc.pb.swift | livekit-protocol/src/livekit.rsbrainy-continent-98791
09/16/2025, 12:00 PMtall-airline-16756
09/16/2025, 12:02 PM