You now know four things that keep showing up in the same job descriptions: LLMs, RAG, agents and MCP. Candidates who list them sound like they read a newsletter. Candidates who can say which layer owns which problem sound like they've built something. This lesson is that map — and the debugging instinct that comes with it, because in a real system the first useful question is always "which layer is failing?"
Five concerns, five homes
| Concern | Lives in | Symptom when it's the problem |
|---|---|---|
| Knowledge | retrieval (RAG) | answers are outdated, wrong about your data, or uncitable |
| Capabilities | tools (often exposed via MCP) | "I can't do that" — or it does the wrong thing |
| Control flow | the agent loop / graph | loops, wandering, gives up too early, no approval pause |
| Behaviour & rules | prompts (system + tool descriptions) | wrong tone, skips retrieval, ignores policy |
| Safety limits | tool code + approval gates | actions that should have been impossible |
Five concerns, five homes — and almost every production problem belongs to exactly one of them. Memorize this table; it turns vague debugging into a two-minute triage.
RAG stops being a pipeline and becomes a tool
In the RAG course, retrieval was a fixed stage: always once, always before generation. Give it to an agent and it becomes a tool the model may call zero, one or several times:
@tool
def search_policies(query: str) -> str:
"""Search company policy documents. You MUST call this for any question
about company rules, benefits or procedures - never answer such
questions from your own knowledge. Returns passages with sources."""
return format_with_sources(rag.retrieve(query, k=4))That unlocks multi-hop questions (search, read, search again with what you learned) and mixed questions ("compare our policy with this contract" — two retrievals from two sources). It also unlocks a new failure mode, which is the next section.
What MCP actually solves
Suppose your agent needs your ticketing system, your CRM, your document store and your CI. You write four integrations. Then another team builds a different assistant needing the same four — and writes them again. Five apps × ten systems = fifty bespoke integrations, each maintained separately.
MCP (Model Context Protocol) standardizes the connection: each system exposes one server, and any MCP-capable client can use it. Ten servers, any client — the "USB-C for AI tools" framing. MCP doesn't replace tool calling or frameworks; it replaces integration work. Same instinct one level up as A2A protocols for agent-to-agent tasks. Its own course covers the architecture, primitives and security properly (MCP course).
Putting it together
A realistic internal engineering assistant, layer by layer: Knowledge — RAG over docs, runbooks and past incidents, exposed as a search tool with citations. Capabilities — read-only tools (CI status, ticket search, log query) available freely; write tools constrained; a "propose config change" tool that emits a diff instead of applying it. Where systems already publish MCP servers, connect through MCP rather than writing custom clients. Control flow — a graph with a tools cycle, an approval interrupt before writes, a step limit and a cost budget. Behaviour — a system prompt requiring retrieval for internal questions, citations in answers, escalation on uncertainty. Safety — permission checks inside every tool, audit logging, tool output treated as untrusted data.
Notice how little of that is about the model. Choosing a model is one decision; the other twenty are architecture — which is exactly what design rounds test.
Wait — my agent has a retrieval tool and still answers from memory
A perfect example of layer triage. The retrieval works, the tool exists — so this isn't a RAG problem or a capability problem. It's a behaviour problem: given a choice, the model skips retrieval for questions it feels confident about, and confidence about general topics is not knowledge of yourdata.
The fix lives in the prompt layer — an explicit rule ("for any question about company policy you MUST call search_policies"), reinforced in the tool description — plus an eval that asserts the call actually happened for policy questions. Fixing this by tuning embeddings or swapping frameworks would waste a week.
Run the same triage on other symptoms: answers cite outdated documents → knowledge layer (index freshness). Agent loops forever → control flow (step limit). It refunded the wrong customer's order → safety layer (missing ownership check in the tool), not "the model made a mistake".
The cost of the upgrade
Turning a fixed RAG pipeline into an agentic one is not free: more LLM calls per question, higher latency, less predictable behaviour, and harder testing. A common production shape is therefore hybrid — route simple questions through the cheap fixed pipeline, and only send genuinely open-ended ones to the agent.
That routing decision is worth mentioning in interviews, because it shows the instinct that runs through this entire course: upgrade the cases that need it, measured, rather than upgrading everything because the architecture sounds better.
Selection-round radar: "How do agents, RAG and MCP fit together?" is now a standard architecture question. Answer with the five-layer table, then one sentence each: RAG is a tool the agent chooses to call; MCP standardizes how tools are exposed; frameworks orchestrate; safety lives in tool code. Finish with the triage instinct — "when something breaks, I first ask which layer owns it."
Common mistakes
- Treating MCP as a framework or a replacement for tool calling.
- Assuming an agent will use its retrieval tool without being told to.
- Debugging the wrong layer — tuning embeddings for a prompt problem.
- Making everything agentic when most traffic is simple Q&A.
- Putting safety rules in prompts rather than tool code.
- Losing citations when RAG becomes a tool — pass sources through the tool result.
Quick recap
| Layer | Owns |
|---|---|
| Retrieval (RAG) | knowledge — fresh, private, citable |
| Tools / MCP | capabilities and how they're exposed |
| Loop / graph | control flow, limits, approvals |
| Prompts | behaviour, rules, when tools are mandatory |
| Tool code | safety limits that must not depend on the model |
| Triage | ask which layer owns the symptom before fixing anything |
Practice Zone — PYQs from real selection rounds
Six MCQs and a full stack-design task for an internal engineering assistant.
In an agentic system, RAG is best understood as:
Asked in

What problem does MCP solve in an agent stack?
Asked in

In a well-designed stack, where does each concern live?
Asked in

An agent with a retrieval tool keeps answering from model memory instead of retrieving. What's the likely cause?
Asked in

What's the cost of turning a fixed RAG pipeline into an agentic one?
Asked in

Why does an agent's system prompt usually need to be tighter than a chatbot's?
Asked in

Hands-on task:
Design the full stack for an internal engineering assistant that answers from docs, checks CI status, files tickets, and can propose (not apply) config changes. Name each layer and what lives there.
Asked in

FAQ
Do I need MCP to build an agent?
No — plain tool calling works fine, and for a handful of in-house tools it's simpler. MCP pays off when several clients need the same systems, or when you want to consume servers other people already built.
Should every RAG system become agentic?
No. If single-shot retrieval answers your traffic, the fixed pipeline is cheaper, faster and easier to evaluate. Upgrade the question types that measurably fail — multi-hop, multi-source — and route the rest to the simple path.
How do citations survive when RAG is a tool?
Return sources in the tool result (as the code above does) and require citations in the system prompt. If sources are dropped at the tool boundary, the agent has nothing to cite and will either omit them or invent them.
Final lesson: turning all of this into a design-round answer — Lesson 12: Agent System Design →


