← Learning

Pydantic AI

A linear, one-concept-per-lesson path through Pydantic AI: a type-safe agent framework from the Pydantic team, where an agent's output is a validated Pydantic model, not a string you hope is JSON. 24 lessons · 3 tiers.

Prerequisites: Completion of LangChain & Agent Building, or already comfortable with @tool, bind_tools, and with_structured_output. Every lesson calls out the LangChain equivalent of the concept it introduces. Lesson 17 also assumes LangGraph Lessons 1-6, Lesson 18 assumes LangSmith Lessons 1-4, and Lesson 21 assumes the MCP course through Lesson 12.

Lessons use Google's Gemini free tier via the model string "google:gemini-3.5-flash-lite", Pydantic AI's equivalent of the ChatGoogleGenerativeAI model object in the LangChain course. A free GOOGLE_API_KEY from aistudio.google.com/apikey is all that's needed.

Built on Pydantic AI, the framework this course teaches.

Course source

Every lesson's README and lesson.py for this course live in the ai-agent-engineering repo.

View on GitHub →
Pydantic AI

Beginner

The core Agent API: typed output, system prompts, dependency injection, tools, and streaming.

  1. 01What Is Pydantic AI?GitHub
  2. 02First AgentGitHub
  3. 03Structured Output With Output TypeGitHub
  4. 04System PromptsGitHub
  5. 05Dependency InjectionGitHub
  6. 06Tools BasicsGitHub
  7. 07Tools With DepsGitHub
  8. 08Output Validators and RetriesGitHub
  9. 09Streaming OutputGitHub
  10. 10Checkpoint: Research Notes AssistantGitHub

Intermediate

Composing agents: conversation memory, multi-agent delegation, testing, evals, graphs, and tracing.

  1. 11Multi-Turn ConversationsGitHub
  2. 12Multi-Agent DelegationGitHub
  3. 13Usage Limits and Cost TrackingGitHub
  4. 14Testing With TestModelGitHub
  5. 15Pydantic Evals BasicsGitHub
  6. 16Structured Output UnionsGitHub
  7. 17Graph-Based AgentsGitHub
  8. 18Observability With LogfireGitHub
  9. 19Checkpoint: Support Triage SystemGitHub

Advanced

Production concerns: human approval, MCP as a client, model fallback, and durable execution.

  1. 20Human-in-the-LoopGitHub
  2. 21Pydantic AI as an MCP ClientGitHub
  3. 22Model Fallback and Provider ConfigGitHub
  4. 23Durable Execution PatternsGitHub
  5. 24Capstone: Order-Total AssistantGitHub
Start at Lesson 1

Contact

Book a Call