Core Concepts
Trainly’s observability model is built on five primitives.Traces
A trace is a single recorded AI interaction — one input in, one output out. Every trace captures:| Field | Description |
|---|---|
input | The prompt or user message |
output | The AI response |
model | Which LLM was used (e.g., gpt-4o) |
latency_ms | Response time in milliseconds |
token_usage | Prompt and completion token counts |
cost | Estimated cost in USD |
tags | Labels for filtering (e.g., ["production", "agent"]) |
metadata | Arbitrary key-value pairs |
status | success or error |
Spans
A span is a sub-unit of work within a trace. Use spans to instrument multi-step pipelines — each step gets its own timing, attributes, and output.chain, retrieval, tool, agent, llm, embedding.
Sessions
A session groups multiple traces into a single agent run. All traces within a session share asession_id for end-to-end correlation.
Scores
Scores attach evaluation metrics to traces. Use them for human feedback, automated checks, or LLM-as-judge evaluation.Versions
Versions tag your pipeline configuration with semver strings. Publish a version, compare performance across versions, and rollback instantly.Projects
A project is an isolated environment for traces. Each project has its own API key (tk_), project ID (proj_), and trace store. Use separate projects for different apps, environments, or teams.