LlamaIndex (tracing)
LlamaIndex (tracing)
LlamaIndex is a framework for building LLM applications with your own data. The existing respan-instrumentation-llama-index package traces both LlamaIndex Core and the standalone llama-index-workflows runtime, including workflow runs and steps, indexes, query engines, retrievers, LLM calls, embeddings, and agent tool use.
Set up Respan
Create an account at platform.respan.ai and grab an API key.
Run npx @respan/cli setup to set up with your coding agent.
Use Respan Gateway
See LlamaIndex gateway setup to route this integration through the Respan gateway.
Example projects
- Example repo root:
respan-example-projects/python/tracing/llama-index
Setup
Set environment variables
OPENAI_API_KEY is used for the LlamaIndex OpenAI LLM. RESPAN_API_KEY exports traces to Respan.
View your trace
Open the Traces page to see a workflow root with nested step spans. LlamaIndex Core operations appear in the same trace tree when a workflow step invokes a query engine, retriever, LLM, embedding model, agent, or tool.
Configuration
Attributes
In Respan()
Set defaults at initialization. These apply to all spans emitted by the LlamaIndex instrumentor.
With propagate_attributes
Override per request using a context scope.
Decorators (optional)
Respan decorators are not required for LlamaIndex instrumentation. Core query engines, retrievers, agents, tools, embeddings, and LLM calls are captured automatically. Standalone Workflows runs and @step methods also emit their own workflow and task spans. Use Respan @workflow and @task only when you want an additional application-level grouping around several operations.
Examples
Query engine
Query engines are captured with nested retriever, synthesizer, and LLM spans.
Embeddings
Embedding calls are captured as embedding logs. When content capture is enabled, the full returned vector is recorded in the canonical entity output so retrieval behavior can be reproduced and inspected.
Tool-use agent
LlamaIndex ReAct agents emit agent, tool, and LLM spans in the same trace tree.