dspy

Optimize prompts and build modular AI systems with dspy.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/hhhi21g/HealthCenter --skill dspy-hhhi21g
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/hhhi21g/HealthCenter/tree/main/.codex/skills/dspy
Command: npx skills add https://github.com/hhhi21g/HealthCenter --skill dspy-hhhi21g

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires dspy, openai, anthropic, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides a platform for declarative programming and automated AI development, allowing users to optimize prompts, build modular AI systems, and streamline the entire AI development process.

Core Features & Use Cases

  • Declarative Programming: Build complex AI systems with declarative programming, optimizing prompts automatically and creating modular RAG systems and agents.
  • Modular AI Systems: Develop maintainable and portable AI pipelines.
  • Use Case: For example, you can use this Skill to build a RAG system that retrieves relevant documents and generates an answer, or to create an agent that can perform a sequence of tasks with tools.

Quick Start

To get started, install the Skill with the following command:

pip install dspy

Frequently Asked Questions about dspy

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

FAQPage Schema
How do I optimize prompts automatically for AI development?

Automated prompt optimization is achieved through declarative programming, which abstracts prompt engineering into modular pipelines. This approach allows the system to compile and refine prompts automatically, streamlining the AI development process without manual tuning.

What is declarative programming for building modular AI systems?

Declarative programming for modular AI systems separates the logic of what a pipeline should accomplish from the specific prompt instructions. This creates maintainable, portable AI pipelines where components like RAG systems and agents are defined by their behavior.

Can I build RAG systems and agents with dspy and OpenAI?

Yes, you can build RAG systems and agents using dspy alongside OpenAI and Anthropic libraries. The framework supports modular AI system development, allowing you to create agents that perform sequential tasks with tools and RAG systems that retrieve and generate answers.

How do I get started with declarative AI pipelines?

To get started with declarative AI pipelines, install the required dspy package and its associated libraries like openai and anthropic. This setup provides the foundation for building modular RAG systems, agents, and automated prompt optimization workflows.

Do I need specific dependencies to automate prompt optimization?

Yes, automating prompt optimization requires the dspy library along with associated API libraries such as openai and anthropic. These dependencies provide the underlying model interfaces and framework components necessary to execute and compile declarative AI pipelines.

When should I use declarative programming for AI instead of manual prompt engineering?

Declarative programming is preferred over manual prompt engineering when building complex, modular AI systems that require maintainability and portability. It automates optimization, making it ideal for developing scalable RAG systems and multi-step agents rather than single isolated prompts.