# Retrievers

An object that answers "give me the top K chunks for this query". It wraps the vector search from Part 5.

AI developers · Part 06: LangChain / LangGraph · Card 5 of 14 · Last updated 2026-10-13

## Analogy

A repository class: one method, and it hides the SQL behind it.

## In an agent

Wrap a retriever in a tool and the agent can search docs on demand.

## Questions people ask

### What is a retriever in LangChain?

A retriever is an object with one job: given a query, return the most relevant chunks. It usually wraps a vector store search and hides the details, like a repository class hides SQL. You call retriever.invoke with the question and get documents back, ready to put in a prompt.

### How do I let an agent search my documents with a retriever?

Wrap the retriever in a tool, for example searchDocs with a query string argument, and give that tool to the agent. The agent then decides when to search and with what query. This turns classic RAG into agentic RAG, where retrieval is just one more tool in the loop.

## Related concepts

- [Document loaders](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/document-loaders)
- [Text splitters](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/text-splitters)
- [LangChain.js](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/langchain)
- [Chat models](https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/chat-models)

Web page: https://studyvisually.com/learn/tech/ai-developers/langchain-langgraph/retrievers
Study this card in the app: https://studyvisually.com/app/learn?category=ai-developers&card=retrievers
