Documentation Index
Fetch the complete documentation index at: https://docs.trodo.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
What auto-instruments
Installopentelemetry-instrumentation-llamaindex alongside llama-index. Every retriever/query/chat call inside wrap_agent emits spans.
| Construct | Span kind | Auto-extracted |
|---|---|---|
VectorIndexRetriever.retrieve | retrieval | query, doc count, doc ids |
QueryEngine.query | agent | wraps retrieval + synthesis |
ChatEngine.chat | agent | wraps retrieval + LLM + memory |
ResponseSynthesizer | llm | model, tokens |
| Node post-processors | generic | name per post-processor |
| Embeddings | llm | model, tokens |
Install
Minimum example — RAG query
Chat engine with memory
wrap_agent run; the conversation_id stitches them into the session view.
Retrieval span details
The default retriever populates:span.input→ the raw query stringspan.output→ list of{ id, score, text_preview }for each retrieved nodespan.attributes.top_k→ configuredsimilarity_top_kspan.attributes.doc_count→ how many nodes actually came back
Auto vs manual cheat-table
| Operation | Auto? | If manual |
|---|---|---|
VectorIndexRetriever | yes | — |
Custom BaseRetriever subclass | partial | Must call super()._retrieve() for callbacks to fire; otherwise wrap in trodo.retrieval() |
QueryEngine.query | yes | — |
ChatEngine.chat | yes | — |
SubQuestionQueryEngine | yes | Each sub-question becomes a nested query span |
ReactAgent / FunctionCallingAgent | yes | Steps appear as alternating llm + tool |
| Custom node post-processors | yes | Name taken from the class |
| Ingestion pipeline | no | Usually offline — wrap in a separate run with wrap_agent("ingest-docs") |
Gotchas
- Only the Python SDK auto-instruments LlamaIndex. The JS port (
llamaindexnpm package) has no first-party OTel bindings — wrap retrievers withtrodo.retrieval()and synthesiser calls withtrodo.llm(). - Token counts come from the underlying LLM (OpenAI, Anthropic). If you’re using a local LLM via
CustomLLM, setextractUsageon atrodo.llmwrapper or calltrodo.track_llm_callafter each completion. - Streaming query engines (
as_query_engine(streaming=True)) record the span when the stream finishes. Partial results appear only if you setspan.set_outputmid-stream.