Context, Retrieval, or Tools: Choosing a Knowledge Path

Context, Retrieval, or Tools: Choosing a Knowledge Path

user avatar

by me1afon

14 minutes ago


AI tools helped gather research and write the first draft of this article. I edited it and checked every quote and figure against the source page listed at the end, read on 1 December 2026. The cover illustration is AI-generated. Details at the end.

An AI chat has to get its facts from somewhere. There are three common routes: put the material in the prompt, fetch the relevant pieces at question time, or call a function that returns the answer. Pick the route by what kind of fact the question needs, not by what is fashionable: reference text that fits and rarely changes can sit in the prompt, a large or growing library needs retrieval, and anything live or personal needs a tool. The routes can be combined, and most real products do.

This article takes the three routes one at a time, shows what the vendor documentation and the original retrieval paper actually say about each, walks a fictional example, and ends with a decision order you can adapt. It is about where answers come from. It is not a benchmark, and it does not say which vendor, model or database to buy.

Three routes, three kinds of fact

Context means the material is in the request itself. Anthropic's documentation describes the context window as the text a model can reference when generating a response, "including the response itself", and compares it to working memory. Everything in the request counts against it: the system prompt, every message, tool results, documents and tool definitions [1].

Retrieval means the material lives outside the model and a search step picks the pieces that go into the request. The original RAG paper, by Lewis and colleagues (2020), describes models that "combine pre-trained parametric and non-parametric memory for language generation", where the non-parametric memory is a dense vector index of Wikipedia reached through a neural retriever [2]. Parametric memory is what the model learned in training. Non-parametric memory is a separate store it can look things up in.

Tools mean the model asks your application to do something and gets a result back. Anthropic's tool-use documentation says the model determines when to call a tool based on the user's request and the tool's description, then returns a structured call that your application runs (client tools) or that Anthropic runs (server tools) [3]. The fact does not come from text the model has read. It comes from a system that computes or looks it up now.

A short way to keep them apart is to ask what each one is good at. Context is good at a small, stable body of reference text. Retrieval is good at a body of text that is too large for the prompt or that changes. Tools are good at answers that depend on the moment or on the person asking.

Route one: put it in the prompt

The simplest design needs no search system. Anthropic's 2024 post on contextual retrieval says it plainly: if a knowledge base is smaller than 200,000 tokens, "about 500 pages of material", you can include the whole thing in the prompt, "with no need for RAG or similar methods" [4].

Two things have changed since that post, and both are worth reading in the current documentation. The context window of some models is now up to 1M tokens, depending on the model, and others stay at 200k [1]. So the 2024 figure is a snapshot, not a threshold. Check the window of the model you actually use before you rely on it.

The second change is cost. Prompt caching lets a repeated prefix be reused instead of processed again. The documentation says it can reduce processing time and cost for prompts with large context or consistent instructions, and the 2024 post puts the effect at more than 2x lower latency and up to 90% lower cost [4][5]. The mechanics matter, though:

  • The cached prefix covers tools, then system, then messages, in that order. Changing any block at or before the breakpoint produces a different hash and a cache miss [5].
  • The default cache lifetime is 5 minutes, refreshed at no extra cost each time the cached content is used. A 1-hour lifetime costs more [5].
  • Cache reads are priced at 0.1 times the base input price on most models, with listed exceptions. Cache writes cost 1.25 times (5-minute) or 2 times (1-hour) the base price [5].
  • There is a minimum cacheable length, and it differs by model (the page lists values from 512 to 4,096 tokens, depending on the model) [5].

A fictional comparison for Tidepool Wallet's help chat: a small stable help manual sits in a cached prompt prefix, a large archive of release notes sits behind a search step, and a balance lookup sits behind a function call, each shown with the kind of question it answers.

What does this mean in practice? A help chat whose reference text is small and steady, and which gets questions often enough to keep the cache warm, can put the text in the prompt. A chat that gets one question an hour would pay the cache write over and over, because the 5-minute lifetime expires between questions. That second point is an inference from the documented lifetimes, not something the pages test.

The cost of putting more in

Bigger is not free in quality terms either. Anthropic's context-window page says that more context is not automatically better: as the token count grows, accuracy and recall degrade, which it calls context rot [1]. An academic study points the same way. Liu and colleagues (2023) tested multi-document question answering and key-value retrieval and found that performance is often highest when the relevant information is at the beginning or end of the input, and degrades significantly when the model must use information in the middle, "even for explicitly long-context models" [6]. That study tested models available in 2023. It does not say how a current model behaves, and its abstract also presents the work as new evaluation protocols for long-context models. Treat it as a reason to test your own prompt, not as a verdict on long context.

So the first route has two limits: the window, and the quality of the answer when the window is nearly full.

Route two: retrieve what is relevant

Retrieval earns its place when the material does not fit, grows over time, or is mostly irrelevant to any one question. Instead of sending 500 pages, you send the few passages that look relevant.

The Lewis paper gives the original motivation. Its abstract says that pre-trained models are limited in their ability to access and precisely manipulate knowledge, and that providing provenance for their decisions and updating their world knowledge remain open research problems. Its proposal was to pair a generator with an explicit, searchable memory. On the tasks it tested, the RAG models set state of the art on three open-domain question answering tasks and, for generation tasks, produced more specific, diverse and factual language than a parametric-only baseline [2].

Two cautions apply when reading that paper today. First, it describes fine-tuned seq2seq models and a Wikipedia index in 2020. The word "RAG" is now used loosely for any pipeline that searches and then prompts, and the paper's results do not transfer automatically to such a pipeline. Second, the abstract names provenance and updating knowledge as the attractions. Those are properties of the design: an index can be updated without retraining a model, and a retrieved passage has a source you can point to. Whether your pipeline delivers them depends on how it is built.

Vendors now offer retrieval as a hosted tool. OpenAI's file search documentation describes it as letting a model retrieve information from a knowledge base of uploaded files through semantic and keyword search, via vector stores [7]. That shows retrieval and tool use are not opposites. In many products, retrieval is itself a tool the model calls. The difference is what comes back: passages of text for the model to read, rather than a computed value.

Retrieval also adds a failure the first route does not have. The search can miss. If the right passage is not retrieved, the model answers from what it did get, or from memory. Anthropic's post says that traditional RAG systems "often destroy context", because splitting documents into chunks can strip away what makes a passage understandable [4]. How to cut documents, how to combine search methods and how to check what was retrieved are separate questions, and this article leaves them out.

Route three: call a tool

Some questions are not about text at all. "What is my balance?", "Is this transfer still pending?" and "What is the fee right now?" depend on the person and the moment. A document, however fresh, is the wrong place to look. A function that queries the real system, with the user's identity checked by your application and not by the model, is the right one.

The tool-use documentation shows where the seam sits. With client tools, the model returns a structured call and your code runs the operation and sends back the result [3]. Your application, not the model, performs the lookup and decides what to allow. The earlier Dapp.Expert articles "Separating Conversation From Actions" and "Routing Requests in an AI Product" cover that boundary, including confirmations before anything irreversible, so this article does not repeat them. The point here is narrower: when the fact is live or personal, a tool is the knowledge path.

Tools also cover things that are neither stored text nor account data. A calculator, a price feed or a status check each returns something the model should not guess. The documentation lists server tools such as web search and code execution alongside user-defined ones [3].

A fictional example: Tidepool Wallet

The following example is invented. Tidepool Wallet is a made-up crypto wallet app; its help chat, its documents and its numbers are fictional and show the decision.

Tidepool's help chat gets three kinds of question.

  1. "How do I export my recovery phrase safely?" The answer lives in a short help manual that changes a few times a year. The manual is small and the chat is busy all day. Route: context. The manual goes in a cached prefix, and the chat answers from it.
  2. "Which release added multi-account support, and what changed in the fee display?" The answer is spread across several years of release notes and blog posts, far more than should sit in every prompt, and new notes arrive every month. Route: retrieval. The chat searches the archive and reads the few matching passages.
  3. "What is my USDT balance, and is my last transfer confirmed?" Nothing a document says can answer this. Route: tool. A read-only lookup runs in the application, using the signed-in user's identity, and the model phrases the result.

A fictional decision path for Tidepool Wallet: a question first asks whether it depends on a live value or on this user, then whether the reference text is small and stable enough to keep in the prompt, and otherwise goes to retrieval, with each of the three example questions ending at its route.

Real questions mix routes. "Why is my transfer pending, and what does pending mean?" needs the tool for the first half and the manual for the second. A design that lets a single answer draw on more than one route is more useful than one that forces a choice.

A decision order to copy

This order is a proposal, not a finding. It runs from the cheapest check to the most elaborate.

  1. Does the answer depend on the person or the moment? If yes, use a tool. Do not try to keep that data fresh in a prompt or an index.
  2. Does the reference text fit in the window of your model, with room for the conversation and the answer? Check the model's actual window, not a figure from a blog post [1][4].
  3. Does it change rarely, and are questions frequent enough to keep a cache warm? If so, prompt caching is worth trying, with its lifetime, minimum length and pricing read from the current page [5].
  4. Does answer quality hold when you test with the answer in the middle of the text? The 2023 study is a reason to run that test on your own material [6].
  5. If the text is too big, too changeable or too noisy, use retrieval. Plan for misses, and decide in advance what the chat says when nothing relevant is found.
  6. Combine routes where one question needs more than one.

The order is also roughly a cost order. A tool call is a defined function. A prompt is simple. Retrieval adds a search system that has to be built, kept up to date and checked.

Four mistakes and fixes

1. Building retrieval for a small manual. A search system for text that would fit in the prompt adds a failure mode and a service to maintain. Fix: test the simple route first, as the 2024 post suggests [4].

2. Filling the window because it is there. A large window does not guarantee that the model uses everything in it well [1][6]. Fix: send what the question needs, and test with the key fact in different positions.

3. Keeping live data in a document or index. A balance or a fee copied into text is already old when it is read. Fix: send live and personal questions to a tool that reads the source.

4. Treating the route as permanent. Windows grow, prices change and corpora grow. Fix: write down the numbers you decided on, and recheck them when the model, the corpus size or the traffic changes.

What this article cannot tell you

It does not give a size at which to switch from context to retrieval. The only figure in the sources, 200,000 tokens, comes from a 2024 post and the documentation now lists larger windows. It does not compare cost or accuracy of the three routes on any task: no test was run for this article, and the sources describe documented behaviour, one 2020 model design and one 2023 evaluation. The Tidepool example is invented, and the decision order is a proposal. It does not cover how to chunk documents, search methods, reranking, citations or how to handle stale and conflicting sources; those are separate questions. Vendor documentation changes, and the pricing and limits described above were read on 1 December 2026.

How this article was made

Task What the AI did What a person did How it was checked
Research Gathered candidate sources and drafted notes Chose the question and which pages to rely on Every quote checked against the page named in the sources, read on 1 December 2026
Draft Wrote the first draft from the notes Edited the text, the example and the decision order An independent review compares claims with the sources before publication
Images Generated the cover illustration Chose and checked it Labelled as AI-generated in the disclosure line and alt text
Not done by AI — The decision to publish and responsibility for the text —

Conflicts of interest: none. The author has no commercial relationship with the organisations named here.

Responsible for this article: Dmitriy Lastovka, author. Corrections: contact form.

Sources

Labels: documentation (a vendor's product documentation), paper (an academic preprint), vendor post (a company blog post). Quotes are as on the pages read on 1 December 2026.

  1. Anthropic, documentation page on context windows. https://platform.claude.com/docs/en/build-with-claude/context-windows Documentation.
  2. Lewis et al., "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks", arXiv:2005.11401 (submitted 22 May 2020, v4 12 April 2021), abstract page. https://arxiv.org/abs/2005.11401 Paper.
  3. Anthropic, documentation page on tool use (overview). https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview Documentation.
  4. Anthropic, "Introducing Contextual Retrieval", published 19 September 2024. https://www.anthropic.com/research/contextual-retrieval Vendor post.
  5. Anthropic, documentation page on prompt caching. https://platform.claude.com/docs/en/build-with-claude/prompt-caching Documentation.
  6. Liu et al., "Lost in the Middle: How Language Models Use Long Contexts", arXiv:2307.03172 (submitted 6 July 2023, v3 20 November 2023), abstract page. https://arxiv.org/abs/2307.03172 Paper.
  7. OpenAI, documentation page on the file search tool. https://platform.openai.com/docs/guides/tools-file-search Documentation.

Tier I

Sector: #18291

Sealed Hiding Place Room

Resource Cache

Resource Cache

Tier I

Requires 25% Tier Progress to Claim
Meme Cache

Meme Cache

Tier I

Requires 50% Tier Progress to Claim
Equipment Cache

Equipment Cache

Tier I

Requires 75% Tier Progress to Claim

After collecting, hiding places will be stored in your inventory and can be opened with Keys.

Other articles

Designing for Waiting Time in AI Chat

How reply delay shapes an AI chat: three clocks, what streaming changes, progress during tool steps, broken streams and status messages for screen readers.

user avatarme1afon

Retries That Do Not Repeat the User’s Action

How to set timeouts and retries in an AI chat so one user action runs once: idempotency keys, one retry layer, unknown outcomes and a fictional transfer.

user avatarme1afon

Structured Output Is Only Part of the Contract

Why a reply that matches its JSON Schema can still trigger the wrong action: what vendor docs and the spec promise, what stays with your code, and a checklist.

user avatarme1afon

Routing Requests in an AI Product

How an AI product can send each request to the right path, model or tool: what routing is, cheap layers first, a fictional wallet-chat example and tests.

user avatarme1afon

What Should an AI Chat Remember?

Memory is not one thing. Sort what a chat keeps by purpose, scope and expiry: vendor docs, GDPR storage limitation, a fictional example and a template.

user avatarme1afon

Separating Conversation From Actions

How to keep an AI chat's talk apart from its actions: what the tool-use docs say, a fictional wallet assistant, five parts of an action layer and four mistakes.

user avatarme1afon

Important disclaimer: The information presented on the Dapp.Expert portal is intended solely for informational purposes and does not constitute an investment recommendation or a guide to action in the field of cryptocurrencies. The Dapp.Expert team is not responsible for any potential losses or missed profits associated with the use of materials published on the site. Before making investment decisions in cryptocurrencies, we recommend consulting a qualified financial advisor.