Skip to main content
OpenInference uses a hierarchical data model to represent AI application execution as distributed traces.

Traces

A trace records the full execution path of a request — from the user’s initial input through every LLM call, tool invocation, and retrieval step to the final response. Traces are trees of spans connected by parent–child relationships. The root span typically represents an agent turn or pipeline invocation; child spans represent individual operations within it.

Spans

A span is the atomic unit of work: one LLM call, one tool execution, one retrieval query, one embedding generation. Every span carries:
FieldDescription
NameHuman-readable operation name (e.g., ChatCompletion, web_search)
Start / end timeWall-clock timestamps with nanosecond precision
openinference.span.kindThe role of this operation in the pipeline (see Span Kinds)
AttributesTyped key/value pairs capturing inputs, outputs, configuration, and cost
StatusOK, ERROR, or UNSET

Span Kinds

The openinference.span.kind attribute classifies what an operation does, enabling observability platforms to render traces with AI-aware visualizations and aggregations:
KindDescription
LLMA call to a language model API. Carries input messages, model parameters, output messages, and token counts.
AGENTA reasoning step in an autonomous agent. May spawn child spans for tool calls, retrievals, or nested LLM calls.
CHAINA deterministic sequence of operations such as prompt formatting, post-processing, or orchestration logic.
TOOLExecution of a function or external API called by a language model.
RETRIEVERA query to a vector store, search engine, or knowledge base.
RERANKERA reranking model that reorders a candidate set of documents by relevance.
EMBEDDINGGeneration of vector embeddings from text or other content.
GUARDRAILAn input or output moderation check.
EVALUATORAn automated evaluation of a model response (e.g., LLM-as-judge).
PROMPTA named prompt template invocation.

Attributes

Attributes are typed key/value pairs attached to spans following a structured naming convention. They are the primary payload of OpenInference: they carry the prompt, the response, the model name, the retrieved documents, the tool arguments, and everything else needed to understand and reproduce a given execution. Attribute names use dot-separated namespaces (e.g., llm.input_messages, llm.token_count.prompt). List-valued attributes use zero-based integer indices in flattened form (e.g., llm.input_messages.0.message.role).
The Semantic Conventions document is the authoritative reference for all attribute names, types, and meanings.

Build docs developers (and LLMs) love