What are Sessions?
A session is a grouping of related traces. In a chatbot, each turn generates its own trace. Tag them with the samesession.id and you can view the full conversation as one unit — spot where things went wrong across turns, identify when users become frustrated, and run session-level evaluations.
Arize AX tracks per session: duration, trace count, total prompt tokens, total completion tokens, and total tokens.

Add Session ID
Addingsession.id to your spans enables back-and-forth interactions to be grouped. The session ID must be a non-empty string.
- Python
- JS/TS
Use It can also be used as a decorator:
using_session as a context manager to add session ID to the current OpenTelemetry Context. OpenInference auto instrumentors will read this Context and pass the session ID as a span attribute, following the OpenInference semantic conventions.Add User ID
Addinguser.id associates traces with a specific user. The user ID must be a non-empty string.
- Python
- JS/TS
Use It can also be used as a decorator:
using_user as a context manager to add user ID to the current OpenTelemetry Context.using_attributes helper combines them:
Framework-Specific Examples
Useusing_attributes to set session and user IDs together with any supported framework.
- OpenAI
- LangChain
- LlamaIndex
- Bedrock
- MistralAI
- DSPy
Requires
pip install openinference-instrumentation-openaiOther Ways to Set Up
Sessions can also be added through an AI coding agent using the Arize instrumentation skill, or through Alyx in the Arize AX UI.- By Arize Skills
- By Alyx
Three steps to add sessions with your AI coding agent:Install skillSet up authenticationAdd sessionsWorks with Cursor, Claude Code, Codex, and more. The skill picks the right framework helper (
using_session / setSession) and wires it into the right spots.View Sessions
Once your traces have session IDs attached, head to your project in Arize AX and switch to the Sessions view. You’ll see each session as a row — click into one to see the full multi-turn conversation with all its traces laid out in order. For each session, Arize AX shows you:- Duration — how long the conversation lasted
- Trace count — how many turns/requests were in the session
- Token usage — total prompt, completion, and combined tokens across all traces

