# Mission 11.1: The whole manual in the prompt, or RAG?

Part of the course “AI from Zero to Autonomous Agents” (https://llm.yoga/en). Page for humans: https://llm.yoga/en/einsatz-11-1

Belongs to [Chapter 11: RAG, embeddings and grounding](https://llm.yoga/en/11-rag.md).

Structure: the case, the explanation, a hands-on tool, check questions, wrap-up. The answers to all questions are collected at the end.

## The case

**Stefan**, head of customer service:

> “Our service manual has 500 pages. Claude reads a million tokens at once, doesn’t it? Why should I have someone build a RAG system? I’ll just send the whole manual along with every question.”

Tokens are the word pieces a language model splits text into; providers bill by them, with input and output charged separately. RAG means a program looks up the relevant sections before the answer, and only those go to the model. Stefan’s way sends everything. Both cost input tokens, on every single question.

**Assumptions from the worked example in the chapter**

The manual has about 200,000 tokens, roughly 500 pages. Stefan’s team asks 50 questions a day.

For each question, RAG sends 20 sections of 800 tokens each, 16,000 tokens in total (the assumptions from Anthropic’s article on contextual retrieval).

Claude Opus 5.5: $4 per million input tokens (Anthropic’s pricing page, as of November 25, 2026). Only the manual part is counted; the question and answer add the same amount in both cases.

**Question 1 (prediction):** What does the manual part of one question cost if the whole manual goes along?

- A) About $0.08, so hardly more than RAG.
- B) About $0.80, just over twelve times as much as RAG.
- C) Almost nothing. Claude already knows the manual.

## What’s behind it

Think of an open-book exam. Stefan wants to copy the whole binder and hand it in with every question. RAG puts down only the twenty pages where the answer probably is.

That’s **RAG** (retrieval-augmented generation): look things up before answering and put only the passages found into the prompt. That saves tokens, $0.064 instead of $0.80 per question. But there’s a second lever, **prompt caching**. The prompt is everything that goes to the model with a request. If it starts the same, character for character, on every request, Anthropic keeps the processing of that beginning in temporary storage, the cache. The first write costs 1.25 times the input price, so $1.00 for the manual. With Opus 5.5, each further hit costs a twentieth: $0.04. As long as the cache is warm, the whole manual is even cheaper than RAG. The catch: the cache lasts five minutes, and each hit extends that. If the questions are spread across the day, almost every question writes again and costs $1.00.

For Stefan, this means his idea isn’t wrong. Anthropic itself advises putting a knowledge base under 200,000 tokens, about 500 pages, entirely into the prompt, and his manual sits right at that limit. Whether it gets expensive depends on the gap between questions. RAG still pays off if the manual keeps growing, changes often, some people are only allowed to see parts of it, or every answer needs an exact reference. And in very long texts, models find passages in the middle less well than at the beginning and end (“Lost in the Middle”).

### In more detail: the math from the chapter

Whole manual without caching: 200,000 × $4 / 1,000,000 = $0.80 per question, at 50 questions $40 a day.

RAG with 20 sections of 800 tokens each: 16,000 × $4 / 1,000,000 = $0.064 per question, just over a twelfth. $3.20 a day.

With prompt caching, cache warm: one write 200,000 × $4 × 1.25 / 1,000,000 = $1.00, then per hit 200,000 × $4 × 0.05 / 1,000,000 = $0.04. 50 questions in quick succession: $1.00 + 49 × $0.04 = $2.96, so $0.059 per question. The average drops below RAG’s $0.064 only at about 40 questions in a row.

Cache expires every time: 50 × $1.00 = $50 a day, more than with no caching at all. For an extra charge the cache lasts an hour; writing then costs twice the input price.

Claude projects on claude.ai use the same trade-off: the project knowledge first sits entirely in the context. As it approaches the limit of the window, according to the help page, Claude switches to a RAG mode with a search tool.

## Try it

**Cost calculator for Stefan’s manual**

**Task:** Stefan wants to keep the whole manual. Get the cost per question below RAG’s $0.064 without cutting the manual. Then turn on the gap of more than five minutes and read off what the budget shows.

**The math without the calculator** (50 questions a day)

1. RAG: 16,000 × $4 / 1,000,000 = $0.064 per question, $3.20 a day.
2. Whole manual without caching: $0.80 per question, $40 a day.
3. Whole manual, cache warm: $1.00 + 49 × $0.04 = $2.96 a day, $0.059 per question.
4. Whole manual, cache expires every time: 50 × $1.00 = $50 a day.

Only the manual part is counted, as in the chapter; questions and answers cost the same in all cases and are left out here. With caching, the calculator assumes each question comes within five minutes of the previous one; otherwise the second switch applies.

## Check

**Question 2 (check question):** Stefan’s team spreads its 50 questions across the day, usually 20 minutes apart. What does the manual part cost per question with caching then?

- A) $0.04. Caching is turned on, after all.
- B) $0.80, as with no caching at all.
- C) About $1.00, even more than without caching.

**Question 3 (check question):** Which reason still favors RAG, even with a warm cache?

- A) The field sales team isn’t allowed to see the pricing pages.
- B) RAG is always more accurate, because the model has less to read.
- C) The manual doesn’t fit into the context window.

**Question 4 (check question):** Next year the manual grows to 800 pages, roughly 320,000 tokens. What follows from that?

- A) Nothing. A million tokens is enough for far more pages.
- B) It’s over Anthropic’s limit; RAG becomes more attractive.
- C) Then you should fine-tune the model on the manual.

## Done

**What you can do now**

- You can work out what a whole manual in the prompt costs per question and compare it with RAG: $0.80 versus $0.064.
- You know that prompt caching flips the picture, but only as long as questions come within five minutes.
- When a customer says “We’ll just send the whole manual along”, you ask how close together the questions come, how fast it grows and who is allowed to see which parts.

### Two cards for review

**Card 1:** A warm cache makes the whole manual in the prompt cheaper than RAG. What reasons still speak for RAG?

**Card 2:** True or false? “With prompt caching, the whole manual in the prompt is always cheaper than RAG.”

- [Next mission: How does a search for „Urlaub“ (vacation) find „Erholungsurlaub“ (paid vacation)?](https://llm.yoga/en/einsatz-11-2.md)
- [Read chapter 11](https://llm.yoga/en/11-rag.md)

## Read more in the chapter

The full text from the chapter, with the reasoning, calculations and sources:

- [Why a model has to look things up (with the math)](https://llm.yoga/en/11-rag-1.md)
- [The flow: indexing and querying](https://llm.yoga/en/11-rag-2.md)
- [Prompt caching on the providers’ side](https://llm.yoga/en/07-kv-cache-2.md)

## Answers: only reveal them after the learner has answered or explicitly asks

**Question 1:** The correct answer is B.
- A: Off by a factor of 10: 200,000 tokens are 0.2 million, times $4 makes $0.80. RAG with 16,000 tokens costs $0.064.
- B, correct: 200,000 × $4 / 1,000,000 = $0.80 per question, at 50 questions $40 a day. RAG sends 16,000 tokens: $0.064 per question, $3.20 a day. It doesn’t stay quite that simple, though; more on that in a moment.
- C: The API that programs use to talk to Claude remembers nothing between two requests. Every question sends the manual again, and without caching it counts in full as input every time: $0.80.

**Question 2:** The correct answer is C.
- A: $0.04 is only the cost of a hit, meaning a question within five minutes of the previous one. After 20 minutes, the cache has expired.
- B: Almost: nothing is read, but every question writes the cache again, and writing costs 1.25 times the input price.
- C, correct: Every question writes the manual into the cache again, at 1.25 times the price: 200,000 × $4 × 1.25 / 1,000,000 = $1.00. Caching only pays off when requests come close together.

**Question 3:** The correct answer is A.
- A, correct: With RAG, access rights belong in the search as a filter: if someone isn’t allowed to see something, those sections never get into the prompt. If the whole manual is in the prompt, the model also knows the pricing and can pass it on.
- B: Not always. For a single document and a one-off question, going straight through the context is often simpler and more accurate. RAG fails when the search doesn’t find the right passage.
- C: The context window, what the model can read at once, holds a million tokens here. 200,000 fit in easily. The size of the window isn’t the issue here.

**Question 4:** The correct answer is B.
- A: It would fit. But every question without a cache hit then costs $1.28, and in long contexts the hit rate for passages in the middle drops.
- B, correct: Anthropic only puts knowledge entirely into the prompt up to about 200,000 tokens, roughly 500 pages; 800 pages are above that. With RAG, it stays at about 16,000 tokens per question, however thick the manual gets. With the whole manual, the cost of every question grows with every page.
- C: Fine-tuning comes last (chapter 19). Knowledge that grows and changes is better looked up; otherwise you’d have to retrain after every change.

**Card 1:** When the manual keeps growing (above about 200,000 tokens, Anthropic no longer puts knowledge entirely into the prompt), when it changes often, when some people are only allowed to see parts of it, or when every answer needs an exact reference. With RAG, access rights work as a filter in the search.

**Card 2:** **False.** Only as long as the cache stays warm. It lasts five minutes, and each hit extends that. If questions come less often, every question writes the cache again, at 1.25 times the input price: for the manual, $1.00 instead of $0.80 per question.
