DSPy logo

DSPy

Free tier

The framework for programming—not prompting—language models

Free·All audiences·Open source

Key strengths

Programming (not prompting) language modelsModular AI system composition in PythonAutomatic prompt and weight optimizationSupports RAG pipelines, classifiers, and agent loopsDeclarative Self-improving Python (DSPy) paradigm
Completely free
Founded 2022
Self-hostable

Facts verified against github.com on

Recent changes

  • Plans updated: Open-source Python library, free to install via pip under the MIT license.
What's changed across AI tools →

Get alerts when DSPy changes

Free. We'll email you when pricing, the free tier, API access or open-source status changes.

No ratings yet

DSPy is purpose-built for AI/ML researchers and developers working on:

  • RAG pipelines — compose retrieval and generation modules with typed signatures; optimize end-to-end retrieval + synthesis quality against a metric automatically.
  • Classifiers — define classification signatures and let DSPy optimizers tune few-shot examples or prompts to maximize accuracy on a labeled dataset.
  • Agent loops — build multi-step reasoning agents using modules like dspy.ReAct that chain tool use and LM calls in a structured, optimizable graph.
  • Modular LM system composition — assemble complex, multi-module pipelines in Python where each component is independently testable and the full system is jointly optimizable.
  • Prompt and weight optimization research — use built-in teleprompters to benchmark and improve LM program performance without manual prompt iteration.

DSPy is particularly well-suited when prompt brittleness, model swaps, or dataset shifts make hand-crafted prompts unsustainable.

Alternatives

Alternatives to DSPy

See all alternatives
Browse all 15 agent frameworks tools