DSPy
DSPy (Declarative Self-improving Python) is Stanford NLP's MIT-licensed framework for programming rather than prompting language models. You write modular Python components (signatures and modules) for classifiers, RAG pipelines or agent loops, and DSPy's optimizers tune the prompts and, optionally, the model weights against your metric, so the pipeline improves without hand-editing brittle prompts. Install it with pip install dspy; docs live at dspy.ai.
Updated
✨ Try AgentScout's free AI image generator →Good for: writing code, building AI agents
Use cases
About DSPy
DSPy is listed in our frameworks category and is aimed at builders. DSPy (Declarative Self-improving Python) is Stanford NLP's MIT-licensed framework for programming rather than prompting language models. You write modular Python components (signatures and modules) for classifiers, RAG pipelines or agent loops, and DSPy's optimizers tune the prompts and, optionally, the model weights against your metric, so the pipeline improves without hand-editing brittle prompts. Install it with pip install dspy; docs live at dspy.ai. Pricing, as the maker states it: Open source. Maturity: Mature. We last checked the official link on 2026-12-01.
What is DSPy?
DSPy is a framework for programming, rather than prompting, language models. You write compositional Python code to build modular AI systems, from classifiers to RAG pipelines and agent loops.
It includes algorithms that optimize your prompts and weights, so the model learns to produce high-quality outputs. DSPy stands for Declarative Self-improving Python.
Sources: the official README and our directory listing, checked 2026-10-18. Official site: dspy.ai.
Who is DSPy for?
Developers and researchers building LLM pipelines who want to replace brittle hand-written prompts with code that can be optimized automatically.
DSPy at a glance
- Open source: Yes (MIT License)
- GitHub: stanfordnlp/dspy · 39,350 stars (as of Dec 2, 2026)
Key features
- Declarative Python modules instead of hand-written prompts
- Optimizers for prompts and weights
- Works for classifiers, RAG pipelines and agent loops
- Open source with an active community
DSPy FAQ
What is DSPy?
DSPy is a framework for programming, rather than prompting, language models. You write compositional Python code to build modular AI systems, from classifiers to RAG pipelines and agent loops.
Who is DSPy for?
Developers and researchers building LLM pipelines who want to replace brittle hand-written prompts with code that can be optimized automatically.
Is DSPy free?
DSPy's pricing, as the maker states it: Open source. Open-source tools are free to use, though you may still pay for model API usage or a hosted plan. Check the official site for current plans.
Is DSPy open source?
Yes. DSPy is released under the MIT License, according to its GitHub repository.
What are alternatives to DSPy?
Similar tools include LlamaIndex, Guidance, MCP-Nest, SkillOpt, Cutcli Cookbook and A2UI.
DSPy ratings and reviews
Be the first to rate DSPy: tap 1 to 5 stars below. A written review is optional.
DSPy alternatives
Other frameworks tools in our directory. See all frameworks tools →
LlamaIndex
LlamaIndex is an MIT-licensed Python framework for building agents and RAG pipelines over your own documents and data, with connectors, indexes, query engines and agent workflows. The company now focuses on document parsing and extraction: LlamaParse is its hosted platform for agentic OCR, parsing, extraction and indexing, and LiteParse is a free, fast open-source parser.
Guidance
Guidance is an MIT-licensed Python library for steering language models: instead of plain prompts you write programs that mix generation with control flow (conditionals, loops, tool calls) and constrain output with regular expressions, context-free grammars or JSON schemas, which makes structured output reliable and can cut latency and cost. It runs on Transformers, llama.cpp, OpenAI and other backends (pip install guidance); the latest release is 0.3.2 from March 2026.
MCP-Nest
MCP-Nest is an MIT-licensed NestJS module for building Model Context Protocol servers. You use it to expose tools, resources and prompts from a NestJS app to an MCP client. The repository does not list a separate marketing site.
SkillOpt
SkillOpt is Microsoft's MIT-licensed optimizer that trains reusable natural-language skills for frozen language-model agents without touching model weights. It runs epochs and mini-batches over agent trajectories, proposes text edits, keeps only changes that pass validation gates, and exports a deployable skill file. It is on PyPI, and the paper is a NeurIPS 2026 spotlight.
Cutcli Cookbook
Cutcli Cookbook is an open-source agent project that helps builders handle cookbook, JSON templates, AI prompts and docs for cutcli — the CapCut.
A2UI
A2UI (Agent-to-User Interface) is an Apache-2.0 generative UI framework: agents stream layout data over a protocol built for low-latency updates, and your app renders it with native components instead of plain chat text. It ships renderers for React, Angular, Lit, Flutter, SwiftUI and Jetpack Compose, agent SDKs in several languages, a published v1.0 specification and A2UI Composer, a browser playground for trying UI compositions.