Lesson 05.06 · Phase 05 · Retrieval & Agentic RAG

Retrieval as a tool

A pipeline searches once, with the user's words, every time. An agent with a search tool decides whether to search, searches again with what it learned, and says "not documented" when the tool says nothing matched.

Learning objectives

  • Turn retrieval into tools (searchdocs, readdoc) inside the Phase 3 agent loop.
  • Design a search tool for a model to read: ids, scores, short text, and an explicit "no results above the threshold" message.
  • Compare an always-retrieve pipeline with an agent on small talk, single-hop, multi-hop and undocumented questions.
  • Explain what the agent pays for its flexibility: model calls, latency, and a new way to fail (not searching when it should).

Lesson 1's pipeline has one fixed shape: search with the question, answer from the top chunk. That shape is wrong for most of the conversation a real assistant has:

Loading the full lesson…