DSPy: Build and Optimize Agentic Apps
Instructor: Chen Qian

- Intermediate
- 49 Minutes
- 6 Video Lessons
- 4 Code Examples
- Instructor: Chen Qian
What you'll learn
Learn the fundamentals of DSPy and how to use its signature and module-based programming model to build modular, traceable, and debuggable GenAI agentic applications.
Build agentic applications by chaining DSPy modules like Predict, ChainOfThought, and ReAct, and use MLflow to trace and debug your programs.
Optimize your GenAI apps with DSPy Optimizer by automating prompt tuning and improving few-shot examples to improve answer accuracy and consistency.
About this course
Join DSPy: Build and Optimize Agentic Apps, built in partnership with Databricks and taught by Chen Qian, a software engineer at Databricks and co-lead maintainer of the DSPy framework.
Agentic AI applications tackle complex tasks such as document automation, question-answering, and multi-step decision-making. However, building these applications can become complex and one challenge is writing and maintaining good prompts. DSPy is a flexible open-source framework that simplifies your application’s interaction with LLMs. It streamlines your workflow by utilizing modular blocks in which you can provide a dataset of inputs and desired output, and systematically build, trace, and optimize your application.
This course teaches you how to use DSPy to build and optimize LLM-powered applications. You’ll write programs using DSPy’s signature-based programming model, debug them with MLflow tracing, and automatically improve their accuracy with DSPy Optimizer. Along the way, you’ll see how DSPy helps you easily switch models, manage complexity, and build agents that are both powerful and easy to maintain.
You’ll immediately put the concepts to work, first by coding a sentiment classifier in roughly 30 lines, then stretching the same pattern into a “Name the Celebrity” guessing game. Next, you’ll trace every step of a travel-booking assistant with MLflow, and wrap up by letting DSPy Optimizer lift a Wikipedia-based RAG agent’s accuracy, all without hand-tuning prompts.
In detail, you’ll learn:
- What makes DSPy different from other development frameworks, and how its signature-based design enables flexible, model-agnostic development.
- How to compose agentic apps by chaining DSPy modules like Predict, ChainOfThought, and React, and debug them using MLflow tracing, demonstrated in both a sentiment analyzer and a “Name the Celebrity” guessing game.
- How to visualize and interpret your DSPy programs using MLflow, an open-source MLOps framework for observability that makes it easy to understand submodule behavior and catch issues early.
- How to use DSPy Optimizer to automatically improve your program quality through prompt tuning and few-shot examples, seen through an example of optimizing a Wikipedia RAG agent that improves from 31% to 54% exact-match accuracy.
By the end of this course, you’ll be able to build structured, robust, and adaptable GenAI applications with DSPy, ready to run on whichever LLM comes next.
Who should join?
This course is ideal for anyone who wants a more reliable, maintainable way to build and debug multi-step agents. No prior DSPy experience or knowledge is required.
Course Outline
6 Lessons・4 Code ExamplesIntroduction
Video・3 mins
Introduction to DSPy
Video・4 mins
DSPy Programming - Signatures and Modules
Video with code examples・17 mins
Debug Your DSPy Agent with MLflow Tracing
Video with code examples・11 mins
Optimizing Agents with DSPy Optimizer
Video with code examples・10 mins
Conclusion
Video・1 min
Appendix – Tips, Help, and Download
Code examples・1 min
Instructor
DSPy: Build and Optimize Agentic Apps
- Intermediate
- 49 Minutes
- 6 Video Lessons
- 4 Code Examples
- Instructor: Chen Qian
Course access is free for a limited time during the DeepLearning.AI learning platform beta!
Want to learn more about Generative AI?
Keep learning with updates on curated AI news, courses, and events, as well as Andrew’s thoughts from DeepLearning.AI!