Skip to main content
Scores from your application record signals that only exist in production, such as a user’s thumbs-up or a guardrail that fired, on the trace of the request they describe. Use them when you score live traffic from your own code. Eval writes scores for you during an offline run, and hosted judges store their answers as session insights instead.

Before you begin

Before you start, make sure you have:
  • atlanai SDK with tracing: Installed as in Install atlanai SDK, with init_logger or initLogger set up as in Trace first agent run.
  • API key and workspace ID: In ATLAN_API_KEY and ATLAN_WORKSPACE_ID. The key must be able to create scorers in the workspace.
1

Register scorers once

Every score cites a scorer ID and version. Create a code scorer for an automated check, or a human scorer for feedback. Do this once, for example at deploy time, and keep each scorer’s id and version_ordinal.Scorer names are unique in the workspace, so the helper reuses a scorer that already has the name. Pick names specific to your application, and give each scorer one meaning: when a check’s logic changes, register a new name or update the scorer to record a new version.
2

Score request while it runs

score attaches a score to the span you call it on. Call it on the root span to score the whole request, or on a child span to score one step, such as a retrieval. Keep the trace ID and root span ID if feedback may arrive later.
To score the root from a child span in the same process, call score_trace in Python or scoreTrace in TypeScript with the same arguments. If the root span is not in this process, the score attaches to the span you called it on.Match data_type (dataType in TypeScript) to the value:Use stable, lowercase score names with underscores, such as thumbs_up: statistics aggregate by name. Add comment to record why, and keep user content out of it unless your data policy allows it, because comments are stored on the trace.
3

Attach feedback after request

Feedback often arrives later, from another process. Open a span in the original trace with the IDs you kept, and score it. The feedback span becomes a child of the original root, so the trace shows the answer and the verdict together.
Use the trace ID you kept from the original request. A trace_context with an invented trace ID creates a new, orphaned trace.
4

Verify scores on trace

A score without a valid scorer ID and version is dropped with a warning, not raised, so check that each one arrived.
  • Check in the app: Open the request’s trace. Each score appears as a child span named score.<name> with score_value, scorer_id, and scorer_version set.
  • Check in code: When the request belongs to a session, list its spans with client.sessions.traces.list_spans(session_id, trace_id, fields="core,attributes"), or client.sessions.traces.listSpans({ sessionId, traceId, fields: "core,attributes" }) in TypeScript. Spans become readable a few seconds after flush(), so poll briefly.
If a score span is missing, set ATLAN_DEBUG=true and run again: the warning names the missing scorer ID or version. Other causes are in Eval errors.

Troubleshooting

Scores that never appear usually have a missing scorer ID or version, or a value that does not match its data type. See Eval errors. If no traces appear at all, see Install and setup errors.

Next steps

See also