3.6 Matching Retrieval to Data Shape and Query Pattern
What You Need to Know
Section titled “What You Need to Know”A retrieval strategy is how an assistant finds the information that an answer depends on. The choice of strategy depends on two factors. Data shape is the form the information takes. Query pattern is how people ask for it. Then ask which failure matters most: staleness, missed recall (a relevant document that retrieval does not find), wrong precision or latency. Pick the cheapest strategy whose failure mode is acceptable. Objective 3.5 designed one pipeline. This objective decides when that pipeline is the right choice.
This lesson uses one made-up example throughout: a fencing contractor whose assistant reads a live stock system, policies, installation guides and code. One system routinely needs several strategies at once.
The Shape Axis
Section titled “The Shape Axis”Data shape decides which source holds the true data.
Live structured data, such as databases, catalogues and account records, already gives precise, current answers through its own query interface. The right integration is a query tool (text-to-SQL, an API tool) against the system of record, which is the authoritative source of the data. Embedding its rows produces a stale copy. The copy is wrong as soon as it is indexed, and it has lost the structure that made queries precise. The contractor’s assistant fetches the stock count this way.
Narrative documents, such as policies, manuals and articles, have no query language. Semantic retrieval over well-chunked text fits them, which is the 3.5 pipeline’s strongest case. The contractor’s repair policy belongs here.
Code and rigidly structured text, such as the contractor’s quote calculator, are between these two shapes. Similarity search alone fails on exact symbols and cross-references. So retrieval follows the structure: search, open, follow references.
The Query-Pattern Axis
Section titled “The Query-Pattern Axis”The same corpus is used in different ways for different questions:
| Query pattern | Cue in the question | Native strategy | Fencing contractor example |
|---|---|---|---|
| Exact lookup | An identifier: part number, error code, clause reference | Keyword or filtered search against the right source | A gate hinge by part number |
| Conceptual | “Summarise”, “explain”, “what is our policy on” | Semantic retrieval over chunked text | “What is our policy on storm-damage repairs?” |
| Multi-hop / exploratory | Comparison across documents, unknown search path | Agentic retrieval: search, read, refine, search again | Post-depth advice compared across three suppliers’ guides |
| Recall-critical | “Must not miss a relevant document” (compliance, legal) | Hybrid search plus reranking | A safety audit that must find every risk assessment |
Anthropic’s context-engineering guidance describes the multi-hop case as just-in-time retrieval. The agent keeps lightweight identifiers and loads data as questions arise. It discovers what matters progressively, instead of loading a guessed set of data at the start.
When Agentic Retrieval Earns Its Price
Section titled “When Agentic Retrieval Earns Its Price”Agentic retrieval spends latency and tokens to get precision on questions that no single query answers. This cost is justified for exploratory and comparative work. It is unjustified for a lookup that a metadata filter would answer in one step.
The failure that matters decides which strategy to use. Recall-critical corpora justify hybrid search plus reranking, because a missed document is the expensive failure. Lookups with a latency budget (a limit on how long the answer may take) justify a single query, because for them a slow answer is the expensive failure. The contractor’s three-guide comparison justifies the agentic loop. Its hinge lookup does not.
The Selection Method
Section titled “The Selection Method”Work through four steps:
- Name the data shape.
- Name the query pattern.
- Name the failure that matters most.
- Pick the cheapest strategy whose failure mode is acceptable.
For the contractor’s stock count, the data is live and structured, and the query is an exact lookup. Staleness matters, so use a query tool.
In the exam
Section titled “In the exam”A question that presents three query families tests whether you match each family to the strategy that fits it best or force one strategy onto all three. The answer key marks answers that combine strategies as correct more often than answers that use one strategy. The selection method eliminates the wrong options by a fixed procedure. An option that embeds live operational data fails on staleness before you examine any other property. An impressive-looking option that uses agentic retrieval on a simple lookup fails on cost. The question never justified that cost. Domain 2 covers the cached-prompt boundary.
Exam Traps
Section titled “Exam Traps”Practice Scenario
Section titled “Practice Scenario”An enterprise assistant must answer three query families: the current stock level of part K-4402 (live ERP data), a summary of the data-retention policy (a 300-page manual), and how clause 14 has changed across the last three supplier contracts (an archive of several thousand contracts). Staff ask policy questions in everyday words that rarely match the manual’s terms. Which retrieval design fits?
- A. Embed all three sources into one vector index and search it for every query, so a single retrieval path serves the whole assistant
- B. Load all three sources into the largest available context window on every request, so every query family is answered without any retrieval infrastructure at all
- C. Use keyword search across all three sources, matching stock codes, policy terms, and clause numbers alike
- D. An ERP API tool for stock queries, semantic retrieval over the chunked manual, and agentic multi-document retrieval for the contract comparison
Answer & explanation
Correct: D
- A — ERP rows go stale on indexing and lose their structure; the exact part-number lookup and the multi-hop clause comparison both are beyond what a single similarity search can do.
- B — Cost and attention degradation on every request for capability no single query uses, and the live ERP data is stale the moment it is exported into a prompt.
- C — Right for the part number, wrong for everything else. The question says staff rarely use the manual’s terms, so keyword matching misses policy questions, and the cross-contract comparison needs iterative retrieval.
- D — Each query family gets the strategy that fits its data shape and pattern best: system of record for live data, embeddings for narrative prose, iterative retrieval for the multi-hop comparison.
Sources
Section titled “Sources”- Effective context engineering for AI agents — Anthropic
- Introducing Contextual Retrieval — Anthropic
- Claude Certified Architect Professional Exam Guide (v1.0) — Domain 3 — Anthropic