dspy
DSPy: The framework for programming—not prompting—language models
DSPy: programming language models instead of prompting them
A Python framework for building modular AI systems and optimizing their prompts and weights, aimed at everything from simple classifiers to RAG pipelines and agent loops.
The one line pitch
DSPy is the framework for programming, rather than prompting, language models. The name expands to Declarative Self-improving Python. Instead of brittle prompts, developers write compositional Python code, and DSPy teaches the language model to deliver high quality outputs. The scope is wide: simple classifiers, sophisticated RAG pipelines, and agent loops are all named as targets. The project is MIT licensed, in Python, with the documentation at dspy.ai.
The approach
The framework optimizes both prompts and weights. That means iteration happens on the module and algorithm level rather than on hand written prompt strings. The README points to the official documentation site and a Discord server for learning and community. The framework evolved from an earlier project, Demonstrate-Search-Predict, into the current DSPy, and that history is part of how the README explains what it is.
The papers behind it
The README carries a reading list tied to the approach. A July 2025 paper argues that reflective prompt evolution can outperform reinforcement learning. A June 2024 paper covers optimizing instructions and demonstrations for multi stage language model programs. The foundational October 2023 paper describes compiling declarative language model calls into self improving pipelines, with a December 2023 paper on DSPy Assertions and a July 2024 paper on fine tuning and prompt optimization alongside.
Where to follow and what it's for
The README names the channels for updates: the @DSPyOSS account on Twitter and the DSPy page on LinkedIn. The target uses are concrete, from simple classifiers through sophisticated RAG pipelines to agent loops. For a framework whose pitch is fast iteration, the README itself is kept short and pointed.
Community notes