All 29 lessons
Foundations: what RAG is and a working pipeline
Better retrieval: chunking and search
Answers you can trust, measure and debug
Production in a company
Agentic RAG
Frameworks: LangChain, LangGraph and LangSmith
- 24. The RAG toolbox: what each library does and why you import it
- 25. The framework landscape: LangChain, LangGraph, LlamaIndex, Haystack
- 26. Lab: Ask Brightline in LangChain
- 27. Lab: agentic RAG as a LangGraph graph
- 28. Lab: tracing, evaluating and monitoring with LangSmith
- 29. Wrap-up: your production agentic RAG checklist
15 min
The RAG toolbox: what each library does and why you import it
Open up what pip installs for RAG: what each library contains, which depend on which, and which you can skip.
By the end of this lesson you can
- Say what each common RAG library is for and what you import from it
- Read the dependency chain: which package pulls in which
- Decide which libraries are required, which are optional, and what replaces them
From earlier lessons · 1 of 2
Why should a model never do the arithmetic in a financial answer?
Pick one answer.
From earlier lessons · 2 of 2
Where does a LangGraph agent's loop cap live?
Pick one answer.
You type one line, pip install sentence-transformers, and wait. The download is past 500 MB before it finishes. You only wanted a 90 MB embedding model. What else just arrived, and do you need it?
The one line, and what it really installs
Every lab in this course starts with a pip install. Each package you name pulls in others it depends on, its dependencies, and those pull in theirs. Here's the line for the LangChain lab, and the packages it actually brings in. All figures come from each package's PyPI metadata, checked on 16 November 2026. Versions move fast, so check again before you pin.
pip install langchain langchain-anthropic langchain-huggingface sentence-transformers# langchain -> langchain-core, langgraph, pydantic# langchain-core -> langsmith, pydantic, httpx, tenacity# langchain-anthropic -> langchain-core, anthropic# langchain-huggingface -> langchain-core, huggingface-hub, tokenizers# sentence-transformers -> transformers, torch, huggingface-hub, numpy, scikit-learn, scipy
Open the box: six groups of libraries
1. Running models locally.
numpyholds vectors as arrays and does the cosine maths. Nearly everything depends on it. Import it asimport numpy as np.sentence-transformersgives youSentenceTransformerfor embeddings andCrossEncoderfor reranking. It's optional: an embedding API replaces it.transformersholds the model definitions and tokenizers underneath. You rarely import it directly.torch(PyTorch) does the computing. It's the big one: about 139 MB on a Mac and 539 MB on Linux, before CUDA libraries for GPUs. You need it only for local models.huggingface-hubdownloads model weights the first time you load a model.
2. Talking to a hosted model. anthropic (from anthropic import Anthropic) and openai are thin API clients. You need one client for generation. They're small and depend mainly on pydantic and an HTTP library.
3. Search.
rank-bm25gives youBM25Okapifor keyword search. It does no tokenising, so you pass lists of words. Its last release was in 2022; Postgres full-text search is a maintained alternative.faiss-cpuholds in-memory vector indexes:IndexFlatL2,IndexHNSWFlat, and IVF and PQ variants. It wants float32 arrays.pgvector, the Python package, only adapts the vector type for Postgres drivers such as psycopg and SQLAlchemy. It has no dependencies of its own. Thevectorextension must also be installed in the Postgres server itself.
4. The LangChain family.
langchain-coreholds the base pieces:Document, prompts, messages, the vector-store interface andInMemoryVectorStore. Every other LangChain package depends on it.langchainis the application layer:create_agentandinit_chat_model. Since 1.x it depends onlanggraph.- Integration packages connect one provider each:
langchain-anthropic(ChatAnthropic),langchain-openai,langchain-huggingface(HuggingFaceEmbeddings) andlangchain-postgres(PGVector). They depend onlangchain-core, not onlangchain, so you can use them without it. langchain-text-splittersholds the splitters, and needs its own install.langchain-classicholds the pre-1.0 chains and retrievers. Install it only to run old code.langchain-communityholds older third-party integrations. LangChain's docs now describe it as no longer maintained.
5. Agents and graphs. langgraph holds StateGraph, MessagesState, START and END. It brings langgraph-prebuilt (ToolNode, tools_condition) and langgraph-checkpoint (saved state) with it. It needs langchain-core, but not the langchain package.
6. Tracing and evaluation. langsmith gives you traceable and Client. It arrives with every langchain-core install, but sends nothing until you set LANGSMITH_TRACING=true. ragas and deepeval are the evaluation frameworks from lesson 14, and they're heavy. Ragas depends on langchain, langchain-community and the OpenAI packages. DeepEval depends on pytest and openai.
See it yourself
from importlib.metadata import requires, versionfor pkg in ["langchain", "langchain-core", "langchain-anthropic", "langgraph"]:deps = [r.split(";")[0].split(">")[0].split("<")[0].strip()for r in (requires(pkg) or []) if "extra ==" not in r]print(f"{pkg} {version(pkg)}: {', '.join(deps[:5])}")
Pip names and import names differ. That's a common first-day error, so here are the ones in this course:
faiss-cpuis imported asfaiss.rank-bm25is imported asrank_bm25.sentence-transformersis imported assentence_transformers.haystack-aiis imported ashaystack.llama-index-coreis imported asllama_index.core.- Every
langchain-xis imported aslangchain_x.
Why one import line per package? Python only loads what you import, so each line says exactly which piece you use. That keeps start-up fast and makes dependencies visible to the next reader.
Match
Match each need to the package you install
Pick an item on the left, then its match on the right.
Worth keeping
- Each pip line pulls a tree of dependencies; sentence-transformers alone brings PyTorch.
- LangChain integrations depend on langchain-core, so you can skip the langchain package.
- LangGraph and LangSmith work without LangChain; langchain itself depends on LangGraph.
- Use Python 3.12+, watch for pip and import names that differ, and pin versions once it works.
You know what's in the box. Next lesson compares the frameworks built from these parts, LangChain, LangGraph, LlamaIndex and Haystack, and when plain Python beats all of them.
Leaderboard
Loading…
50 XP for each lesson you finish, 10 for each right answer. Names show only for learners who turn on Show me on leaderboards.
Sources for this lesson (9)
Each fact in the lesson is marked with the number of the page it comes from.