# What Is RAG (Retrieval-Augmented Generation)?

> RAG lets AI agents retrieve relevant documents or data before generating a response — grounding answers in your knowledge base instead of model training data alone.

**Term:** RAG  
**Category:** Capabilities  
**Also known as:** retrieval-augmented generation, retrieval-augmented agents  
**Updated:** 2026-07-22  
**Canonical:** https://www.frameworkr.com/glossary/rag

---

**RAG (Retrieval-Augmented Generation)** is a pattern where an AI system retrieves relevant information from an external knowledge base before generating a response. Instead of relying solely on what the model learned during training, the agent grounds its answer in your documents, database, or vector store.

## How RAG works

1. **Index** — Documents are chunked and embedded into a vector store
2. **Retrieve** — When a query arrives, similar chunks are fetched by semantic search
3. **Augment** — Retrieved content is injected into the model's prompt as context
4. **Generate** — The model produces a response grounded in the retrieved material

## RAG vs. fine-tuning

| | RAG | Fine-tuning |
|---|---|---|
| **Updates** | Add documents anytime | Retrain the model |
| **Cost** | Lower, pay per query | Higher upfront |
| **Best for** | Dynamic knowledge bases | Style, format, domain behavior |
| **Citations** | Can trace to source docs | Opaque |

Most production agents use RAG (or similar retrieval) for knowledge that changes frequently — product docs, policies, customer records.

## Common RAG pitfalls

- **Chunking too large or too small** — hurts retrieval precision
- **No reranking** — top-k vector matches aren't always the best context
- **Stale indexes** — documents update but the vector store doesn't
- **Over-retrieval** — stuffing too much context into the prompt wastes tokens and confuses the model

## Related reading

See [Agent Memory](/glossary/agent-memory) for how RAG fits into the broader memory architecture.

## Related terms

- [agent memory](https://www.frameworkr.com/glossary/agent-memory.md)
- [ai agent](https://www.frameworkr.com/glossary/ai-agent.md)
- [context window](https://www.frameworkr.com/glossary/context-window.md)


---

_Published by Frameworkr — https://www.frameworkr.com_
