Install
- Python
Set up
To capture the complete picture—including both the pipeline structure and the underlying token costs—we highly recommend initializing both the LlamaIndex integration and your specific LLM provider (e.g., OpenAI, Anthropic, Google GenAI).- Python
Usage
Once initialized, all LlamaIndex operations are captured automatically:Verify
Run your code and confirm the trace arrives:- In the TraceRoot UI: Navigate to Tracing > Traces in TraceRoot Cloud. You should see a trace with root span
RetrieverQueryEngine.query, the class and method thatas_query_engine().query()resolves to. - Via the CLI: Run
traceroot traces listto inspect your recent traces from the terminal.
What gets captured
Limitations
- Initializing both
Integration.LLAMA_INDEXand your underlying LLM provider integration (such asIntegration.OPENAI) is recommended to capture full token usage and pricing.
Run the example
Clone the repo and run a complete agent end-to-end.Python
Run the Python example
Next steps
Python SDK Reference
Explore the full Python SDK reference and instrumentation options.
Cost Tracking
Learn how TraceRoot calculates token costs and tracks model spend.

