Skip to content

[Feature Request] Add Pydantic AI to Unit 2: Frameworks for AI Agents #659

@aaishwarymishra

Description

@aaishwarymishra

Issue Body:
Description
I would like to propose adding Pydantic AI as a featured framework in Unit 2 (Frameworks for AI Agents) or as a dedicated bonus unit.

Pydantic AI is a modern, lightweight, and strictly type-safe framework for building agentic workflows. Given the course's focus on teaching best practices for building reliable agents, Pydantic AI’s approach to "Model-Driven" development is a perfect fit.

Why Pydantic AI?
While the course currently covers excellent frameworks like smolagents and LangGraph, Pydantic AI offers a unique value proposition that aligns with modern Python development:

  • Type Safety & Validation: Leverages Pydantic (the industry standard) to ensure structured outputs are validated at the core.

  • "FastAPI of Agents": It feels familiar to anyone who has built web APIs in Python, reducing the learning curve.

  • Dependency Injection: It has a built-in, type-safe DI system that is perfect for production-grade agentic systems (e.g., passing DB connections or user context).

  • Lightweight & Minimalist: Like smolagents, it avoids over-abstraction, making it easier for students to see "under the hood."

Proposed Content Outline
I suggest a sub-unit (e.g., Unit 2.4) or a Bonus Unit covering:

Introduction to Pydantic AI: The philosophy of type-safe agents.

Defining Structured Outputs: Using Pydantic models to guarantee agent responses.

Tools & Dependency Injection: How to provide agents with external context and capabilities safely.

Streaming & Observability: Real-time responses and integration with tools like Logfire.

Hands-on Lab: Building a simple agent that takes a user query and returns a strictly validated JSON object (e.g., a "Weather Report" or "Financial Summary" agent).

Alignment with Hugging Face
Pydantic AI is model-agnostic and works seamlessly with Hugging Face models via OpenAI-compatible endpoints or local integration. It would complement smolagents by showing students how to scale from "code-first" agents to "schema-first" production systems.

Contribution
I am happy to help draft the content or provide examples for the notebook if the maintainers are open to this addition!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions