Stanford's approach: stop writing prompts, compile and optimise them instead. Built by Stanford.
Common questions
Is DSPy free to use?
DSPy is open source and free to run yourself. You still pay whichever model provider you point it at, and this tutorial is free with no signup.
Do I need to know Python to use DSPy?
Basic Python is enough. Functions, dictionaries and imports cover most of what DSPy asks of you.
When should I not use DSPy?
When something else in prompt optimisation fits the job better. The others in that group are listed below.
Lessons for DSPy are being written. Meanwhile the Claude Code tutorial covers the same ground: state, tools, loops, memory and human approval. Most of it carries straight over.
Start the Claude Code tutorial →