Classify before executing
Intent and risk decide which data and tools a request may reach.
Architecture case study · Enterprise banking
My reference architecture for a banking assistant that combines governed retrieval, bounded agents, MCP-enabled tools and transactional controls—while keeping every response grounded, permission-aware and auditable.
A production RAG system is an information architecture with an LLM inside it. These principles shape every decision below.
Intent and risk decide which data and tools a request may reach.
Identity and document ACLs travel with every retrieval query.
Answers cite approved context or explicitly decline to answer.
Retrieval, generation, safety and outcomes are measured separately.
Select a journey, then inspect any component. Static knowledge, customer records and write operations remain in distinct trust zones.
Enterprise RAG reference architecture · logical view
Curates governed enterprise content before it can be retrieved.
Classifies each request, applies policy, then invokes only the permitted path.
Lets agents discover and invoke approved capabilities through MCP without turning protocol connectivity into unrestricted authority.
Good architecture is not a list of services. It is a set of explicit decisions and accepted trade-offs.
Dense vectors capture meaning; BM25 preserves banking terminology and regulated phrases. A reranker improves the final context set.
Trade-off: more latency for materially better precision.
Entitlements become metadata filters at query time—not a check after sensitive passages are returned.
Trade-off: stricter indexing for enforceable boundaries.
Balances and transactions come from systems of record. The model explains results; it never becomes the source of truth.
Trade-off: more orchestration for correctness.
Card blocking uses step-up authentication, an idempotent state machine and transactional confirmation.
Trade-off: less autonomy for predictable execution.
MCP standardizes discovery and invocation. A separate gateway still enforces identity propagation, tool scopes, argument validation and server trust.
Trade-off: additional policy infrastructure for portable, governed tools.
Agents may plan and retry low-risk retrieval. Protected reads require consent; writes require step-up authentication, deterministic execution or human approval.
Trade-off: bounded flexibility instead of unrestricted autonomy.
A single “accuracy” score hides where the system failed. RAG, agent, tool, safety, operational and business measures stay separate.
Versioned offline datasets gate releases. Trace-based online evaluation then detects retrieval drift, poor agent decisions, unsafe tool use and experience regressions.
Recall@K, MRR, NDCG, context precision and reranker lift.
OFFLINEFaithfulness, answer relevance, citation coverage and abstention.
RAGASPlan quality, route correctness, step efficiency, loop rate and successful stop conditions.
TRACESTool-selection precision, argument validity, server trust, permission denials and execution success.
CONTRACTPII leakage, prompt injection, confused-deputy tests and authorization violations.
RED TEAMP50/P95 latency, cache hits, tokens, tool failures, retries and fallback rate.
ONLINETask completion, correct containment, escalation quality and customer effort.
OUTCOMEA compact, vendor-neutral blueprint for an interview walkthrough.
Classification, authorization, retrieval, generation and evaluation remain independently testable.