Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

OpenTelemetry LlamaIndex Instrumentation

pypi

This package contains OpenTelemetry instrumentation for LlamaIndex.

It emits invoke_workflow spans for AgentWorkflow runs, invoke_agent spans for standalone and workflow-member FunctionAgent and ReActAgent executions, and execute_tool spans when LlamaIndex executes tools. It also emits retrieval spans for synchronous and asynchronous BaseRetriever operations. Model calls delegated to provider SDKs are intentionally left to those SDKs’ OpenTelemetry instrumentations.

Installation

pip install opentelemetry-instrumentation-genai-llama-index

Usage

from opentelemetry.instrumentation.genai.llama_index import (
    LlamaIndexInstrumentor,
)

LlamaIndexInstrumentor().instrument()

How instrumentation works

The instrumentor registers a LlamaIndex span handler with its dispatcher. The handler observes LlamaIndex-owned operations and delegates span creation and completion to opentelemetry-util-genai. Provider model calls are left to the provider’s instrumentation, so they can be composed without duplicate inference spans.

flowchart TD
    A[LlamaIndexInstrumentor.instrument] --> B[LlamaIndex dispatcher]
    B --> C{Span callback}
    C -->|AgentWorkflow.run| D[workflow invocation]
    C -->|BaseWorkflowAgent.run / run_agent_step| E[agent invocation]
    C -->|call_tool / FunctionTool.call| F[tool invocation]
    C -->|BaseRetriever.retrieve / aretrieve| G[retrieval invocation]
    D --> H[TelemetryHandler.workflow]
    E --> I[TelemetryHandler.invoke_local_agent]
    F --> J[TelemetryHandler.tool]
    G --> K[TelemetryHandler.retrieval]
    H --> L[Start OTel span]
    I --> L
    J --> L
    K --> L
    L --> M[Dispatcher exit or error callback]
    M --> N[Set attributes and stop/fail invocation]
    P[Provider SDK instrumentation] -. model calls .-> Q[inference spans]

Configuration

Content capture is controlled through the OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT environment variable. Supported values are NO_CONTENT, SPAN_ONLY, EVENT_ONLY, and SPAN_AND_EVENT.

Prompts and completions can also be redirected via a completion hook by setting OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK=upload together with OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH, or by passing a custom hook directly with instrument(completion_hook=...). See examples/manual/custom_hook.py for a programmatic example.

References

Metadata

Release files for opentelemetry-instrumentation-genai-llama-index 1.3b0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opentelemetry-instrumentation-genai-llama-index 1.3b0
File Size Uploaded Provenance Actions
opentelemetry_instrumentation_genai_llama_index-1.3b0.tar.gz 37.4 kB With provenance Details for opentelemetry_instrumentation_genai_llama_index-1.3b0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opentelemetry-instrumentation-genai-llama-index 1.3b0
File Interpreter ABI Platform Actions
opentelemetry_instrumentation_genai_llama_index-1.3b0-py3-none-any.whl Python 3 none any Details for opentelemetry_instrumentation_genai_llama_index-1.3b0-py3-none-any.whl

Total release size: 57.7 kB

Release files / opentelemetry_instrumentation_genai_llama_index-1.3b0.tar.gz

Download URL opentelemetry_instrumentation_genai_llama_index-1.3b0.tar.gz
Size 37.4 kB
Tags Source
SHA-256 checksum
How to use checksums
97e95028ea01030440adf1d39a320fa0351e41c4c4b6ef772605fb0cdc757f65
BLAKE2b-256 checksum
How to use checksums
0b2eb84c89e068fa106ffd0bb63d00ec5e0e0b9a185c444a43206160ad40fa40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / opentelemetry_instrumentation_genai_llama_index-1.3b0-py3-none-any.whl

Download URL opentelemetry_instrumentation_genai_llama_index-1.3b0-py3-none-any.whl
Size 20.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f79785bdcb57e001259f5d87cf34f529a05b3a7227f3f321e9abbc3b027e3538
BLAKE2b-256 checksum
How to use checksums
47fc7a86a205246d9c7fb3530b876ea42b71804f3c2ec1c5436f29ddeb34a5de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for opentelemetry-instrumentation-genai-llama-index 1.3b0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for opentelemetry_instrumentation_genai_llama_index-1.3b0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page