Sessions and end users
Last updated: 2026-11-26T09:05:04-03:00 (UTC-3)
Two more scopes of the Traces screen group the traffic the way people think about a product: by conversation and by customer. Sessions lists the traces that share a session ID and opens one as a conversation, turn by turn, with its own evaluation results and the results of its traces. Users lists the end users your application named and opens one with everything they did in a time range.
Both read what the span store already keeps. A session is the same session_id the request log and the trace explorer show; an end user is the same end_user; a result is the same evaluation result. Nothing here is a second store or a second ID.
Turn it on
Section titled “Turn it on”features: span_store: true # the gateway stores its own spans trace_explorer: true # the Traces screen session_tracking: true # X-Gateway-Session-Id is read and recorded end_user_tracking: true # X-Gateway-End-User is read and recorded session_explorer: true # Traces -> Sessions (this page) end_user_pages: true # Traces -> Users (this page)| Flag | Default | Kind | Requires | What it turns on |
|---|---|---|---|---|
session_explorer |
false |
tenant read | trace_explorer, session_tracking |
The Sessions scope, the session page and POST /v1/sessions/{id}/close (the latter also needs evaluators) |
end_user_pages |
false |
tenant read | trace_explorer, end_user_tracking |
The Users scope, the end user page and end_user on GET /evaluations |
Both are tenant reads: with feature_plan_entitlements a team’s plan must include them. Readers need logs:read, as for the trace explorer; cost columns need analytics:read with usage_valuation; results need evals:read with evaluation_results; the conversation needs content_sent:read of the team (below). The flags can be overridden at runtime under Settings → Features or PUT /api/v1/admin/features/{flag}.
What your application sends
Section titled “What your application sends”A session is whatever your application calls one: a chat thread, a support ticket, an agent run. Send the same value on every request of it:
POST /v1/chat/completionsAuthorization: Bearer <key>X-Gateway-Session-Id: support-4812X-Gateway-End-User: customer-77| Header | Bounds | Meaning |
|---|---|---|
X-Gateway-Session-Id |
one value, 1–128 printable characters | The session. A session belongs to the key’s team: two teams that use the same ID have two sessions. |
X-Gateway-End-User |
one value, 1–128 printable characters | The end user, as your application names them. The gateway does not authenticate it: the console marks it client-declared. |
X-Gateway-Parent-Session-Id |
as above; needs agent_sessions |
The session this one was started from (a subagent’s run): it appears as a child session of the parent. |
X-Gateway-Agent-Id |
as above; needs agent_sessions |
The agent that made the request: the session lists its agents. |
Reusing a session ID later extends the same session: its duration then runs from its first trace to its last. Judge calls, experiments and other calls the gateway makes for itself never carry your session ID, so evaluation traffic never appears inside your sessions.
Sessions
Section titled “Sessions”Traces → Sessions lists the sessions active in the time range (their last trace ends after its start and their first trace begins before its end), the most recently active first. Each row shows the last activity, the session ID, its traces and requests, its duration, its cost (≥ when some request could not be valued; Unknown when none could, never zero), its tokens, the end user, the agents, a badge of every result of the session and its traces, and one column per session evaluator found on the page (the mean of its values, or passed/total). First input shows each session’s first user message for readers of the sent view. The footer counts every matching session and its traces.
The query bar takes the query language in the sessions scope:
| Field | Type | Example |
|---|---|---|
session |
text | session:support-* |
end_user |
text | end_user:customer-77 |
team |
text | team:support |
agent |
text (any of the session’s agents) | agent:researcher |
parent_session |
text | parent_session:run-42 |
duration |
duration | duration>5m |
cost |
money | cost>0.05 |
valuation |
known, partial, unknown, none | valuation:partial |
tokens.total |
number | tokens.total>10000 |
session.traces |
number | session.traces>=3 |
session.requests |
number | session.requests>10 |
session.failed_evaluations |
count of failed results | session.failed_evaluations>=1 |
evaluation.<name>.assessment, evaluation.<name>.value, feedback.<name>.value |
as in the traces scope | evaluation.helpfulness.value<3 |
An evaluation term selects the sessions with such a result, on the session itself or on any of its traces. Text search and topic terms are not read in this scope: search the text in the traces scope, then open the session from a trace.
The session page
Section titled “The session page”Opening a session shows:
- The header: team, traces and requests, duration (first trace’s start to last trace’s end), cost, tokens, end user (a link to the end user page), agents, the session it was started from, and the failed and passed results of its traces. Previous and next (or the
kandjkeys) move along the list you came from. - Actions: Open its traces (the traces scope with
session:<id>), Add to review queue (the session as a queue item, withreview_multi_annotator) and Evaluate (an on-demand run of a session evaluator, withevaluatorsandevals:manage). - Session results: every result on the session itself, from a session-scope evaluator, a human or
POST /v1/scoreswith asession_id, with the judge’s reasoning for readers of the sent view and a link to the judge’s trace. A result sent through the API appears at once, whether or not a session evaluator exists. - Child sessions: the sessions started from this one, at most 200.
- Transcript: one turn per trace, the oldest first, the 20 most recent turns with Load earlier turns for the rest. Each turn shows its time, duration, model, model and tool calls, cost, tokens, the badge of its results (failed in red) and a link to the trace. For a reader with
content_sent:readof the team, it also shows the user’s last message in the request as it was sent on (after the input guardrails) and the answer, each cut at 4,000 characters, text only; an answer that only calls tools shows its calls, onetool call: name(arguments)line each. Where the session may record results for the turn’s team (the server checks it as it checks the write:evaluation_results,evals:manage, a team the session administers, the team’s plan; the transcript says so withcan_annotate), each turn has thumbs up, thumbs down and an optional comment: a reviewer’s boolean result namedthumbson the turn’s trace (sourcehuman, pass or fail), recorded throughPOST /api/v1/admin/evaluationswith that route’s team checks, audited (eval.result_create, theneval.result_editwhen the other thumb or a comment changes it), and counted wherever results are (the Feedback lens, the badge, Quality). The server keeps one vote per reviewer and turn: a second vote, from any page or two clicks at once, updates the first and is audited as an edit. The page reads the reviewer’s own votes back (GET /api/v1/admin/evaluations?mine=true) to show them; on a turn of a team it may not write for, it shows that vote read-only and offers no button. A vote recorded before this rule keeps its ID and is the one updated; a vote change keeps the comment the vote already had. The reviewer is the console identity that signed in (a named user, or a console credential), and a vote an administrator withdrew stays withdrawn when the reviewer votes again. A turn’s badge names failed results first, then passed, then neutral or skipped ones (a result skipped because its content was not captured), never “0 passed”. Each turn shown is one audited read of the captured record. A reader who may only see that records exist sees each turn as withheld; anyone else sees N turns, content not shown. Content appears only when the team’s capture policy keeps the sent view (theevaluationpurpose, orviews: [sent]).
Session evaluators and the idle window
Section titled “Session evaluators and the idle window”A session-scope evaluator judges a session once it has been idle for evaluation.session_idle (or the evaluator’s own session_idle_seconds), and every later request of the session pushes the run back. Until then the session shows no result and the evaluator lists the run as pending. When your application knows the conversation is over, it can say so:
POST /v1/sessions/support-4812/closeAuthorization: Bearer <key with scores:write>{"session_id": "support-4812", "runs_due": 1}The session’s waiting session-scope runs of the key’s team become due now; a later request of the same session pushes them back by the idle window as before. A session with no waiting run answers runs_due: 0. It needs session_explorer and evaluators (both in the team’s plan) and returns 404 feature_disabled otherwise.
End users
Section titled “End users”Traces → Users lists the end users of the time range, one row per team (an end user is named by a team’s application), the most recently seen first: last and first seen, team, sessions (the sessions the end user owns, the session’s first-written end user, active in the range; per team and organization, so a session of a team that moved counts once per part), traces begun in the range, traces in error, cost, tokens and the badge of their results. The figures equal the sum of the trace summaries of the range.
The users scope of the query language takes end_user, team, cost, valuation, tokens.total, user.traces, user.sessions, user.requests, user.errors, user.failed_evaluations and the evaluation terms, matched against the end user’s results.
The end user page shows those totals over the range and three tabs: Traces (the traces scope with end_user:<id>), Sessions (the sessions scope with the same term) and Evaluations (GET /evaluations?end_user=<id>: the results of the end user’s requests and the results recorded on the sessions the end user owns, the session’s first-written end user as its row shows; an erasure clears the session’s end user, so its results leave the tab with it). Open in Traces and Open in Sessions take the term to the full screen.
Erasure
Section titled “Erasure”An end-user erasure clears the end user from every stored span and summary and deletes their rows of the hourly rollup in the same transaction, so an erased end user disappears from the list, the page and its Evaluations tab as soon as the erasure completes, and their sessions show no end user: another end user who wrote to the same session does not take their place, so the session’s results leave the Evaluations tab rather than move to someone else’s. On the analytics store engine (spans.engine: analytics_store) the spans and summaries there are cleared by a pass that applies completed erasures every 30 seconds, so the pages follow within that pass. With the analytics store span engine the erasure reaches the store on the gateway’s next maintenance pass.
All admin routes also answer under /api/admin; they take a console session and the reader’s team scope; a team-scoped reader reads only what its teams recorded in their current organization, and naming another team returns nothing.
| Route | Purpose | Main parameters |
|---|---|---|
GET /api/v1/admin/sessions |
The sessions list | q (sessions scope), from, to (default the last 24 hours, at most 92 days), cursor (the next_cursor of the previous page), limit (1–200, default 50), content=true (first input; caps the page at 50), totals=true (count every match) |
GET /api/v1/admin/sessions/{id}/overview |
The session page | team (the team to read, when several of your teams hold the ID) |
GET /api/v1/admin/sessions/{id}/transcript |
The turns | team (409 team_required when several teams hold it), cursor (earlier turns), limit (1–50, default 20), content=false (skip the content reads) |
GET /api/v1/admin/end-users |
The end users list | q (users scope), from, to (default the last 24 hours, at most 92 days), cursor (the next_cursor of the previous page), limit (1–200, default 50), totals=true |
GET /api/v1/admin/end-users/{end_user} |
The end user page | team (one team), from, to (the range the totals cover) |
GET /api/v1/admin/evaluations?end_user= |
An end user’s results | end_user, with the evaluations list’s parameters |
POST /v1/sessions/{id}/close |
End a session’s idle wait | key with scores:write |
Example:
curl -s -b cookies.txt \ "https://gateway.example.com/api/v1/admin/sessions?totals=true&q=session.traces%3E%3D3%20session.failed_evaluations%3E%3D1"{ "scope": "sessions", "data": [ { "team_id": "support", "session_id": "support-4812", "first_at": "2026-11-26T10:00:00Z", "last_at": "2026-11-26T10:03:18Z", "duration_us": 198000000, "traces": 4, "requests": 4, "cost_state": "known", "cost_usd": "0.000052", "tokens": 315, "end_user": "customer-77", "agents": [], "evaluations": {"failed": 1, "passed": 2, "neutral": 0, "pending": 0, "errors": 0, "results": []}, "scores": [{"name": "csat", "count": 1, "failed": 0, "mean": 4}] } ], "session_evaluators": ["csat"], "totals": {"rows": 1, "traces": 4, "cost_state": "known", "cost_usd": "0.000052", "tokens": 315}, "has_more": false, "engine": "database"}The full schemas are in the API reference.
Both span engines
Section titled “Both span engines”With spans.engine: database sessions are read from the session summaries the span writer keeps in PostgreSQL; with spans.engine: analytics_store they are grouped from the trace summary rows in the analytics store, and a page’s sessions are then folded exactly from their own rows, so both engines show the same figures. End users: the database engine keeps an hourly rollup of the trace summaries by team, organization and end user, written in the same transaction as each batch of spans; a read takes the whole hours of its range from the rollup and the partial hours at its two ends from the trace summaries, so its figures are exact, and a 30-day first page answers in about 76 ms at a million traces instead of 2 s (measured). The analytics store sums its trace rows on read, fast enough at that size. Session lists bound the time range by activity; end user lists by the traces’ start.
Limits
Section titled “Limits”- A list page holds at most 200 rows; results counted per page at most 1,000 (
evaluations_truncated); an evaluation term matches at most 2,000 sessions or end users (evaluation_filter_truncated). - A transcript page holds at most 50 turns and reads one captured record per turn; each side of a turn is cut at 4,000 characters; images, audio and reasoning are never part of a transcript (open the trace for them).
- A session lists at most 16 agents and 200 child sessions.
- An end user is one team’s: the same name in two teams is two rows.
- Session summaries follow the span store’s retention (
spans.retention_days): a session older than that is no longer listed.
Upgrading
Section titled “Upgrading”Migration 280 recorded the organization of every session summary; migration 281 moves the summaries to a table keyed by team, organization and session, filled from the old one, with the same indexes. From this release on a team that moves keeps each organization’s part of a session apart on both span engines: readers of the former organization keep its part, readers of the new organization see only theirs, and a gateway-wide administrator sees one row per part (the session page and the transcript ask which with organization).
Migration 282 adds the end user rollup (gateway_end_user_hours) and fills it from the trace summaries. Migrations 281 and 282 hold their tables while they copy them, so span writes wait during the migration (seconds per million traces) instead of being missed.
Rolling upgrade. Upgrade replicas one at a time as usual; nothing has to be switched by hand. While replicas of the previous release still run, they write the old table; a trigger the migration installs copies each of their changes into the new table (the difference for the organization the row names, a whole row the previous release restarted for a moved team to the new organization), so the new table stays exact whichever replica wrote a batch, and an erasure those replicas run clears the label in both tables. The end user rollup follows every change to the trace summaries that this release’s span writer does not make itself (retention, the summary rebuild, an erasure, a replica of the previous release) through a row trigger, so it is exact too. Two things to avoid until every replica runs this release: a summary rebuild on a replica of the previous release (its session rows would be copied a second time), and reading sessions from those replicas, which read the old table. Once the upgrade ends nothing writes the old table; it follows the span retention and a later release drops it with the trigger.