Trace Structure
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 viaparent_span_id:
Span Kinds
Thekind field classifies what a span represents:
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 usingsession_id.
This lets Valiqor track multi-turn interactions:
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: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.