dspy-debugging-observability

dspy-debugging-observability is a skill for Claude Code from OmidZamani/dspy-skills. It costs 35 tokens per session (2,069 once invoked), scanned A, original, MIT.

A set of tools for inspecting and monitoring DSPy programs, which are programs that use language models in structured steps. It can show execution traces and collect information such as cost, response time, errors, and token use.

In plain words
What is it for?
Use it to inspect call history, trace DSPy workflows, add custom callbacks, monitor production behavior, measure latency and costs, and examine optimizer behavior.
Why use it?
It helps explain unexpected model output and reveals what happened during multi-step program runs. For deployed systems, it provides data for tracking reliability and usage.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the dspy-skills plugin — 24 skills shipped together

Good fit Use it to inspect call history, trace DSPy workflows, add custom callbacks, monitor production behavior, measure latency and costs, and examine optimizer behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/omidzamani/dspy-skills/dspy-debugging-observability
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add OmidZamani/dspy-skills --skill dspy-debugging-observability
Clone the repo
git clone --depth 1 https://github.com/OmidZamani/dspy-skills

Made for: Claude Code.

Or install dspy-skills, the plugin that ships this one along with the rest of its 24 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dspy-debugging-observability

README.md
[![agentmods](https://agentmods.dev/badge/skills/omidzamani/dspy-skills/dspy-debugging-observability/github.svg)](https://agentmods.dev/skills/omidzamani/dspy-skills/dspy-debugging-observability)
Your own site
<a href="https://agentmods.dev/skills/omidzamani/dspy-skills/dspy-debugging-observability"><img src="https://agentmods.dev/badge/skills/omidzamani/dspy-skills/dspy-debugging-observability/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dspy-debugging-observability

Your own site · 80×15
<a href="https://agentmods.dev/skills/omidzamani/dspy-skills/dspy-debugging-observability"><img src="https://agentmods.dev/badge/skills/omidzamani/dspy-skills/dspy-debugging-observability.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,069 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.02069
Opus 5 $0.00017 $0.01035
Sonnet 5 $0.00007 $0.00414
Haiku 4.5 $0.00003 $0.00207

Measured 11d ago against content hash b8ef162ce080, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

dspy-debugging-observability scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (example.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/dspy-debugging-observability/SKILL.md · 260 lines

How it starts

The opening of the file, as written. The whole thing — 260 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DSPy Debugging & Observability

Goal

Debug, trace, and monitor DSPy programs using built-in inspection, MLflow tracing, and custom callbacks for production observability.

When to Use

  • Debugging unexpected outputs
  • Understanding multi-step program flow
  • Production monitoring (cost, latency, errors)
  • Analyzing optimizer behavior
  • Tracking LLM API usage

Inputs

Input Type Description
program dspy.Module Program to debug/monitor
callback BaseCallback Optional custom callback (subclass of dspy.utils.callback.BaseCallback)

Outputs

Output Type Description
GLOBAL_HISTORY list[dict] Raw execution trace from dspy.clients.base_lm
metrics dict Cost, latency, token counts from callbacks

Workflow

Phase 1: Basic Inspection with inspect_history()

The simplest debugging approach:

import dspy

dspy.configure(lm=dspy.LM("openai/gpt-4o-mini"))

# Run program
qa = dspy.ChainOfThought("question -> answer")
result = qa(question="What is the capital of France?")

# Inspect last execution (prints to console)
dspy.inspect_history(n=1)

# To access raw history programmatically:
from dspy.clients.base_lm import GLOBAL_HISTORY
for entry in GLOBAL_HISTORY[-1:]:
    print(f"Model: {entry['model']}")
    print(f"Usage: {entry.get('usage', {})}")
    print(f"Cost: {entry.get('cost', 0)}")

Phase 2: MLflow Tracing

MLflow integration requires explicit setup:

import dspy
import mlflow

# Setup MLflow (4 steps required)
# 1. Set tracking URI and experiment
mlflow.set_tracking_uri("http://localhost:5000")
mlflow.set_experiment("DSPy")

# 2. Enable DSPy autologging
mlflow.dspy.autolog(
    log_traces=True,              # Log traces during inference
    log_traces_from_compile=True, # Log traces when compiling/optimizing
    log_traces_from_eval=True,    # Log traces during evaluation
    log_compiles=True,            # Log optimization process info
    log_evals=True                # Log evaluation call info
)

dspy.configure(lm=dspy.LM("openai/gpt-4o-mini"))

# Configure retriever (required before using dspy.Retrieve)
rm = dspy.ColBERTv2(url="http://20.102.90.50:2017/wiki17_abstracts")
dspy.configure(rm=rm)

class RAGPipeline(dspy.Module):
    def __init__(self):
        self.retrieve = dspy.Retrieve(k=3)
        self.generate = dspy.ChainOfThought("context, question -> answer")

    def forward(self, question):
        context = self.retrieve(question).passages
        return self.generate(context=context, question=question)

pipeline = RAGPipeline()
result = pipeline(question="What is machine learning?")

# View traces in MLflow UI (run in terminal): mlflow ui --port 5000

Read the full file on GitHub · 260 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 260 lines · 35 tokens per session scan A b8ef162ce080

Subscribe to this mod's changes

dspy-debugging-observability is a skill published in the GitHub repository OmidZamani/dspy-skills (123 stars, last pushed 2mo ago), licensed MIT. It adds 35 tokens to every session and 2,069 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

evolving-ai-agents

Provides guidance for automatically evolving and optimizing AI agents across any domain using LLM-driven evolution algorithms. Use when building self-improving agents, optimizing agent prompts and skills against benchmarks, or implementing automated agent evaluation loops.

Orchestra-Research/AI-Research-SKILLs · 49 tokens

superpowers

Runs 14 numbered engineering protocols in one pack — brainstorm, spec, plan, scaffold, TDD red-green-refactor, systematic debugging, refactoring, code review, performance, security, docs, git hygiene, release checklist, postmortem. Use when the user says "build this feature properly", "debug this systematically"…

alebgl77/claude-inc · 102 tokens

objection-handler

Turns prospect pushback into progress — diagnoses the real objection behind the stated one and scripts calm, honest responses for price, timing, competitor, authority and brush-off objections. Use when the user says "they said it's too expensive", "prospect went silent", "they're comparing us to X", "how do I answer…

alebgl77/claude-inc · 79 tokens

ooda-loop

Activate when: competitor outmaneuvers you despite worse resources; decisions take longer than the situation allows; team is losing a competition they should win; setting up crisis or incident response; someone says 'Boyd', 'decision cycle', 'get inside their loop', or 'tempo'. Do NOT activate when: situation is…

deciqAI/knowledge-skills · 99 tokens

premortem

Activate when: user says 'let's check what could go wrong before we commit', 'I want to stress-test this plan', 'we're about to launch and I'm worried we're missing something', 'premortem', or is about to make a hard-to-reverse decision with a team that has converged on one plan. Do NOT activate when: the decision is…

deciqAI/knowledge-skills · 111 tokens

bug-reporting

Load this skill whenever you are filing, reviewing, or generating accessibility bug reports — whether from automated tool output, manual testing, user reports, or testing with disabled people. The purpose of this skill is to make accessibility findings easier to report accurately, connect them to real people and…

mgifford/accessibility-skills · 122 tokens