Home › Study guides › CCAR-P › Domain 3 › Lesson 3.5
CCAR-P · Domain 3 · 21% of the exam · Lesson 3.5 · 20 min read Updated for the December 7, 2026 exam guide (v1.1)
Retrieval architecture: RAG pipeline, agentic search or full-corpus context
Choose a RAG pipeline, agentic search or full-corpus context from corpus, query pattern and limits, then configure contextual retrieval and fallbacks.
Written against skill 3.5 of the official CCAR-P exam guide (Version 1.1, effective December 7, 2026). An independent resource, not affiliated with Anthropic; the practice questions are written from scratch.
3.5.1 Why one caseworker assistant needs three ways to find things
The Tarrow Revenue Authority, a national tax agency, wants a Claude assistant for its caseworkers, and Rhiannon, a solution architect, owns the design. On paper it is one problem: let Claude answer from the Authority's guidance. In the first workshop it becomes three. Caseworkers on the phone ask about 12,000 questions a day, such as whether someone who worked from home in 2025 can claim a share of the heating bill, and need an answer within about five seconds. Forty specialists on the technical team research hard cases, following one ruling to the rulings that cite it, and can wait a few minutes. And every caseworker needs the 90-page telephone service standards on every call.
A plain model call answers none of these well: Claude has never seen Tarrow's 30,000 pages of manuals, rulings and form instructions, so without them it offers a plausible guess about someone else's tax law. Something has to put the right text in front of Claude, and the three ways to do that behave so differently that choosing between them is an architecture decision, not a library choice.
A retrieval architecture is that decision: how the text Claude needs reaches its context. A pre-built RAG pipeline (retrieval-augmented generation) indexes the corpus in advance and fetches the best passages for each question. Agentic search with tools lets Claude run searches itself, in a loop, until it has enough. Full-corpus context skips retrieval and puts the whole corpus in the prompt. Rhiannon will use all three, one per workload.
One assistant, three workloads
3.5.2 Three architectures, three different bets
Teams often treat RAG as the only way to give Claude documents. In fact each architecture makes a different bet about WHEN the finding happens.
The pre-built RAG pipeline bets on doing the work in advance. An offline ingestion path cuts each document into short passages called chunks, turns each into an embedding (a list of numbers that encodes meaning) and writes it to an index. At question time, one fast retrieval fetches the best chunks and Claude answers from them in a single call. Latency is low and predictable. The price is an index to build and keep in step with every revision, and one shot per question, from the question's own words.
Agentic search bets on doing the work at question time. Claude gets search tools and uses them in a loop: search, read, decide the next search, stop when it has the answer. Claude requests each search; your application runs it and caps the number of calls. Claude Code works this way, finding files with glob and grep just in time, which Anthropic notes sidesteps stale indexes. Anthropic's Agent SDK post states the trade: semantic search is usually faster, but less accurate, harder to maintain and less transparent than agentic search. Each hop costs a model turn, so latency is higher and harder to predict.
Full-corpus context bets that no retrieval is needed. The corpus sits in the prompt, ahead of the question, and prompt caching reuses that processed prefix across requests at a small fraction of the normal input price. Claude sees everything at once, so a rule that spans two sections is never split. Anthropic's contextual retrieval post, from September 2024 when Claude's context window was 200,000 tokens, suggested skipping RAG for knowledge bases under about that size, roughly 500 pages. Today's models accept 1M tokens, but a bigger window is no reason to fill it: every token is paid for on every request, and recall of details declines as the context fills, an effect Anthropic calls context rot.
Where each architecture does its finding
Pre-built RAG pipeline
Agentic search with tools
Full-corpus context
3.5.3 Reading the requirements: corpus, query pattern, limits
Rhiannon asks three questions of each workload and writes the answers down before anyone mentions a vector store.
The corpus: how big it is, how often it changes, how it is structured, and whether different users may see different parts. Size decides whether full context is possible at all. Change rate decides how painful an index is to keep current; a source that changes hourly favours searching it live. Structure decides what search must match: prose is found by meaning, while form numbers such as TR-114 need exact matching. And access rules matter because one shared cached prompt shows every user the same text.
The query pattern: what a correct answer needs. A semantic question needs passages that mean the same thing however they are worded. A multi-hop question needs searches in sequence, each built from the last answer, which no single up-front retrieval can do. A question whose answer depends on rules scattered across a document favours seeing all of it. An aggregation ("how many rulings since July cite section 4.2?") needs a query over every record, so it belongs to a database tool: similarity search returns a top-k sample, and a sample cannot count.
The limits: the latency budget per answer, the volume and the cost per answer. A five-second budget leaves room for one retrieval and one answer, not six tool calls. High volume multiplies every token sent per request, which is what makes a large full-corpus prompt expensive even with caching.
| Architecture | When it wins | What it costs |
|---|---|---|
| Pre-built RAG pipeline | A large corpus, mostly single-hop questions, a tight latency budget or high volume | An ingestion pipeline and index to build and keep current; one retrieval per question, so multi-hop questions fail |
| Agentic search with tools | Multi-hop or exploratory questions, code, fast-changing sources; a budget of tens of seconds or minutes | Several turns per question: slower, more tokens, less predictable latency; needs clearly described tools and a call cap |
| Full-corpus context | A small, stable corpus used on most requests (Anthropic's 2024 post drew the line near 200,000 tokens); rules that span sections | Every token on every request, cheap once cached; one view for all users; the cache is rewritten whenever the corpus changes |
Applied to Tarrow: the phone workload has 30,000 pages, far beyond any context window, mostly single-hop questions and a five-second budget, so a pre-built RAG pipeline. The technical team's questions chain one ruling to the next and can wait minutes: agentic search, with the same guidance index exposed as one tool beside lookups by ruling number. The service standards run to about 45,000 tokens, change twice a year and are needed on every call: full-corpus context, cached, at the top of the system prompt. Anthropic's prompting docs back that placement: queries placed below long documents improved response quality by up to 30 percent in tests.
3.5.4 When you index: contextual retrieval
Here is the failure that survives a well-built index. Rhiannon's chunks follow the manuals' structure, one numbered subsection each with tables whole, tagged with tax year, version and access label so retrieval can filter before ranking. Yet evals still miss the right chunk for some questions. The chunk for section 4.2.3 says "The allowance is capped at the amount in Table 4B." It never says which allowance, which manual or which year. Those words live elsewhere in the document, so neither an embedding nor a keyword index can match them.
Contextual retrieval fixes this at ingestion. For each chunk, your pipeline sends Claude the whole document plus the chunk and asks for a short context that situates the chunk, usually 50 to 100 tokens. It prepends that context before embedding the chunk (contextual embeddings) and before adding it to a keyword index scored with BM25 (contextual BM25). BM25 (Best Matching 25) ranks chunks by the exact terms they share with the query, weighting rare ones, which is what finds TR-114 when an embedding finds only "a form about expenses". The context must be specific to the chunk: Anthropic saw very limited gains from attaching a generic document summary instead.
In Anthropic's tests, measured as failures to get the right chunk into the top 20, contextual embeddings cut the failure rate by 35%, adding contextual BM25 cut it by 49%, and adding re-ranking on top cut it by 67%. A re-ranker is a separate model that scores each candidate against the question; Anthropic's setup re-ranked the top 150 candidates and passed the best 20 to Claude, which beat passing 10 or 5.
Now the part that matters for the limits. Contextual retrieval spends its cost at ingestion: one Claude call per chunk, made cheap by prompt caching, which lets each document be processed once for all its chunks (the 2024 post estimated $1.02 per million document tokens, one time). Offline work can also use the Message Batches API at half price. None of this adds query latency. Re-ranking is the opposite: it runs on every question and adds latency, so the candidate count trades quality against the budget. In Rhiannon's illustrative configuration, note the glossary in the contextualizer prompt (Anthropic suggests domain-specific prompts), the re-ranker's time slice, and the rule that a revised document gets every chunk context regenerated.
# Illustrative excerpt: Rhiannon's own config format, not a product schema
chunking: numbered subsection; tables whole with header row
filters_before_ranking: [tax_year, version_in_force, access]
contextualizer:
model: claude-haiku-5-5 # one call per chunk, at ingestion only
context_tokens: 50-100
prompt_extras: authority_glossary # defined terms the chunks rely on
cache_whole_document: true # read once for all its chunks
run_as_batch: true # offline, half price
indexes: [contextual_embeddings, contextual_bm25] # results fused by rank
rerank: {candidates: 150, keep: 20, time_slice_ms: 700}
on_revision: regenerate contexts for the whole document
One alternative covers the vector side only. Anthropic has no embedding model of its own, and its docs point to Voyage AI, whose contextualized chunk models such as voyage-context-4 produce document-aware vectors without a Claude call per chunk. The keyword index still sees the bare chunk, so for a corpus full of identifiers, Rhiannon keeps contextual BM25.
3.5.5 The fallback configuration: when retrieval comes back weak
Now a caseworker asks about "the kitchen-table rule", a nickname that appears in no manual. Hybrid search returns 20 weakly related chunks, and the default outcome is the worst one: Claude writes a fluent answer from loosely relevant passages and general knowledge. A fallback configuration states in advance what the system does when primary retrieval is empty, weak or unavailable. There is no official recipe for its contents: the four steps below are Rhiannon's design for the phone path, each a common engineering move.
- DETECT. Treat an empty result, or a top re-ranker score below a threshold calibrated on your eval set, as a miss rather than an answer.
- RETRY ONCE, DIFFERENTLY. Rewrite the question into the guidance's own terms with one call to a small, fast model, and search again.
- DEGRADE, DO NOT FAIL. If the re-ranker overruns its slice, send the fused results unranked; if the embedding service is down, search contextual BM25 alone.
- SAY SO. If nothing clears the bar, return an explicit "no guidance found" result, let Claude tell the caseworker the guidance does not cover it, and refer the case to the technical team.
Rhiannon's fallback ladder on the phone path
Notice the referral. Agentic search would probably find the answer, but inside a five-second call it is a timeout, not a fallback. Every fallback must fit the primary path's limits, so the slow architecture receives the case asynchronously.
The Claude API supports the last step directly. Your search tool returns each chunk as a search result content block (search_result, with a source, a title and content), and with citations enabled Claude cites them the way it cites web search results. In the illustrative sketch below, note the two weak(hits) checks and the plain text block. For an empty search the docs advise returning a text block such as "No results found." instead of an error, so Claude explains the empty result and the conversation continues.
# Illustrative: hybrid_search, rewrite, weak and refer_to_technical_team are your own code
def search_guidance(query: str, case: Case, caller: Caller) -> list[dict]:
filters = {"tax_year": case.tax_year, "access": caller.entitlements} # before ranking
hits = hybrid_search(query, filters, rerank_slice_ms=700) # unranked if the slice runs out
if weak(hits): # empty, or top score under the eval threshold
hits = hybrid_search(rewrite(query), filters, rerank_slice_ms=700) # ONE retry
if weak(hits): # SAY SO: never pad with weak chunks
refer_to_technical_team(case, query)
return [{"type": "text", "text": "No guidance found for this question."}]
return [{
"type": "search_result",
"source": h.source, # e.g. tra://home-working-manual/4.2.3@2026-07
"title": h.title,
"content": [{"type": "text", "text": h.text}],
"citations": {"enabled": True}, # off by default; same setting on every result
} for h in hits[:20]]
Pair the tool with a system prompt that permits "the guidance does not cover this": for Tarrow, that plus a referral is a correct answer, and an uncited paragraph from general knowledge is not.
3.5.6 The exam traps
Most traps here pick one architecture or setting for everything instead of reading the requirements.
- ✗ One RAG pipeline for every workload because RAG is the standard pattern. ✓ Select per workload from corpus, query pattern and limits. A small, stable corpus belongs in a cached prompt, and a multi-hop question needs agentic search.
- ✗ Escaping retrieval problems by loading a large corpus into a bigger context window. ✓ Full context wins only for a small, stable corpus; above that, per-request cost, context rot and access rules argue for an index.
- ✗ Agentic search everywhere because it is more accurate. ✓ It costs turns and latency; use it where each search depends on the last and the budget allows.
- ✗ Bigger chunks, a bigger embedding model or more chunks when chunks lack context. ✓ Contextual retrieval puts the missing words into each chunk before both indexes; a generic document summary adds little.
- ✗ Re-ranking more candidates to raise quality under a tight latency limit. ✓ Spend at ingestion first, since contextual retrieval adds no query latency, then give the re-ranker a bounded time slice.
- ✗ No fallback, or a prompt telling Claude to use general knowledge when results look thin. ✓ Decide in advance what a weak result triggers: detect it, retry or degrade within the limit, and return an explicit no-results block with permission to say "not covered".
3.5.7 Put it together: select and configure Tarrow's retrieval
Here is how Rhiannon records the decision for the Authority's architecture board.
Decision: Retrieval architecture for the caseworker assistant, one per workload.
Phone questions (12,000 a day, about 5 s per answer, 30,000 pages, monthly revisions): pre-built RAG pipeline. Structure-aware chunks; tax-year, version and access filters before ranking; contextual embeddings plus contextual BM25; re-rank 150 to 20 within a 700 ms slice.
Fallback: a weak or empty result triggers one rewritten retry; a re-ranker overrun sends fused results unranked; an embedding outage falls back to BM25 alone; otherwise "no guidance found" and a referral to the technical team.
Technical research (a few hundred questions a week, minutes acceptable, rulings that cite rulings): agentic search over search_guidance, get_ruling and list_citing_rulings, capped at 10 tool calls.
Service standards (about 45,000 tokens, two revisions a year, every call): full-corpus context at the top of the system prompt, cached.
Evidence: 300 caseworker questions with known answering sections; right section in the top 20 for 96% with contextual hybrid retrieval, against 84% with plain vector search.
Revisit when: the standards pass 150,000 tokens, the phone latency budget changes, or top-20 recall drops below 92%.
Relieving the binding performance constraint (3.3) takes this design as given and decides between retrieval depth, model tier and caching when accuracy or latency is the limit that binds. Progressive discovery (3.7) applies the same load-on-demand reasoning to tools and instructions. Root-cause isolation (4.5) teaches you to tell a retrieval failure from a hallucination in a trace.
Key takeaways
- ✓ A retrieval architecture decides how text reaches Claude's context: a pre-built RAG pipeline, agentic search with tools, or the full corpus in the prompt.
- ✓ The pipeline finds in advance and answers fast, agentic search finds at question time in several turns, and full-corpus context needs a small, stable corpus and caching.
- ✓ Select per workload from the corpus (size, change rate, structure, access), the query pattern (semantic, multi-hop, whole-document, aggregation) and the latency and cost limits.
- ✓ When you index, contextual retrieval prepends a chunk-specific context before both embedding and BM25 indexing, at an ingestion cost that adds no query latency.
- ✓ Re-ranking adds quality at a latency cost on every query, so under a tight limit it gets a bounded time slice.
- ✓ A fallback configuration decides in advance what happens when retrieval is weak, empty or unavailable, within the workload's limits; Rhiannon's detects, retries once, degrades, then says "not covered".
Check your understanding
4 questions written for this lesson. Every answer option is explained, including the ones you did not pick. Nothing is stored.
CCAR-P practice questions are being rewritten
The 189 CCAR-P practice questions here were written for the previous exam guide and are tagged to its domains. New questions for the December 7, 2026 guide (v1.1) are being written. Until they are ready, the practice for the new guide is the questions at the end of every lesson, with every answer option explained. The old bank stays open for general practice.