Build a RAG AI Agent with REAL-TIME Source Validation (CopilotKit + Pydantic AI)

Dec 22, 2025Channel
AI Analysis
Data from YouTube Data API v3Updated Just now
Cole Medin
Cole Medin

198K subscribers

View Channel

Video Overview

Video Details

Published5 months ago
Duration17:02
Video IDBe2OQ3LQZcQ
Languageen
CategoryScience & Technology
PrivacyPublic
Made for KidsNo
Video TypeRegular Video

Performance Metrics

Views7.4K
Likes216
Comments23
Engagement Rate3.23%
Likes per 100 views2.92
Comments per 1K views3.11

Description

One of the biggest problems with RAG systems is you never know what sources the AI Agent actually used. Did it hallucinate? Did it pull from irrelevant docs? And no, citation is not enough. In this video, I show you how to solve that by building a RAG agent with human in the loop and source validation - users see the retrieved docs/chunks, approve or reject them, and only then does the agent synthesize an answer. This is especially powerful to have as a tool in your toolbelt as you are building RAG agents and refining them! CopilotKit just dropped v1.50 with a complete AG-UI native rewrite, and it's perfect for this. I'm using their new useAgent hook for real-time state sync between a Pydantic AI backend and React frontend, plus human-in-the-loop that let users control exactly what sources get used. ~~~~~~~~~~~~~~~~~~~~~~~~~~ - If you want to build generative UI like I did for this RAG agent, check out CopilotKit: https://copilotkit.ai ~~~~~~~~~~~~~~~~~~~~~~~~~~ - In partnership with AWS and Kiro, I'm hosting an AI Coding Hackathon in January with a $17,000 prize pool! See details and register for free here: https://dynamous.ai/kiro-hackathon - The Dynamous Agentic Coding Course is now FULLY released - learn how to build reliable and repeatable systems for AI coding: https://dynamous.ai/agentic-coding-course - RAG Agent with CopilotKit + AG-UI + Pydantic AI: https://github.com/coleam00/human-in-the-loop-rag-agent - Pydantic AI AG-UI Docs: https://ai.pydantic.dev/ui/ag-ui/ - CopilotKit useAgent Hook Docs: https://docs.copilotkit.ai/direct-to-llm/guides/use-agent-hook - CopilotKit A2UI Launch: https://docs.copilotkit.ai/whats-new/a2ui-launch ~~~~~~~~~~~~~~~~~~~~~~~~~~ 00:00 - Introducing the Human in the Loop RAG AI Agent 02:48 - Our Tech Stack - CopilotKit, Pydantic AI, and AG-UI 04:13 - The New useAgent Hook (Star of the Show) 06:02 - RAG Agent with Human Source Validation in Action 07:58 - Excalidraw Diagram for the Agent Architecture 10:11 - Quick Code Dive to Understand the RAG Flow 15:24 - New CopilotKit Release + Google A2UI Integration 16:30 - Final Thoughts ~~~~~~~~~~~~~~~~~~~~~~~~~~ Join me as I push the limits of what is possible with AI. I'll be uploading videos weekly - at least every Wednesday at 7:00 PM CDT!

Related Videos

More videos from Cole Medin