Why you'd want it
DSPy replaces hand-written prompts with Python code: signatures declare typed inputs and outputs, and modules such as Predict, ChainOfThought and ReAct control how a signature runs, including tool use. You compose modules with plain Python control flow into pipelines, RAG systems or agent loops. Optimizers such as GEPA, MIPROv2 and BootstrapFewShot take examples and a scoring function and tune the program's prompts and weights, and the result can be saved and reloaded.
Best for
- Multi-step LLM pipelines
- Teams with labeled examples and a metric
- Replacing brittle prompt templates
Use it when
You want LLM behavior defined in code and improved systematically against a metric rather than by editing prompts by hand.
Skip it if
You only need a single prompt or one structured extraction call. Optimization needs example data and a scoring function, and it requires Python 3.10 or later.