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 Tool executions, ReAct agent loops (supporting both dspy.ReAct and dspy.ReActV2), and dspy.Retrieve retrieval operations.
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
Release files for opentelemetry-instrumentation-genai-dspy 1.2b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opentelemetry_instrumentation_genai_dspy-1.2b0.tar.gz | 18.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opentelemetry_instrumentation_genai_dspy-1.2b0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.9 kB
Release files / opentelemetry_instrumentation_genai_dspy-1.2b0.tar.gz
| Download URL | opentelemetry_instrumentation_genai_dspy-1.2b0.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6dd1e5baa919f1b1c60c861fd3c9ad188416d5249992e93c0ce44d8a05293139
|
|
BLAKE2b-256 checksum How to use checksums |
455c88dcacfdd941a3e818fd0b203d13c63733e39023ab7bc4a3b6744fd174f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency logRelease files / opentelemetry_instrumentation_genai_dspy-1.2b0-py3-none-any.whl
| Download URL | opentelemetry_instrumentation_genai_dspy-1.2b0-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d4042be4b1286da97edf93197b016dcb7ca2c9b635f2c43754cb0ebe6ef0e1a0
|
|
BLAKE2b-256 checksum How to use checksums |
259a817866ed6f783c0a80c625eefe576e8ece2e1498eaa19e34512b3057e402
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency log