--- id: openinference-instrumentation-dspy version: "0.1.39" license: Apache-2.0 license_treatment: permissive maintenance: active --- # openinference-instrumentation-dspy — OpenInference DSPy Instrumentation License: permissive · Maintenance: active · Downloads: 207.4K/mo ## What it is and what it does This package wraps DSPy applications with OpenTelemetry instrumentation, automatically capturing execution traces without requiring code changes to your DSPy modules. It integrates with the OpenInference standard, making traces compatible with observability platforms like Arize Phoenix and Arize AX for visualization and debugging. The instrumentation works by hooking into DSPy's execution flow and emitting spans that describe each step of your program's reasoning and module calls. You configure it once with a tracer provider and exporter, then call `DSPyInstrumentor().instrument()` to enable tracing for all DSPy code in your application. Traces are sent to your chosen collector endpoint, where you can inspect them in a web UI to understand what your DSPy program is doing, debug failures, and optimize performance. Use it for: - Debug DSPy program behavior by viewing step-by-step execution traces in Arize Phoenix or Arize AX. - Monitor DSPy application performance and identify bottlenecks in module execution and LM calls. - Track DSPy program optimization results by comparing traces before and after teleprompter compilation. - Audit DSPy reasoning chains to understand how your program arrived at specific answers. - Integrate DSPy tracing into a broader observability stack using standard OpenTelemetry exporters. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Auto-instruments DSPy applications to generate OpenTelemetry-compatible traces for observability and debugging, sending them to collectors like Arize Phoenix or Arize AX. Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and provides essential observability for DSPy applications. If you are developing or debugging DSPy programs, this instrumentation is straightforward to add and immediately useful for understanding execution flow. The Apache-2.0 license poses no restriction. ## Install pip install openinference-instrumentation-dspy uv add openinference-instrumentation-dspy poetry add openinference-instrumentation-dspy ## Installing openinference-instrumentation-dspy Before you install: Low install friction with a pure Python wheel. The package is actively maintained (last commit 2026-08-14, release 7 days old) and depends on well-established OpenTelemetry and OpenInference libraries, all of which are standard instrumentation infrastructure. License in practice: Apache-2.0 permissive license allows use in most commercial and open-source projects without significant restriction. Quickstart: pip install openinference-instrumentation-dspy from openinference.instrumentation.dspy import DSPyInstrumentor from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.trace.export import SimpleSpanProcessor from opentelemetry import trace as trace_api from opentelemetry.sdk import trace as trace_sdk tracer_provider = trace_sdk.TracerProvider() trace_api.set_tracer_provider(tracer_provider) tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter("http://127.0.0.1:6006/v1/traces"))) DSPyInstrumentor().instrument() Requires Python 3.10 or later; requires a running OpenTelemetry collector endpoint (e.g., Arize Phoenix) to receive and visualize traces. Verify before relying: - Whether the package supports tracing of all DSPy module types or only specific ones like ChainOfThought. - Performance overhead of instrumentation on DSPy execution time and memory usage. - Whether custom span attributes and session tracking work with all OpenTelemetry exporters or only specific ones. ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 207.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags dspy tracing instrumentation, opentelemetry dspy, dspy observability, dspy application traces, dspy debugging monitoring, openinference dspy, dspy span collection, observability, dspy, opentelemetry [View on SkillFed](https://skillfed.io/packages/openinference-instrumentation-dspy) · [View on PyPI](https://pypi.org/project/openinference-instrumentation-dspy/)