Overview
Valiqor tracing captures the full execution flow of your AI application — LLM calls, tool executions, retrieval steps, and custom logic — as structured traces with spans. Three levels of instrumentation are available:- Zero-config —
import valiqor.autoand traces are captured automatically - Decorators —
@trace_workflowand@trace_functionfor explicit control - Manual spans — Full control via
TracerV2for complex pipelines
Zero-Config Auto-Instrumentation
The simplest way to start tracing. Add one import at the top of your application:.valiqorrc and automatically patches supported providers (OpenAI, Anthropic, LangChain, Ollama, Agno).
autolog() Function
Enable auto-instrumentation programmatically with more control:
disable_autolog()
Disable auto-instrumentation:
Provider-Specific Shortcuts
configure() Function
Configure the tracing system programmatically:
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | None | Valiqor API key. |
project_name | str | None | Project name. |
app_name | str | None | Application name for trace metadata. |
app_version | str | None | Application version. |
environment | str | None | Environment label. |
trace_dir | str | None | Local directory for trace export. |
backend_url | str | None | Backend API URL. |
auto_trace | bool | None | Enable/disable auto-tracing. |
local_export | bool | None | Enable local file export. |
debug | bool | None | Enable debug logging. |
export_mode | str | None | Export mode configuration. |
Decorators
@trace_workflow
Create a trace for a workflow. Works as both a context manager and a decorator.
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | "workflow" | Name for this trace/workflow. |
input_data | Dict | None | Optional input data to attach to the trace. |
@trace_function
Create a span under the active trace for a function call.
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | None | Span name. Defaults to the function name. |
input_fields | List | None | Which function arguments to capture. |
capture_input | bool | True | Whether to capture function input arguments. |
capture_output | bool | True | Whether to capture function return value. |
Conversation Tracking
For multi-turn conversational agents, group multiple interactions into a single trace:TracerV2 — Manual Tracing
For full control over trace and span lifecycle:
Constructor
| Parameter | Type | Default | Description |
|---|---|---|---|
app | Dict[str, str] | — | App metadata, e.g. {"name": "my-app", "version": "1.0"}. |
exporters | list | None | List of exporter instances. |
ring_size | int | 200 | Max events in the ring buffer. |
trace_dir | str | "valiqor_output/traces" | Local output directory. |
backend_url | str | None | Backend URL for cloud export. |
api_key | str | None | API key for cloud export. |
project_name | str | None | Project name. |
Trace Lifecycle
Span Lifecycle
Message Logging
RAG-Specific Methods
TracerV2 provides specialized methods for tracing RAG pipelines:
track_retrieval()
Track a retrieval step with document hits.
track_generation()
Track a generation step.
track_rag_pipeline()
Track the entire RAG pipeline in one call.
Constants
ValiqorStage
Pipeline stage labels for spans:
| Constant | Value |
|---|---|
RETRIEVAL | "retrieval" |
EVALUATION | "evaluation" |
SYNTHESIS | "synthesis" |
ROUTING | "routing" |
ORCHESTRATION | "orchestration" |
LLM_CALL | "llm_call" |
TOOL_CALL | "tool_call" |
EMBEDDING | "embedding" |
RERANKING | "reranking" |
PREPROCESSING | "preprocessing" |
POSTPROCESSING | "postprocessing" |
UNKNOWN | "unknown" |
ValiqorSpanKind
Span kind classification:
| Constant | Value |
|---|---|
WORKFLOW_NODE | "workflow_node" |
LLM_CALL | "llm_call" |
RETRIEVER | "retriever" |
TOOL | "tool" |
EVAL | "eval" |
EMBEDDING | "embedding" |
SYSTEM | "system" |
UNKNOWN | "unknown" |
Exporters
ConsoleExporter
Print trace events to the console. Useful for development.
FileExporter
Write trace events to local JSON files.
APIExporter
Upload trace events to the Valiqor backend.
Related
- Tracing Workflow — Step-by-step tracing guide
- Traces & Spans — Conceptual overview
- TraceQueryClient — Query uploaded traces
- Integrations — Provider-specific auto-instrumentation
- Models Reference —
DocumentHit,RetrievalInfo,Citation,GenerationInfo