RAG is the first AI workload class every architect is asked to design. This module turns "build a copilot over our docs" into five defensible decisions — platform, vector store, retrieval design, tenancy, and the eval loop that referees them all — each captured as an artifact you can defend at review.
This module opens the second half of the track: not using AI to do architecture work, but architecting AI systems themselves. The demand signal is verbatim in the job postings — Amazon's Senior AI Solutions Architect JD names "RAG (Knowledge Bases, OpenSearch Serverless, Aurora pgvector)" explicitly — and all three hyperscalers now publish formal RAG reference architectures. Your job is not to memorize any one stack. It is to make the decisions the stacks force, in the right order, with evidence.
The ask lands. Orbit's CPO wants "orbit-docs-copilot" — a customer-facing assistant over Orbit's product docs, release notes and support articles — in the next quarter. Anita, strong on VPCs, queues and K8s, owns the design.
The team splits. Her staff engineer wants LlamaIndex + pgvector — "full control, no lock-in." The platform lead wants Bedrock Knowledge Bases — "why run a pipeline we can rent?" Both argue features. Anita reframes: this is a weighted decision across control, cost, compliance, ops burden and exit cost, and it ends in an ADR.
The AI brief fails a check. She asks an assistant for a managed-vs-custom comparison. It comes back confident — and asserts a document-size limit and a regional availability for the managed service that she can't find in the vendor docs. One claim is stale. From here, every quantitative claim in the brief carries a link to the page that proves it.
Two thin prototypes. One managed knowledge base, one LlamaIndex + pgvector pipeline, same 50-document corpus, same 40-question golden set scored with Ragas. Retrieval quality is close; the differences that matter are ops burden and exit mechanics.
The decision. Managed wins for launch — Orbit has no one to page for a retrieval pipeline at 2 a.m. — but the ADR records the exit instruments: the corpus and chunking config stay portable, and the eval suite is the portability guarantee, because any replacement stack must beat the incumbent's scores.
Not a diagram — an ADR with a weighted matrix, verified claims, prototype evidence, and an exit-cost note. The CPO reads the summary; the ARB reads the whole thing; nobody re-litigates it in six months.
Notice what Anita did not do: she did not let the framework debate run as a features argument, and she did not trust a single unverified capability claim. The platform decision is the highest-stakes RAG decision because it constrains every later one — and it is also the most reversible-looking decision that quietly isn't, which is why the exit-cost note is a first-class section of the ADR, not a footnote.
The decision spectrum is now the official guidance shape: Google alone publishes five distinct RAG reference architectures, running from fully managed search through pgvector-on-AlloyDB builds to GKE-hosted custom pipelines and GraphRAG. The managed end — Bedrock Knowledge Bases, Azure AI Search with Foundry, Vertex AI Search — handles ingestion, chunking, embedding, retrieval and citation for you. The custom end — LangChain or LlamaIndex over a vector DB you operate — hands you every knob and every pager.
Score the two ends on five axes, and make the weights yours, not the AI's:
Here is the worked shape of Anita's matrix — your weights will differ, and that's the point:
| Axis | Weight | Managed (Bedrock KB-class) | Custom (LlamaIndex + pgvector) |
|---|---|---|---|
| Control over retrieval | 15% | Limited knobs, roadmap-bound | Every knob, every pager |
| Cost at launch volume | 20% | Bundled, predictable | Lower floor, higher eng time |
| Compliance & residency | 25% | Provider certs, region options | Fully pinnable, fully provable |
| Ops burden | 25% | Provider-operated | You are the platform team |
| Exit cost | 15% | Re-ingest + re-validate | Portable by construction |
The output is an ADR: context, options, weighted scores, the decision, and the consequences — including the exit instruments. A staged strategy is often the honest answer: launch managed, keep the corpus and evals portable, and revisit when eval results or costs hit a wall the managed knobs can't fix.
LLMs hallucinate service limits, quotas, regional availability and pricing with total confidence — every quantitative claim in a platform comparison gets verified against current vendor docs before it enters the ADR, no exceptions.
When you do use an assistant to draft the comparison, structure the prompt so verification is built in:
Draft a managed-vs-custom RAG platform comparison for a customer-facing
docs copilot (multi-tenant SaaS, India + EU customers, DPDP-scoped data).
Candidates: Bedrock Knowledge Bases | Azure AI Search + Foundry |
Vertex AI Search | LlamaIndex + pgvector (self-managed).
Rules:
1. Score axes: control, cost, compliance, ops burden, exit cost.
Propose scores; I will set the weights myself.
2. For EVERY quantitative claim (limits, quotas, regions, prices),
output a [VERIFY] tag with the exact vendor doc page to check.
Do not present any number as fact.
3. List what each managed option does NOT let me configure.
4. End with an exit-cost note per option: what must be rebuilt to leave.
The vector store decision is narrower than the platform decision but earns its own ADR, because it carries the residency and cost floor. Three families, three profiles:
Residency deserves one explicit paragraph in the ADR. DPDP today imposes no blanket localization, but the government can restrict transfers per-destination — so the design goal is restrictability: choose a store you can pin to a region, and keep the corpus and embeddings portable enough to re-home if a restriction lands. A portable store is a compliance instrument, not just an ops preference.
Retrieval quality decisions look like tuning; at architecture level they are budget decisions, and every one of them is validated by eval deltas — never by intuition or a demo that happened to go well.
The discipline that makes all three tractable: change one knob, re-run the golden set, keep the change only if the metrics move. That requires the eval loop from the last section of this module to exist before you start tuning — which is exactly why it's a design element, not an afterthought.
Build the 40-question golden set before the first retrieval experiment — tuning without it is astrology, and every hour spent on the set repays itself on every knob you ever turn afterward.
A RAG system is a new path to your documents, and it must not become a permission bypass or a tenant-boundary leak. Four decisions, made at design time:
Before a RAG design leaves review, walk this checklist:
Two advanced retrieval architectures earn their complexity only when the simple one demonstrably fails.
GraphRAG combines vector retrieval with a knowledge graph, and it matters when the questions are about relationships: org structures, bills of materials, regulatory cross-references — "which products are affected if this component changes?" is a graph traversal wearing a search costume. It has hyperscaler-canon status — Google's Architecture Center publishes a GraphRAG reference architecture — but the honest price is steep: you now own graph construction and maintenance as a pipeline, entity extraction quality as a new failure mode, and more moving parts per query.
Agentic retrieval puts a model in the retrieval loop — decomposing multi-hop questions, issuing follow-up queries, deciding when it has enough. It answers questions single-shot retrieval can't, and it multiplies token spend and latency per question while adding a new nondeterministic component to debug.
The decision rule for both: collect the eval failures first. If your golden set shows a class of relationship or multi-hop questions the plain pipeline keeps failing, you have evidence sized to a business case. If you can't produce those failing cases, you're buying complexity for a hypothesis.
"The simplest retrieval that passes the evals" is the RAG version of this track's oldest rule — architecture earns complexity with evidence, and eval failures are the evidence.
Every decision in this module was refereed by evals — which is only possible if the eval loop is designed into the system, with the same seriousness as the ingestion pipeline. The posting evidence names this directly ("RAGAS evaluation" appears verbatim in the JDs). The architecture has three parts:
AI helps you draft the golden set from the corpus — with the architect curating every item:
from pydantic import BaseModel
import anthropic
class GoldenItem(BaseModel):
question: str
reference_answer: str
source_doc_ids: list[str]
question_type: str # "lookup" | "synthesis" | "multi-hop" | "out-of-corpus"
class GoldenSetDraft(BaseModel):
items: list[GoldenItem]
client = anthropic.Anthropic()
resp = client.messages.parse(
model="claude-opus-4-8",
max_tokens=4000,
thinking={"type": "adaptive"},
system=(
"Draft golden-set candidates for RAG evaluation. Ground every "
"reference answer in the provided docs, cite source doc ids, and "
"include out-of-corpus questions where the correct behavior is refusal. "
"A human curator makes the final selection."
),
messages=[{"role": "user", "content": corpus_excerpts}],
output_format=GoldenSetDraft,
)
draft = resp.parsed_output # architect curates before anything enters CI
In assessment scenarios, the eval loop is the tiebreaker — any retrieval-design change (chunking, hybrid weights, reranker, platform migration) is justified by golden-set metric deltas, and an answer that tunes by intuition or demo impressions is wrong.
A RAG architecture is five decisions with a referee — platform, vector store, retrieval design, and tenancy each land as verified, weighted ADRs, and the eval loop that judges them is designed into the system from day one, because a RAG system without evals is a demo with a production bill.
Take this module into Lab 07 (RAG platform decision package) — for a multi-tenant SaaS scenario with DPDP-scoped data, you'll produce the full decision package: weighted matrix, reference architecture diagram, ADR and exit-cost note — and Lab 08 (build both RAG paths), where you'll stand up a managed knowledge base AND a LlamaIndex + pgvector pipeline on the same 50-document corpus and settle the argument with a Ragas scorecard, exactly as Anita did.
Companion playbooks: pb-28 (The RAG Platform Decision — Managed vs Custom, as an ADR), pb-29 (Vector Store Selection — pgvector, OpenSearch, or Dedicated), pb-30 (Retrieval Design Decisions, Validated by Evals Not Intuition), pb-31 (RAG Security & Tenancy Architecture), pb-32 (GraphRAG & Agentic Retrieval — When Relationships Matter), and pb-33 (RAG Evaluation Architecture — the Loop Is Part of the System).