Chapter 43: Vector Databases & RAG with LangChain
You will build a RAG skill BEFORE you learn RAG concepts.
This chapter follows the Skill-First Learning Pattern: In Lesson 0, you create a rag-deployment skill using tools from Chapter 3. Then you spend the chapter understanding what you built and making it better. By the end, you don't just "know RAG"—you OWN a production-ready skill that extends your Task API with semantic search.
The Architecture
This chapter uses a clean separation of concerns:
| Layer | Technology | Purpose |
|---|---|---|
| Ingestion | LangChain | Document loading, text splitting, embeddings |
| Storage/Retrieval | LangChain + Qdrant | Vector store, similarity search |
| Intelligence | OpenAI Agents SDK | Agent orchestration, LLM calls, conversation memory |
| Evaluation | RAGAS + LangSmith | Quality metrics, tracing |
Why this split? LangChain excels at document processing and retrieval. The Agents SDK (Chapter 34) excels at agent orchestration. Together, they give you the best of both worlds without framework lock-in.
The Skill-First Arc
L00: Build Your RAG Skill (20 min)
| └── Clone skills-lab, fetch LangChain docs, create skill
|
├── L01-02: Conceptual Foundation
| └── Why RAG? + Embeddings mental model
|
├── L03-04: LangChain for Data
| └── Document processing, Qdrant vector store
|
├── L05: RAG with Agents SDK
| └── Agent + retrieval tool pattern
|
├── L06: Task API Integration
| └── Your skill learns semantic task search
|
├── L07: RAG Evaluation
| └── LangSmith + RAGAS metrics
|
└── L08: Architecture Patterns (Capstone)
└── 8 RAG patterns—Simple to Agentic
Chapter Structure
| # | Lesson | Duration | Your Skill Improves |
|---|---|---|---|
| 0 | Build Your RAG Skill | 20 min | Created from LangChain docs |
| 1 | Why Agents Need External Knowledge | 25 min | Conceptual: parametric vs retrieval |
| 2 | Vector Embeddings Mental Model | 30 min | Conceptual: semantic similarity |
| 3 | LangChain Document Processing | 40 min | Add: chunking strategies |
| 4 | Qdrant Vector Store | 45 min | Add: vector storage patterns |
| 5 | RAG with OpenAI Agents SDK | 45 min | Add: agent + retrieval tool pattern |
| 6 | RAG for Task API | 50 min | Refine: semantic search endpoint |
| 7 | Evaluating RAG Quality | 45 min | Add: evaluation metrics |
| 8 | RAG Architecture Patterns | 60 min | Capstone: 2 patterns implemented |
Every Lesson Has Skill Reflection
Each lesson ends with "Reflect on Your Skill":
- Test: Does your skill handle this lesson's concepts?
- Identify gaps: What's missing?
- Improve: Add or refine the capability
By Lesson 8, you've tested and improved your skill 8+ times.
Prerequisites
- Chapter 40: FastAPI for Agents (Task API foundation)
- Chapters 34-36: Agent SDK chapters (agents know how to call tools)
- Chapter 3: skill-creator and fetching-library-docs
- Docker: For running Qdrant locally
The Running Example
Your Task API gets smarter. In Chapter 40, you built a Task API with CRUD operations. Now you extend it:
- Lessons 1-5: Learn how RAG works—embeddings, Qdrant, retrieval chains
- Lesson 6: Add
/tasks/search/semanticendpoint to your Task API - Lesson 8: Implement advanced RAG patterns for intelligent task recommendations
The key insight: Semantic search lets users find tasks by meaning, not just keywords.
What You'll Own
.claude/skills/
├── skill-creator/ # From Chapter 3
├── fetching-library-docs/ # From Chapter 3
├── fastapi-agent-api/ # From Chapter 40
└── rag-deployment/ # NEW - this chapter
This skill joins your growing Digital FTE toolkit.
The Mindset Shift
Traditional: "Teach me RAG" Agent Factory: "I own a RAG skill—help me make it better"
You're not here to learn. You're here to build assets.
Start with Lesson 0: Build Your RAG Skill.