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.

Note

Requires Phoenix Server ≥ 12.0.0. The client will throw an error with the minimum required version if the server is too old.

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#

FieldTypeRequiredDescription
sessionIdstringYesSession / conversation / thread identifier
namestringYesAnnotation name (e.g. "csat")
annotatorKind"HUMAN" | "LLM" | "CODE"NoDefaults to "HUMAN"
labelstringNo*Categorical label
scorenumberNo*Numeric score
explanationstringNo*Free-text explanation
identifierstringNoFor idempotent upserts
metadataRecord<string, unknown>NoArbitrary metadata

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