LlamaIndex
Trace LlamaIndex pipelines with Rius: query engines, retrievers, embeddings, and the model calls inside them.
This integration is Python only. There is no LlamaIndex integration in TypeScript, so query-engine and retriever structure is not captured for LlamaIndex.TS. The OpenAI integration still traces the provider calls it makes through the OpenAI client, and manual generations cover the pipeline around them.
Setup
pip install "glassflow-rius[llama-index]" llama-indexThe extra installs the instrumentation, not llama-index itself, so the
package is named here for a fresh environment. A project that already
calls LlamaIndex has it, and pip leaves it untouched. Without it, init()
logs a DependencyConflict and this integration stays off.
import rius
rius.init(api_key="ri_...", service_name="my-agent")
# build indexes and query engines exactly as beforeWhat gets captured
A query becomes a nested trace of typed spans: retrieval steps as RETRIEVER spans, embedding calls as EMBEDDING, synthesis model calls as LLM spans with model, token usage, and messages (cost computed server-side). RAG debugging usually starts here: the retriever span’s output shows what the model was given to work with.
If the openai extra is installed too, an LLM’s chat or completion call,
streamed or not, is traced as a second LLM span under the LlamaIndex span.
Since glassflow-rius 1.1.1 the call is still counted once in tokens and
cost, and the LlamaIndex span still shows the call’s total. Calls from
MultiModalLLM models, embedding models, and retrievers are not nested:
their OpenAI span starts a trace of its own. On earlier versions, or on
instrumentation versions outside the supported range, LLM calls behave the
same way and are counted twice; see
Still counted twice.
Verify
Run one query against an index, then open the trace in the console: the pipeline appears as nested spans with the LLM leaf carrying model, tokens, and cost.
Retrieved document content and messages are content attributes; privacy controls cover them, while document ids and scores stay visible even with content stripped.