This release is a pre-release and may not be stable for production use.
OpenTelemetry DSPy Instrumentation
This package provides OpenTelemetry instrumentation for the DSPy framework, emitting Generative AI semantic conventions for DSPy language models (dspy.LM), Tool executions, ReAct agent loops (supporting both dspy.ReAct and dspy.ReActV2), and retrieval operations (dspy.Retrieve, dspy.ColBERTv2, and dspy.Embeddings).
Installation
pip install opentelemetry-instrumentation-genai-dspy
Usage
from opentelemetry.instrumentation.genai.dspy import (
DSPyInstrumentor,
)
DSPyInstrumentor().instrument()
Message content capture is disabled by default. Set OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT to one of NO_CONTENT, SPAN_ONLY, EVENT_ONLY, or SPAN_AND_EVENT to record prompts, completions, and module inputs/outputs.
Uploading prompts and completions
Instead of recording message content inline, prompts and completions can be uploaded to external storage via a completion hook. To enable the built-in upload hook, set:
OTEL_INSTRUMENTATION_GENAI_COMPLETION_HOOK=upload
OTEL_INSTRUMENTATION_GENAI_UPLOAD_BASE_PATH to an fsspec-compatible URI/path (e.g. /path/to/prompts or gs://my_bucket), and install the upload extra (pip install opentelemetry-util-genai[upload]).
A custom CompletionHook can also be passed programmatically, taking precedence over the environment variable:
DSPyInstrumentor().instrument(completion_hook=my_hook)
References
Metadata
Release files for opentelemetry-instrumentation-genai-dspy 1.3b0
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 |
|---|---|---|---|---|
| opentelemetry_instrumentation_genai_dspy-1.3b0.tar.gz | 40.4 kB | With provenance | Details for opentelemetry_instrumentation_genai_dspy-1.3b0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| opentelemetry_instrumentation_genai_dspy-1.3b0-py3-none-any.whl | Python 3 | none | any | Details for opentelemetry_instrumentation_genai_dspy-1.3b0-py3-none-any.whl |
Total release size: 63.0 kB
Release files / opentelemetry_instrumentation_genai_dspy-1.3b0.tar.gz
| Download URL | opentelemetry_instrumentation_genai_dspy-1.3b0.tar.gz |
|---|---|
| Size | 40.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ebc511124e228b09b1c23f8b02a8d88e74fc66235b0af30b68a46e41c4d46f4d
|
|
BLAKE2b-256 checksum How to use checksums |
b26f0e808d46d532ddd2405dd2513b6dd94d39877dd031a06d653517215950eb
|
| 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 logRelease files / opentelemetry_instrumentation_genai_dspy-1.3b0-py3-none-any.whl
| Download URL | opentelemetry_instrumentation_genai_dspy-1.3b0-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50b59814f8bd4f4db11c858fb699dcb23b91f7cd9fdaf0bf8ac5a73cff373445
|
|
BLAKE2b-256 checksum How to use checksums |
1391a6d15e5ec2cd00adf694f272d5a964fea86cfa3c25565db128dd40f6b4cc
|
| 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 logSecurity for opentelemetry-instrumentation-genai-dspy 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.
Attestation for opentelemetry_instrumentation_genai_dspy-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 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.