Skip to main content
Session annotations attach feedback to multi-turn conversations or threads. Use them for conversation-level quality signals: whether the session achieved its goal, whether a human handoff was needed, overall satisfaction scores. All functions are imported from @arizeai/phoenix-client/sessions. See Annotations for the shared annotation model and concepts.
Requires Phoenix Server ≥ 12.0.0. The client will throw an error with the minimum required version if the server is too old.

Relevant Source Files

  • src/sessions/addSessionAnnotation.ts for the single-annotation API
  • src/sessions/logSessionAnnotations.ts for batch logging
  • src/sessions/types.ts for the SessionAnnotation interface

Add A Single Session Annotation

Mark a support session as resolved after human review:

Batch Log Session Annotations

Use logSessionAnnotations to annotate multiple sessions in a single request. This example scores a batch of support sessions for handoff detection:

Conversation Quality Scoring

After a multi-turn conversation ends, use an LLM to evaluate overall coherence and goal completion:

End-User Satisfaction (CSAT)

Log customer satisfaction at the end of a chat session. Normalize the raw rating to a 0–1 scale for consistent scoring:

Idempotent Upserts With identifier

Session annotations are unique by (name, sessionId, identifier). The identifier field controls whether a write creates a new annotation or updates an existing one. Without identifier, a session can only have one annotation per name. Adding an identifier lets you store multiple annotations with the same name on the same session, each keyed by a different identifier. Re-sending the same tuple updates that specific annotation in place.

Parameter Reference

SessionAnnotation

*At least one of label, score, or explanation is required.

Source Map

  • src/sessions/addSessionAnnotation.ts
  • src/sessions/logSessionAnnotations.ts
  • src/sessions/types.ts
  • src/types/annotations.ts