Skip to content
AgentAgent framework

dspy

Python framework to program LLM pipelines with typed signatures and auto-tuned prompts

Visit dspy.ai

dspy is an open-source agent framework for ai models and llm tooling. It is available on API, Linux, macOS, Windows and Self-hosted.

Pricing
Open source
Platforms
API, Linux, macOS
GitHub stars
39.4K
Last commit
Language
Python
License
MIT

Similar agents

About dspy

DSPy lets developers describe what a language model should do as typed inputs and outputs rather than hand-written prompt strings. Tasks are assembled from composable modules that choose how the model reasons, whether it runs ensembles, and whether it calls tools, so the same task definition can be reshaped without rewriting it.

The optimizer side takes a set of labelled examples and a scoring function, then adjusts prompts and demonstrations automatically until the measured quality stops improving. Research papers from the Stanford NLP group back several of the optimization methods.

DSPy is aimed at engineers building classifiers, retrieval-augmented pipelines and agent loops who want their LLM logic to be versioned, testable Python code instead of a collection of prompts. It is installed with pip and is open source under the MIT licence.

What it does

Typed signatures
Define a task by its inputs and outputs so the model interface stays readable and portable.
Composable modules
Swap reasoning strategies, ensembles or tool use without changing the underlying task definition.
Automatic prompt optimization
Tune prompts and demonstrations against examples and a scoring function until quality converges.
Research-backed methods
Optimizers and module types are based on published papers from the Stanford NLP group.
Python-native workflow
Pipelines are ordinary Python code that can be versioned, tested and iterated like any other module.

Good for

  • Building a text classifier whose prompts are tuned against labelled examples
  • Assembling retrieval-augmented generation pipelines with swappable components
  • Structuring multi-step agent loops that call tools inside a typed program
  • Replacing a collection of hand-edited prompts with a maintainable codebase

Pricing

Open source

Free open-source framework under the MIT licence.

Prices change. Check dspy.ai before you buy.

dspy FAQ

How do I install DSPy?

Run pip install dspy. The latest development version can be installed directly from the main branch of the GitHub repository.

What licence is DSPy released under?

DSPy is released under the MIT licence.

Where can I find the documentation?

Full documentation is hosted at dspy.ai, and the project has a Discord server for community help.

Is dspy free?

Yes. dspy is open source, so you can use and self-host it for free.

What are the best alternatives to dspy?

The closest alternatives to dspy are voice-lab, pydantic-deepagents, pydantic-ai, llama-cpp-agent and DemoGPT.

Where this comes from

  • Description: written from the project's README and the project's website.