dspy

Build self-improving AI pipelines with declarative DSPy modules.

1|Updated Apr 21, 2026
One-click install
npx skills add https://github.com/ChangZhou-xj/zxj_skill --skill dspy-changzhou-xj
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/ChangZhou-xj/zxj_skill/tree/main/mlops/research/dspy
Command: npx skills add https://github.com/ChangZhou-xj/zxj_skill --skill dspy-changzhou-xj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

DSPy provides a declarative framework to assemble multi-stage AI systems, replacing ad-hoc prompts with structured modules, improving reproducibility and reliability.

Core Features & Use Cases

  • Declarative LM programming with signatures and modules to coordinate complex tasks such as RAG, agents, and multi-stage reasoning.
  • Auto-prompt optimization and evaluation using data-driven metrics to improve outputs with minimal manual tuning.
  • Modular workflows that scale across providers (OpenAI, Anthropic, etc.) and support iterative improvement through optimizers.

Quick Start

Run a minimal DSPy example to build a small RAG-style workflow and observe the end-to-end pipeline in action.

Frequently Asked Questions about dspy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build self-improving LM pipelines for multi-stage reasoning?

Self-improving LM pipelines use declarative programming to replace ad-hoc prompts with structured modules, applying data-driven metrics and auto-prompt optimization to iteratively improve multi-stage reasoning outputs.

What is declarative LM programming and how does it optimize prompts?

Declarative LM programming assembles AI systems using signatures and modules instead of manual prompts, enabling auto-prompt optimization through data-driven evaluation metrics to improve reproducibility and reliability.

Can I use DSPy to build RAG pipelines and agents across different providers?

Yes, modular workflows scale across providers like OpenAI and Anthropic, supporting declarative coordination of complex tasks such as RAG and agents with iterative improvement through optimizers.

Do I need Python and LM provider APIs to run declarative LM pipelines?

Yes, declarative LM pipelines require Python and DSPy primitives, along with optional LM provider APIs and evaluation components to execute end-to-end multi-stage workflows and auto-prompt optimization.

Why should I use declarative modules instead of manual prompts for AI workflows?

Declarative modules replace ad-hoc manual prompts with structured, reproducible workflows, enabling data-driven auto-prompt optimization and evaluation to improve reliability across multi-stage reasoning systems.

What are the limitations of auto-prompt optimization for multi-stage reasoning systems?

Auto-prompt optimization relies on data-driven evaluation metrics and iterative optimizers, requiring structured Python modules and provider APIs, which may limit quick prototyping without proper evaluation components.