enough-match-43171
12/16/2025, 11:54 AMtall-airline-16756
12/16/2025, 11:54 AMtall-airline-16756
12/16/2025, 11:54 AMenough-match-43171
12/16/2025, 11:55 AMtall-airline-16756
12/16/2025, 11:55 AMsessionId.
a. Example:
curl -H "Authorization: Bearer $TOKEN" \
"<https://cloud-api.livekit.io/api/project/$PROJECT_ID/sessions>"
• From server-side room/job context: in Agents JobContext you can access room identifiers (e.g., ctx.job.room.name or ctx.room.name) to correlate with sessions.
• From session/detail endpoints or participant lists: session details and participant connection timestamps returned by the analytics/session endpoints let you correlate participants or tracks to a specific sessionId.
Would you like the exact Analytics API response format or help locating the sessionId for a specific project or job?
Sources: Analytics API | LiveKit docs | Job lifecycle | LiveKit docsenough-match-43171
12/16/2025, 11:57 AMtall-airline-16756
12/16/2025, 11:58 AMenough-match-43171
12/16/2025, 11:58 AMtall-airline-16756
12/16/2025, 11:59 AMsessionId. Use the session list at session start and the session detail endpoint after end to get sessionId, start/end times, and final metadata.
◦ Example:
curl -H "Authorization: Bearer $TOKEN" \
"<https://cloud-api.livekit.io/api/project/$PROJECT_ID/sessions>"
• Correlate from agent/job context: In Agents, use JobContext (e.g., ctx.room.name or ctx.job.room.name) to identify the room; then query the Analytics API to find the matching sessionId. Agents also expose lifecycle hooks (e.g., AgentSession close event) you can use to trigger the lookup at session end.
• Room lifecycle events: Listen for room disconnection reasons such as ROOM_CLOSED (emitted when all participants leave). When that event fires, query the Analytics session detail for the room to obtain the sessionId and end timestamp.
Do you want a short script to call the Analytics API and map roomName to sessionId, or help wiring this into your agent/session event handler?
Sources: Analytics API | LiveKit docsenough-match-43171
12/16/2025, 12:03 PMtall-airline-16756
12/16/2025, 12:03 PMctx.make_session_report().
◦ Defined via: @server.rtc_session(on_session_end=...).
◦ Use it to: Save analytics, export transcripts, or persist session-level records.
• Shutdown callback (Python & Node.js)
◦ Trigger: Runs after session.shutdown() / ctx.shutdown() when the session is closing, before the process exits. The framework waits (default up to 60s) for these callbacks to finish.
◦ Purpose: Cleanup resources — close DB connections, flush logs, save transient state.
◦ Access: Session is already closing; less direct access to live session internals.
◦ Defined via: ctx.add_shutdown_callback(...).
◦ Use it to: Ensure graceful cleanup and resource release.
How they fit together:
• In Python you can use both: on_session_end to generate/export the final session report, then shutdown callbacks to perform cleanup.
• In Node.js use shutdown callbacks for cleanup since on_session_end is not available.
Would you like a short Python example showing both wired together?
Sources: Job lifecycle | LiveKit docs | Observability data hooks | LiveKit docs