LlamaIndex OpenTelemetry integration
Trace LlamaIndex model calls in Future AGI with the maintained LlamaIndexInstrumentor.
Install
Use Python 3.10–3.13. Install the instrumentor and the LlamaIndex components used by this example:
pip install "traceAI-llamaindex>=0.1.10" llama-index-core llama-index-llms-openai
Known limitations
llama-index-llms-anthropic==0.12.3 with anthropic==2.4.0 or anthropic==2.5.0 raises TypeError: Cannot instantiate typing.Union during sync and async chat, before any HTTP request. The LlamaIndex adapter constructs MessageParam, which is a union type in those SDK versions. This also occurs without traceAI; see LlamaIndex issue #23701.
For this adapter version, use anthropic==0.75.0, which supports these chat calls with llama-index-core==0.14.25, until an upstream fix is available. Pin it alongside the adapter in your application's dependency file:
pip install "llama-index-core==0.14.25" "llama-index-llms-anthropic==0.12.3" "anthropic==0.75.0"
traceAI does not patch the upstream adapter. This limitation does not affect the OpenAI example below.
Configure credentials
Set your Future AGI credentials and your own OpenAI API key in the environment before running Python:
export FI_API_KEY="<your-future-agi-api-key>"
export FI_SECRET_KEY="<your-future-agi-secret-key>"
export OPENAI_API_KEY="<your-openai-api-key>"
Run a chat request
Register the trace provider and instrument LlamaIndex before creating the model. This example hides prompt and response content while retaining model and token-usage metadata.
from fi_instrumentation import TraceConfig, register
from fi_instrumentation.fi_types import ProjectType
from llama_index.core.llms import ChatMessage
from llama_index.llms.openai import OpenAI
from traceai_llamaindex import LlamaIndexInstrumentor
trace_provider = register(
project_type=ProjectType.OBSERVE,
project_name="llama_index_app",
)
LlamaIndexInstrumentor().instrument(
tracer_provider=trace_provider,
config=TraceConfig(hide_inputs=True, hide_outputs=True),
)
try:
llm = OpenAI(model="gpt-4o-mini")
response = llm.chat([
ChatMessage(role="user", content="Suggest a name for a community garden."),
])
print(response.message.content)
finally:
trace_provider.shutdown()
Open the llama_index_app project in Future AGI to inspect the OpenAI.chat LLM span, its duration and token usage. Prompt and response content are hidden by the configuration above.
Use one tracing layer for these calls: do not also enable a separate OpenAI instrumentor for the same LlamaIndex model calls if you want to avoid duplicate model spans.
For standalone workflow run and step tracing, use the same instrumentor with the LlamaIndex Workflows guide.
Metadata
Release files for traceAI-llamaindex 0.1.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| traceai_llamaindex-0.1.12.tar.gz | 28.5 kB | With provenance | Details for traceai_llamaindex-0.1.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| traceai_llamaindex-0.1.12-py3-none-any.whl | Python 3 | none | any | Details for traceai_llamaindex-0.1.12-py3-none-any.whl |
Total release size: 59.5 kB
Release files / traceai_llamaindex-0.1.12.tar.gz
| Download URL | traceai_llamaindex-0.1.12.tar.gz |
|---|---|
| Size | 28.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d81a2e625c1eb2a692872afe7483bf493156514934c25fb5adc23f8c1b5a38be
|
|
BLAKE2b-256 checksum How to use checksums |
5268d05163203168ce1da8662d8a693e77886988cb4c6bb07bc77a91ed50947d
|
| 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 Nov 20, 2026.
Transparency logRelease files / traceai_llamaindex-0.1.12-py3-none-any.whl
| Download URL | traceai_llamaindex-0.1.12-py3-none-any.whl |
|---|---|
| Size | 31.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ed40d571cf1a0c0031bf34f9c8390b7e0a82d7c55f160ab406faa8a8ee5fd92
|
|
BLAKE2b-256 checksum How to use checksums |
d4ab59e5a0ab85c3363a161a1cf4b197e632dcf4768145ba957bf82a997e4aca
|
| 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 Nov 20, 2026.
Transparency logSecurity for traceAI-llamaindex 0.1.12
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.
Attestation for traceai_llamaindex-0.1.12.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 Nov 20, 2026.
Transparency logA 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.