Context Engineering

Retrieval Augmented Generation

Retrieval-Augmented Generation (RAG) is a pattern where a system retrieves relevant documents from an external knowledge source and injects them into the model's prompt before generating a response, grounding answers in specific source material rather than training data alone. This matters because language models have a knowledge cutoff and will confidently hallucinate facts outside their training, so any agent that needs to answer questions about your data, your codebase, or recent events needs RAG to be accurate. Every variation of the pattern, from simple vector retrieval to multi-hop agentic RAG, builds on this same core loop: retrieve relevant context, then generate.