Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.trulayer.ai/llms.txt

Use this file to discover all available pages before exploring further.

Install

pip install trulayer llama-index

Instrument

import os
import trulayer

trulayer.init(api_key=os.environ["TRULAYER_API_KEY"], project_name="my-app")
trulayer.instrument_llamaindex()
After instrumentation every query, retriever, LLM call, and agent step is captured as a span — no per-callsite changes needed.

Minimal example

from llama_index.core import VectorStoreIndex, SimpleDirectoryReader

docs = SimpleDirectoryReader("./data").load_data()
index = VectorStoreIndex.from_documents(docs)
engine = index.as_query_engine()

engine.query("What does the onboarding doc say about SSO?")
# A trace appears in the dashboard with `query`, `retriever`, and `llm` spans.

What gets captured

  • query spans for every QueryEngine.query / ChatEngine.chat
  • retriever spans with the retrieved NodeWithScore list attached as output
  • llm spans for synthesizer calls with prompt, response, and token counts
  • agent spans for ReAct and OpenAI agents, with each reasoning step as a child span
Embeddings calls used for both indexing and retrieval appear as embedding spans with input text and model metadata.