Retrieval is how agents access information too large, too current, or too specialized to fit in the context window. It addresses three fundamental LLM limits: the context window cap, the training cutoff, and hallucination.
Web search — Query a search API (Google, Bing, Tavily), retrieve current web results. Used for real-time information and anything after the training cutoff.
Vector search — Embed the query and retrieve semantically similar documents from a vector database (Pinecone, Weaviate, Qdrant). Used for proprietary knowledge bases, internal documentation, and domain corpora.
Structured database — Generate and execute a SQL query, or call a structured API. Used when information is structured and the query is specific.
File system — Search for and read specific files. Used for codebase navigation, document processing, and data analysis in local or cloud storage.
Most well-designed agents use reactive retrieval — retrieve on demand, as gaps in knowledge become apparent, rather than front-loading everything at task start. This minimizes context clutter and keeps the context focused on what is currently relevant.
Retrieve once from the knowledge base, inject results, generate a response. Fixed retrieval — no ability to refine if the first pass misses key information.
Retrieve, reason about results, determine if more information is needed, refine the query, retrieve again. Iterative and adaptive — continues until the question is answerable.
Ask the AI assistant about retrieval in agents, how to implement vector search as a tool, or how agentic retrieval extends RAG.