# stanfordnlp/dspy

DSPy: The framework for programming—not prompting—language models

Repository: https://github.com/stanfordnlp/dspy
Canonical: https://ross.abutalabs.com/products/dspy
Homepage: https://dspy.ai
Language: Python
License: MIT
License Family: permissive
Last push: 2026-08-27T00:36:42+00:00

## Health v2 (maintenance only)
Score: 94/100 (v2, computed 2026-09-03T02:39:23.370411+00:00)
- activity 99, release rhythm 86, longevity 95
- inputs: {"age_days": 1332, "days_push": 7, "days_rel": 12, "gap_med": 2, "n_releases_24m": 98}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 37612, forks 3261 (observed 2026-08-28T04:12:01.477781+00:00)

## What it is
DSPy is a Python framework from Stanford NLP for programming language model systems with declarative signatures and modules instead of hand-written prompts. It includes optimizers (like GEPA and MIPRO) that automatically tune prompts and weights of multi-stage LLM pipelines, RAG systems, and agents.

## Use cases
- build modular LLM pipelines without hand-writing brittle prompts
- automatically optimize prompts and few-shot examples against a metric
- build RAG pipelines with retrieval and generation stages
- create tool-using agents with ReAct-style loops
- make small cheap models match hand-prompted frontier models
- swap LLM providers without rewriting prompt strings
- fine-tune and prompt-optimize multi-stage programs together
- extract structured data from text with typed signatures

## When to choose
- you are building multi-stage LLM programs, RAG pipelines, or agents that need maintainability
- you want automated prompt/weight optimization instead of manual prompt tweaking
- you want provider-agnostic LLM code that works across OpenAI, Anthropic, local models, etc.
- you are an NLP researcher or practitioner exploring new pipelines and tasks

## When to avoid
- you need a one-off simple LLM call where a single prompt template suffices
- you want a full application framework with UI, deployment, and chat interfaces built in
- you cannot provide evaluation examples or metrics for the optimizers to work with

## Facets
- artifact type: framework
- maturity: active
- function: agent-framework, llm-inference, prompt-engineering, rag, llm-training, machine-learning
- domain: large-language-models, artificial-intelligence, machine-learning, developer-tools
- platform: python, cross-platform
- tags: prompt-optimization, signatures, declarative-llm-programs, llm-optimizers, chain-of-thought, react-agents, stanford-nlp, litellm, ai-agents, retrieval-augmented-generation, natural-language-processing

## Member repositories
- stanfordnlp/dspy (main) score 94

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:12:01.477781+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T16:25:37.387483+00:00, confidence not recorded.
  - readme: https://github.com/stanfordnlp/dspy (fetched 2026-08-28T04:12:01.477781+00:00, sha 5450bc9856bc)
  - homepage: https://dspy.ai (fetched 2026-08-29T07:47:25.988380+00:00, sha 999161470ba0)
  - site_page: https://dspy.ai/getting-started/program-dont-prompt (fetched 2026-08-29T07:47:26.003323+00:00, sha d08e69743c86)
  - site_page: https://dspy.ai/getting-started/installation (fetched 2026-08-29T07:47:26.005636+00:00, sha a10567bf4dd8)
  - site_page: https://dspy.ai/getting-started/first-program (fetched 2026-08-29T07:47:26.007995+00:00, sha 63833fc93ada)
  - site_page: https://dspy.ai/getting-started/expanding-signatures (fetched 2026-08-29T07:47:26.010052+00:00, sha 7327ed7954d7)
  - site_page: https://dspy.ai/getting-started/class-based-signatures (fetched 2026-08-29T07:47:26.012198+00:00, sha 0e0ec23770d9)
  - site_page: https://dspy.ai/getting-started/changing-modules (fetched 2026-08-29T07:47:26.014325+00:00, sha 86aea5f68817)
  - site_page: https://dspy.ai/getting-started/react-and-tools (fetched 2026-08-29T07:47:26.016567+00:00, sha d11d2815437b)
  - registry_pypi: https://pypi.org/pypi/dspy/json (fetched 2026-08-29T07:47:26.018476+00:00, sha 00b5aa6babdd)
- Data as of 2026-08-30T08:39:29.467469+00:00.
