Retrieval-Augmented Generation
Ground the agent's reasoning in retrieved, cited sources rather than parametric memory — especially for domain-specific or time-sensitive facts.
This page is the complete instruction page for one pattern called "Retrieval-Augmented Generation." It explains the problem this pattern solves, the idea behind the solution, when you should (and should not) use it, and what happens afterward — both the good effects and the costs.
This matters because building AI agents is not just about making them clever. It is also about making them safe and predictable. Following a well-tested pattern like this one helps avoid common mistakes, and shows you exactly which safety rules and regulations it connects to, listed under "Standards Mesh" on this page.
Context
Foundation models hallucinate confidently on specialised or recent topics. Parametric knowledge is frozen at training; enterprise knowledge is private and changes daily.
Problem
Unretrieved reasoning on domain facts produces authoritative-sounding errors.
Forces
- Retrieval latency vs accuracy
- Index freshness vs cost
- Recall vs precision
Solution
Before generation, retrieve relevant passages from authoritative indexes (vector, keyword, hybrid). Provide retrieved passages in the context, require citation, and instruct the agent to decline when retrieval is empty.
Applicability
- Domain-expert agents
- Customer-support agents over product knowledge
- Regulatory and legal agents
- Any agent relying on stable but specialised facts
Anti-Patterns
- Skipping retrieval "because the model knows"
- Retrieval without citation enforcement
Consequences
- +Reduced hallucination
- +Citations enable verification
- −Retrieval pipeline to maintain
- −Misleading if retrieval returns low-relevance content