maple-agent-tracing-dspy

Installation
SKILL.md

Maple agent tracing: DSPy

Goal: every conversation with the user's DSPy program shows up in Maple Agent Sessions as one session, with one turn per call to the program, a transcript, model calls with tokens and cost, tool calls with arguments, results and failures, and one lane per worker module.

Spans come from openinference-instrumentation-dspy. It records no tokens, no tool names, no agent spans and no session id; the steps below add all four. Do not skip any step.

Step 0: Detect versions and existing setup

  • Read pyproject.toml / requirements*.txt / uv.lock. Require dspy>=3.4. On 3.3 or older, tell the user this skill targets 3.4 and ask before upgrading.
  • Find how LMs are built: dspy.LM("provider/model", ...). Note any engine=, cache=, callbacks=, disable_history, max_history_size.
  • Search for an existing OpenTelemetry setup: TracerProvider(, set_tracer_provider, opentelemetry-instrument, logfire.configure, mlflow.dspy.autolog, phoenix.otel.register, LiteLLMInstrumentor, OpenAIInstrumentor.
    • An existing TracerProvider: reuse it. Add the OTLP exporter to it and pass it to instrument(). Never create a second provider.
    • LiteLLMInstrumentor / OpenAIInstrumentor from OpenInference: remove them (they double-count model calls on the LiteLLM engine and record nothing on the native one).
    • mlflow.dspy.autolog(): leave it if the user wants MLflow too, but it is not the Maple path.
  • Find where the program is called per user message (HTTP handler, CLI loop, worker). That is where the session id goes.
  • Find dspy.Parallel, dspy.Evaluate, ThreadPoolExecutor, threading.Thread around module calls.
  • Find dspy.streamify(...) calls and where they run relative to dspy.configure (see Streaming in Step 3).
  • Check for a dspy.Module subclass with an attribute named history (see "Do not").
Installs
5
GitHub Stars
1.9K
First Seen
Oct 8, 2026