Free courses · Venky

RAG systems end to end: from a basic pipeline to production agentic RAG

Build a company document assistant in Python and LangChain, then make it accurate, secure, measurable and agentic.

29 lessons · about 476 min · Free

Start the course

What it is

RAG is a pattern where your code finds the most relevant passages in your own documents and gives them to a language model to answer from.

Language models don't know your company's private, changing documents, and they invent answers when asked. RAG lets an assistant answer from those documents with citations you can check, without retraining the model.

What you'll be able to do

  • Explain what RAG is, name its types, and choose the right one for a problem
  • Prepare each document type and choose chunking strategies and retrieval algorithms to match
  • Evaluate with retrieval and answer metrics using Ragas, DeepEval and LangSmith, and troubleshoot failures stage by stage
  • Run RAG in production with permissions, injection defences, correct numbers, tracing and monitoring
  • Build agentic RAG in plain Python and as a LangGraph graph, and learn from real deployments

Who it's for

Engineers who can write Python and want to ship a document assistant that a company can trust in production.

Not for people new to programming, or for researchers looking for model training methods; this course builds systems from existing models.

Before you start: Comfortable reading and writing Python; Have called an LLM API once (send a prompt, read the reply).

How it starts

Retrieval-augmented generation (RAG) is a pattern for answering from your own documents. Your code finds the passages that match a question, puts them in the prompt, and asks a language model to answer from them.

The model writes the answer. Your documents supply the facts. That split is the whole idea, and every lesson in this course improves one side of it.

Meet Brightline Logistics, a fictional 4,000-person freight company. Its employees ask the same questions every day. How much can I spend on a hotel in Chicago? How do I reset my VPN token?

Ask a general model that question…

What you'll learn

  1. Foundations: what RAG is and a working pipeline

    1. Getting started: what RAG is and when to use it

      Explain what retrieval-augmented generation does, where it fits next to a plain model call, and when to skip it.

    2. Types of RAG: a map from naive to agentic

      Name the main kinds of RAG, from naive pipelines to graph, multimodal and agentic systems, and what problem each one solves.

    3. Lab: build the smallest RAG pipeline end to end

      Build a working question-answering pipeline over six policy documents in about 40 lines of Python.

    4. How embeddings and vector search find meaning

      Rebuild vector search from its parts and explain why similar meaning lands near in vector space.

    5. Document types: what each one breaks, and how to prepare it

      See how PDFs, scans, tables, spreadsheets, slides, emails, code, contracts and web pages each break a naive pipeline, and fix each one.

  2. Better retrieval: chunking and search

    1. Chunking documents so answers survive

      Split long policy documents into chunks that keep their meaning and context, and measure the difference.

    2. Chunking strategies compared: which to use when

      Compare seven chunking strategies on the same documents and pick the right one for each document type.

    3. Keyword search vs vector search, and fusing both

      Compare BM25 and vector search on the same questions and combine them with reciprocal rank fusion.

    4. Retrieval algorithms compared: which to use when

      Map the retrieval algorithms, from exact search to ANN indexes, sparse, dense, multi-vector and MMR, and pick one per need.

    5. Reranking the top results before the model reads them

      Add a cross-encoder reranker that rescores the top candidates, and order context so the model uses it.

    6. Rewriting the question before you search

      Improve retrieval for vague, multi-part and follow-up questions by rewriting, splitting and expanding them.

  3. Answers you can trust, measure and debug

    1. Lab: grounded answers with citations and refusals

      Write the generation step so answers cite their sources and say 'I don't know' when the context is silent.

    2. Measuring a RAG system with an evaluation set

      Build a small test set and score retrieval and answers so every change is measured, not guessed.

    3. Lab: evaluation methods and frameworks: Ragas and DeepEval

      Score Ask Brightline with the popular retrieval and answer metrics, using Ragas and DeepEval, and read what each score tells you.

    4. Troubleshooting a RAG system, symptom by symptom

      Trace a bad answer to the stage that caused it and apply the fix, using a repeatable debugging playbook.

  4. Production in a company

    1. Access control: only retrieve what the user may see

      Enforce document permissions at retrieval time so the assistant never leaks restricted content.

    2. Defending against prompt injection in retrieved text

      Stop instructions hidden inside documents from taking over the assistant, using layered defences.

    3. Running RAG in production: freshness, cost and monitoring

      Keep the index fresh, control cost and latency, and watch the system so failures surface before users report them.

    4. Real-world RAG: what worked, what failed, and why

      Study verified deployments and failures in finance, customer support and law, and draw the design lessons from each.

  5. Agentic RAG

    1. Lab: from a fixed pipeline to an agent with a search tool

      Turn retrieval into a tool the model can call, run a capped agent loop, and see when that beats a pipeline.

    2. Self-correcting retrieval: grade, retry, fall back

      Add a grader that checks retrieved chunks and the draft answer, then rewrites, retries or escalates.

    3. GraphRAG and routing across many sources

      Decide when a knowledge graph, a database query or plain retrieval answers a question best, and route to it.

    4. Lab: numbers, tables and financial documents

      See why basic RAG gets financial maths wrong, then fix it with structured extraction, a code tool and checks on every number.

  6. Frameworks: LangChain, LangGraph and LangSmith

    1. The RAG toolbox: what each library does and why you import it

      Open up what pip installs for RAG: what each library contains, which depend on which, and which you can skip.

    2. The framework landscape: LangChain, LangGraph, LlamaIndex, Haystack

      Map what each RAG framework gives you, what it hides, and when plain Python is the better choice.

    3. Lab: Ask Brightline in LangChain

      Rebuild the RAG pipeline with LangChain's loaders, splitters, vector store, retriever and chat model.

    4. Lab: agentic RAG as a LangGraph graph

      Build the grade, rewrite and retry agent from earlier as an explicit LangGraph graph with a loop cap.

    5. Lab: tracing, evaluating and monitoring with LangSmith

      Trace every request, run evaluations on a dataset, and set up production monitoring and feedback in LangSmith.

    6. Wrap-up: your production agentic RAG checklist

      Review the full system you built and test your judgement on real company scenarios.

Sources

Lessons cite these where they use them.

Leaderboard

Loading…

Questions

What is this course about?
RAG is a pattern where your code finds the most relevant passages in your own documents and gives them to a language model to answer from.
What will I be able to do after it?
Explain what RAG is, name its types, and choose the right one for a problem. Prepare each document type and choose chunking strategies and retrieval algorithms to match. Evaluate with retrieval and answer metrics using Ragas, DeepEval and LangSmith, and troubleshoot failures stage by stage. Run RAG in production with permissions, injection defences, correct numbers, tracing and monitoring. Build agentic RAG in plain Python and as a LangGraph graph, and learn from real deployments.
Who is it for?
Engineers who can write Python and want to ship a document assistant that a company can trust in production. Not for people new to programming, or for researchers looking for model training methods; this course builds systems from existing models.
How long does it take?
29 lessons in 6 modules, about 8 hours in total. Your progress is saved, so you can take it in short sessions.
What do I need to know first?
Comfortable reading and writing Python. Have called an LLM API once (send a prompt, read the reply).
Is it free?
Yes. It's free; you sign in so your progress and quiz results are saved.
Where does the content come from?
Lessons cite 86 sources where they use them, including LangGraph docs: Overview; Anthropic (2024), Building effective agents; Microsoft Learn: Changed and deleted blobs in indexing.
Start the course