Context retrieval is the computational process of searching a corpus or memory store—such as a vector database or knowledge graph—to find and return the information most semantically relevant to a given query or current task. This retrieved context is then injected into a language model's context window, providing the necessary factual grounding for the model to generate accurate, informed outputs without hallucination. The process is fundamental to Retrieval-Augmented Generation (RAG) architectures and agentic systems that must reason over external knowledge.
