DSPy
dspy.ai
- Free plan
- API
- Self-hosted
What DSPy is
DSPy is a free, MIT-licensed Python framework for building AI programs, including agent, extraction, and multimodal tasks. Developers define structured signatures with typed inputs and outputs, then compose modules for strategies such as step-by-step reasoning, tool use, and ensembles. Optimizers compile programs against a metric, using examples and a scoring function to tune prompts. DSPy uses LiteLLM to normalize model providers and accepts its model strings; named options include OpenAI, Anthropic, Google, and OpenRouter. Agent workflows can use dspy.ReAct, dspy.Tool, or dspy.ToolCalls, and remote MCP tools can connect through the tool interface. Images can be signature fields for multimodal work. The project began at Stanford NLP and has been built in the open since December 2022. It runs in Python 3.10+, installs with pip install dspy or uv add dspy, and supports API or self-hosted use. Documentation describes serving programs as REST APIs with FastAPI and deploying with FastAPI or MLflow. Community integrations include Weaviate, Qdrant, LangChain, Langfuse, and Weights & Biases Weave.
Who it suits
DSPy suits developers building AI systems who want typed task definitions, optimizable programs, tool use, or multimodal signatures. It is available for API and self-hosted deployments in Python 3.10+ environments.
Good to know, and what to watch
- Free and MIT licensed
- Typed signatures for task inputs and outputs
- Optimizers tune prompts against metrics
- Supports multiple model providers
- FastAPI REST serving documentation
- Requires Python 3.10 or newer
- Community language ports are not officially supported
- Provider access uses LiteLLM model strings
- Self-hosted deployment requires developer setup
The verdict
DSPy offers a code-first way to define, compose, and optimize AI programs across model providers. Its Python requirement and community-support limits matter when planning adoption.
What the maker publishes
- Agent tools
- DSPy supports tool-using agents through `dspy.ReAct` and manual tool handling with `dspy.Tool` and `dspy.ToolCalls`. source
- API serving
- The deployment guide shows serving a DSPy program as a REST API with FastAPI. source
- Community integrations
- The community page lists integrations and providers including Weaviate, Qdrant, LangChain, Langfuse, and Weights & Biases Weave. source
- Community project limits
- The site says community-maintained language ports are not officially supported by the DSPy team and their feature availability and API compatibility may vary. source
- Community support
- The overview links to DSPy documentation, GitHub, and Discord community resources. source
- Deployment
- The documentation describes deploying DSPy programs with FastAPI or MLflow. source
- Founded
- 2022 source
- Install
- DSPy can be installed with `pip install dspy` or `uv add dspy` and works in Python 3.10+ environments. source
- Installation
- DSPy can be installed with pip or uv and works in Python 3.10+ environments. source
- Integrations
- DSPy uses LiteLLM to normalize inference providers and says it can connect to nearly any model and provider supported by LiteLLM. source
- License
- The overview identifies DSPy as MIT licensed. source
- License
- The project is listed as MIT licensed. source
- Model integrations
- DSPy uses LiteLLM to normalize inference providers and accepts LiteLLM model strings, including options from Anthropic, Google, and OpenRouter. source
- Modules
- DSPy modules support different execution strategies, including step-by-step reasoning, tool use, and ensembles. source
- Modules
- DSPy modules provide different execution strategies, including reasoning, ensembles, tools, and REPL use. source
- Multimodal
- The overview describes images as a Signature field type for multimodal tasks. source
- Optimization
- DSPy optimizers compile programs against a metric using examples and a scoring function to tune program prompts. source
- Optimization
- DSPy optimizers compile programs against a metric using examples and a scoring function. source
- Origin
- DSPy says it started at Stanford NLP and was built in the open beginning in December 2022. source
- Project origin
- DSPy says it started at Stanford NLP and describes itself as built in the open since December 2022. source
- Provider examples
- The setup guide names OpenAI, Anthropic, Google, and OpenRouter as provider options. source
- Signatures
- Signatures define typed inputs and outputs for a task instead of requiring users to manage prompts directly. source
- Signatures
- Signatures define tasks as typed inputs and outputs. source
- Support
- The site links to a DSPy Discord community and GitHub repository. source
Checked against the maker's pages on 9 Oct 2026.