narrow-chef-71655
03/02/2026, 7:30 AMERROR:root:e_69a526745fbb5170c342a865: Failed to send session Report: Object of type RealtimeModelBeta is not JSON serializable
report: SessionReport = ctx.make_session_report()
report_dict = to_dict(report)tall-airline-16756
03/02/2026, 7:30 AMtall-airline-16756
03/02/2026, 7:31 AMctx.make_session_report() (or the session/agent state it pulls from) contains a non-serializable object such as a RealtimeModelBeta instance. When to_dict(report) walks the report it attempts to convert every field, including any attached model objects, and JSON serialization fails.
What you can do now
1. Confirm where the model instance is stored
◦ Check session.userdata, any agent attributes, or other objects that the session report collects. Look for a direct reference to RealtimeModelBeta (or other model objects).
◦ If you find it, remove or replace that reference with a serializable identifier (string name, model id, or dict of the properties you need).
1. Build a safe, serializable report object
◦ Instead of blindly calling to_dict(report), extract only the serializable fields you need:
report: SessionReport = ctx.make_session_report()
report_dict = {
"room_name": report.room_name,
"start_time": report.start_time,
"end_time": report.end_time,
"duration": report.duration,
"llm_usage": report.llm_usage, # ensure this is plain data
"status": report.status,
# add only other simple fields you need
}
• If a field like llm_usage contains nested objects, convert those nested parts to primitives before including them.
1. Filter or redact non-serializable fields automatically
◦ Use a helper that strips out non-serializable values (e.g., attempt JSON serialization and drop fields that fail) or recursively replace objects with str(obj) or an identifier.
◦ Example pattern:
import json
def safe_serialize(obj):
try:
json.dumps(obj)
return obj
except (TypeError, OverflowError):
return str(obj) # or return None or an id placeholder
Then map safe_serialize over report fields you may not fully control.
1. Version check
◦ Ensure you are using livekit-agents >= 1.3.0, which added better session report serialization. If you are on an older version, upgrading may prevent some of these issues.
If you'd like, I can help more effectively — please share:
• A short printout of report.__dict__ or report fields (you can redact any sensitive data). That will show which field contains the RealtimeModelBeta.
• Which livekit-agents version you're using.
I can then point to exactly which field to remove or provide a small helper to sanitize your report before to_dict.
Sources: Agent session | LiveKit Documentation | Where to find your Agent Logs | LiveKit | Redacting PII from agent logs and transcripts | LiveKit