Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
Agent Builder

AI agent glossary

Retrieval-augmented generation (RAG)

Finding relevant documents for a question and adding them to the model's prompt, so it can answer from your data instead of memory alone.

RAG has two steps. First, retrieve: search a collection of documents, such as help articles, policies, or notes, for passages related to the question. Second, generate: give those passages to the model along with the question and ask it to answer from them.

This lets a model work with private, recent, or specialized information it was never trained on, and it makes answers easier to verify because you can see which sources were used.

Retrieval quality decides answer quality. If the search returns the wrong passages, the model will confidently answer from the wrong material. In agents, retrieval is often just another tool, which lets the model search several times and refine its queries.

Example

A customer asks about the return window. The system retrieves the returns policy section, includes it in the prompt, and the model answers with the correct number of days and a link to the policy.

Learn more in the course

Related terms

Go from definitions to doing

Learn to use and build AI agents in 65 practical lessons.