The video builds a full-stack chatbot using PydanticAI with OpenRouter LLMs, FastAPI as a decoupled backend, and Streamlit as the frontend, focusing on session-based local memory. We explore how PydanticAI stores conversation in result.all_messages, then implement memory by passing message_history into subsequent runs. Next, we create Pydantic data models (ChatRequest/ChatResponse) using ModelMessage, implement a chat function that returns response text plus message history, expose a POST /chat endpoint with FastAPI and Swagger examples, test memory via httpx, and finally build a Streamlit UI that stores messages and message_history in st.session_state to maintain conversational context across prompts.
Github repo
https://github.com/kokchun/youtube_de...
#fastapi #pydanticai
00:00 Project Overview
00:53 Setup and Files
02:31 Model Constants
03:59 Agent Basics
07:10 Session Memory
08:57 Chat Agent Function
11:17 Pydantic Data Models
14:20 FastAPI Endpoint
17:54 Testing Memory Flow
20:56 Streamlit Frontend
29:36 Live Demo and Wrap Up