In Module 2, RAG looked like the answer to "how do I give a model my documents?"
RAG is still a standard technique, but it is no longer the only option, and for some jobs it is no longer the simplest.
There are three approaches to compare.
The Three Approaches
Long context. You put the documents straight into the prompt.
This works when everything fits in the context window.
Context windows have grown: Anthropic lists 1 million tokens for its Claude 5.5 models, and Google lists 1 million for its Gemini 4 models.
For Claude, Anthropic estimates that 1 million tokens is roughly 555,000 words.
Prompt caching makes repeat use cheaper: with Claude, a cache read costs a fraction of the normal input price, and the default cache lifetime is 5 minutes, refreshed each time the cached text is used.
RAG. You index the documents ahead of time, retrieve the few most relevant chunks for each question, and give only those to the model (Module 2).
Agentic search. You give the model search tools (keyword search, file reading, database queries, a vector search) and let it decide what to look up, read the results, and look again until it has enough.
It is the agent loop from Module 3 applied to finding information.
Trade-offs at a Glance
| Long context | RAG | Agentic search | |
|---|---|---|---|
| Setup effort | Lowest | Highest (chunking, embeddings, index) | Medium (tools and guardrails) |
| Cost and speed per question | High per question unless cached | Low and predictable | Variable: several model calls per question |
| Handles huge or fast-changing collections | No | Yes | Yes |
| Good at exact terms, codes, names | Yes, if it fits | Weaker with semantic search alone; add keyword (hybrid) search, lesson 2.7 | Strong, with keyword tools |
| Multi-step questions | Only if all sources fit | Weak in a single pass | Strong |
| Citations | Possible, you must ask | Natural (you know the chunks) | Possible, from what it read |
| Main risk | Cost, and details lost in a very long prompt | Wrong chunks retrieved | Wandering, slow, runaway cost |
This table is a rule of thumb from how the approaches work, not a benchmark.
A Decision Rule
Work down these questions in order and stop at the first "yes".
-
Does all of it fit comfortably in the context window, and does it change rarely? Use long context, and turn on caching if the same documents are used repeatedly. This is the simplest thing that can work, so start here.
-
Is the collection too big or too fast-changing, and are most questions simple lookups that need a specific passage and a citation? Use RAG.
-
Are the questions multi-step or exploratory, or do they depend on exact terms, structure, or live systems (code, logs, tickets, a database)? Use agentic search, with step limits and logging (lesson 3.8).
-
Do you have both kinds of question? Make RAG one of the tools the agent can call. Many real systems end up here.
Then Test It
Whichever you pick, write 15 to 20 real questions from your own users, with the answers you would accept, before you commit.
Run them through the simplest option first, and move to a more complex one only when the failures justify it.
Measure three things: how often the answer is right, how long it takes, and what each question costs.
If you cannot say which of the three you are optimizing, you are not ready to choose.