framework
DSPy
DSPy is a framework for programming—not just prompting—LMs, with optimizers that tune pipelines and agent-like multi-step modules.
- Python
- framework
Best for
- Teams that want optimizable LM pipelines
- Research-to-production prompt programming
- Structured multi-step modules with metrics
Pros and cons
Pros
- Metric-driven optimization mindset
- Composable modules instead of brittle prompt strings alone
- Strong academic and engineering following
Cons / trade-offs
- Different paradigm than role/multi-agent frameworks
- Requires investment in metrics and datasets
Overview
DSPy treats LM applications as programs with modules and optimizers. For agentic systems, it shines when you can define metrics and systematically improve multi-step behavior rather than hand-tuning prompts forever.
Related reading
Agent Evaluation: How to Measure Reliability, Cost, and Success
A practical framework for evaluating agentic systems: task success, trajectories, tool correctness, cost, latency, and regression suites.
How to Choose an Agent Framework
A practical framework selection guide for agentic AI: control model, language, multi-agent needs, ecosystem, and production constraints.