Skip to main content
A trace is the full record of one AI interaction — from the user’s prompt through every LLM call, retrieval, tool execution, and final response. Traces are the raw material that Failure Analysis, Evaluations, and Security Audits operate on.

Trace Structure

Every trace has a unique trace_id and belongs to a project_id. The SDK assigns these automatically when you use auto-instrumentation.

Trace Metadata

Each trace captures operational metadata automatically:

Messages

Messages represent the conversation between the user and the AI. Each message has:

Spans

A span is a single unit of work inside a trace — an LLM call, a retrieval lookup, a tool execution, etc. Spans form a tree via parent_span_id:

Span Kinds

The kind field classifies what a span represents:
When using auto-instrumentation (import valiqor.auto), span kinds are assigned automatically based on the provider library being instrumented.

RAG Pipeline Stages

For RAG applications, Valiqor further classifies spans by their pipeline stage: RAG stages are used by Failure Analysis to pinpoint where in the pipeline a failure occurred — for example, distinguishing a retrieval failure from a synthesis hallucination.

RAG-Specific Data

When tracing RAG applications, Valiqor captures additional structured data:

Retrieval Info

Document Hits

Each retrieved document is recorded with:

Citations


Conversation Threads

Multiple traces can be grouped into a conversation using session_id. This lets Valiqor track multi-turn interactions:
When you query traces by session_id, you get the full conversation history with all traces in chronological order.

Execution Tree

The execution tree is the hierarchical view of all spans in a trace. It shows the parent-child relationships, making it easy to understand the flow of execution:
The execution tree is what you see in the Valiqor dashboard’s trace viewer and is also available via TraceFullResult.execution_tree in the SDK.

SDK Data Classes

The SDK provides typed dataclasses for working with trace data: All classes include .from_dict() and .to_dict() methods for easy serialization.

Where Traces Are Used

Traces are the input for every Valiqor analysis workflow:

Failure Analysis

Pass a trace_id to run() — FA extracts messages, spans, and retrievals to classify failures across 15 subcategories.

Evaluations

Pass a trace dict to evaluate_trace() — metrics are computed on the extracted input/output/context.

Security Audits

Pass a trace dict to audit_trace() — user/assistant pairs are extracted and scanned against S1–S23 categories.

Dashboard

Browse traces visually — see the execution tree, messages, spans, costs, and evaluation results.