1.3. The Core Patterns: RAG and Agents
💡 First Principle: The two dominant GenAI application patterns — RAG and Agents — solve fundamentally different problems: RAG grounds FM responses in external knowledge to improve accuracy; Agents give FMs the ability to take actions in external systems. Confusing them leads to over-engineered architectures.
These two patterns are not mutually exclusive — production agentic systems often incorporate RAG as one of their tools. But understanding each pattern independently is prerequisite to understanding their combination.
The stakes are high: choosing RAG when you need agents means your application can't take actions; choosing agents when you need RAG means unnecessary complexity, higher latency, and compounded failure modes. The exam specifically tests scenario recognition — reading a business problem and identifying which pattern is appropriate.
⚠️
| Dimension | RAG | Agents |
|---|---|---|
| Core problem | Knowledge gap (FM doesn't know recent/private facts) | Action gap (FM can't take steps in external systems) |
| What it adds | Retrieved context in the prompt | Reasoning loop + tool calls |
| Latency | +100–500ms (retrieval) | +seconds (multiple FM calls) |
| Failure mode | Wrong retrieval → wrong answer | Tool error → agent loop or abort |
| Use when | "Answer questions about our docs" | "Book a meeting, send an email, update a database" |
Common Misconception: RAG eliminates hallucinations. RAG reduces hallucinations by providing relevant context, but the FM can still misinterpret or confabulate around retrieved passages. Production systems require retrieval quality monitoring + output validation + grounding instructions in the prompt.