Skip to content

[wip] Add session observability with tags and LLM-based evals - #101

Draft
bcherry wants to merge 5 commits into
mainfrom
claude/admiring-albattani-sxwxyk
Draft

bcherry wants to merge 5 commits into
mainfrom
claude/admiring-albattani-sxwxyk

Conversation

@bcherry

@bcherry bcherry commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds comprehensive session observability to the agent by implementing session end callbacks that tag conversations and evaluate quality using LLM-as-judge verdicts.

Key Changes

  • New on_session_end callback: Implements session lifecycle observability with:

    • Automatic success/failure tagging based on conversation engagement (3+ messages threshold)
    • LLM-based evaluation using built-in judges (safety, relevancy, conciseness)
    • Graceful handling of sessions that fail during setup
  • Judge integration: Evaluates every session using JudgeGroup with three production-ready judges:

    • safety_judge() - Ensures responses are safe and appropriate
    • relevancy_judge() - Validates response relevance to user queries
    • conciseness_judge() - Checks response conciseness
  • Session registration: Wires the callback into the agent via on_session_end parameter in @server.rtc_session decorator

  • Documentation update: Enhanced README to explicitly mention session tags and production evals as key features

Implementation Details

  • Session reports are safely generated with error handling for sessions that never started
  • Chat history is filtered to exclude function calls and system instructions for meaningful engagement detection
  • Each judge verdict is automatically tagged as lk.judge.<name> for filtering and analysis in LiveKit Cloud
  • The implementation follows the production evals pattern documented in LiveKit's observability guide

https://claude.ai/code/session_01Mkt7G86CNXSTmhRrwHcL2A

claude and others added 5 commits June 15, 2026 22:41
Wire an on_session_end callback that tags the session outcome via
ctx.tagger and points to the Agent Observability tags and evals docs.

https://claude.ai/code/session_01Mkt7G86CNXSTmhRrwHcL2A
The on_session_end handler previously demonstrated only heuristic outcome
tagging (chat length). Add a JudgeGroup running safety, coherence, and
conciseness judges to also demonstrate production evals — verdicts are
auto-tagged as lk.judge.<name>. Judging is gated behind the engagement
check so empty sessions don't incur a model call.
Per review: judges should run unconditionally (not gated behind the
engagement heuristic), and relevancy fits a general assistant better
than coherence. Swap coherence_judge -> relevancy_judge and remove the
early return so the JudgeGroup evaluates every session. Outcome tagging
(success/fail) is unchanged.
@bcherry bcherry changed the title Add session observability with tags and LLM-based evals [wip] Add session observability with tags and LLM-based evals Sep 17, 2026
@bcherry
bcherry marked this pull request as draft September 17, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants