Agent frameworks

DSPy

Capture traces from DSPy modules and optimizers

Choose a setup method

Method Use it when
Voxmith skill You want your coding agent to inspect the app, make the change, and verify it.
Voxmith SDK You want explicit control over the interaction boundaries and fields.
OpenTelemetry The framework already emits useful spans or you operate an OTel pipeline.

Start with one method for a call path. Combining SDK tracking with framework OpenTelemetry on the same call can create duplicate interactions.

Recommended. Choose this path when you want your coding agent to inspect the project, select a supported transport, make the smallest instrumentation change, send a test event, and verify that it reached Voxmith.

Install the skill once in your coding-agent environment:

npx skills add Voxmith/skills --skill voxmith

Run the framework-specific prompt below from the application root. Review the resulting diff before deploying it.

Use the voxmith skill to add Voxmith analytics to this DSPy application.
Org ID: your-org-id
Instrument the real DSPy module call and verify one fresh interaction.

Manual setup: Voxmith SDK

pip install voxmith
import voxmith

voxmith.init("your-org-id")
interaction = voxmith.begin(user_id="u-42", agent_name="dspy-qa", input=question)
try:
    result = qa(question=question)
    interaction.end(output=result.answer)
except Exception as exc:
    interaction.end(output=str(exc), success=False)
    raise
finally:
    voxmith.shutdown()

Manual setup: OpenTelemetry

Install

pip install dspy-ai openinference-instrumentation-dspy \
            opentelemetry-sdk opentelemetry-exporter-otlp-proto-http

Setup

import os, dspy
from openinference.instrumentation.dspy import DSPyInstrumentor
from openinference.instrumentation import using_attributes
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter

os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://otel.voxmith.com"
os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = "X-Voxmith-Org-ID=<your-org-id>"

provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
trace.set_tracer_provider(provider)
DSPyInstrumentor().instrument(tracer_provider=provider)

dspy.settings.configure(lm=dspy.LM("openai/gpt-4o-mini"))
qa = dspy.Predict("question -> answer")

with using_attributes(session_id="sess-123", user_id="u-42"):
    qa(question="What is OTel?")

Module/program/optimizer spans nest properly and carry dspy.module, dspy.signature, plus standard OpenInference input.value / output.value. Pair with a provider instrumentation (e.g. OpenAIInstrumentor) for the deepest trace tree.

Alternative: MLflow

If you already use MLflow, mlflow.dspy.autolog() works too: Voxmith reads mlflow.spanInputs / mlflow.spanOutputs.

Verify

Run one DSPy module call, then open Events in Voxmith. Confirm dspy.module and input/output attributes are present.

Troubleshooting

  • Instrument DSPy before calling modules.
  • Pair DSPy instrumentation with provider instrumentation if you need LLM-level spans.
  • Confirm OTEL_EXPORTER_OTLP_HEADERS contains X-Voxmith-Org-ID=<your-org-id>.

References

Next steps

  • Conversations: review the complete DSPy interaction.
  • Events: inspect module and model activity.
  • Intents: organize production conversations by what users wanted.