LangChain Mastery

Course Content

LangChain Mastery

7 sections · 109 lessons

What are the core components of LangChain?


One interface under every componentRunnable:invoke,batch, streamChat model —messages in, AIMessage outPrompt template —variables to messagesParser or structured outputRetriever — queryin, documents outTool — a functionthe model may callAgent —create_agent on LangGraph
The components are interchangeable because they share one interface, which is why prompt, model and parser snap together with a single pipe.

What you need to know

Think of the components in the order data flows through them in a request.

ComponentJobCurrent example
Chat modelSends messages to an LLM, returns an AIMessageinit_chat_model, ChatOpenAI, ChatAnthropic
Prompt templateBuilds the message list from variablesChatPromptTemplate, MessagesPlaceholder
Output parser / structured outputTurns the reply into a string or typed objectStrOutputParser, llm.with_structured_output(Model)
Document loader and splitterReads files and cuts them into chunksPyPDFLoader, RecursiveCharacterTextSplitter
Embeddings and vector storeTurns chunks into vectors and searches themOpenAIEmbeddings, FAISS, pgvector
Retriever"Given a query, return documents"vectorstore.as_retriever()
ToolA function the model can ask to callthe @tool decorator
AgentA model calling tools in a loopcreate_agent (from langchain.agents)
Memory / persistenceKeeps conversation state between turnsLangGraph checkpointer, e.g. InMemorySaver, PostgresSaver
Callbacks / tracingObserves every stepBaseCallbackHandler, LangSmith

The glue: Runnables

Every component above is a Runnable, so prompt | llm | parser works, and so does putting a retriever inside a dict that feeds a prompt. You learn one interface and it applies everywhere.

What changed in 1.0

  • The old Memory classes (ConversationBufferMemory and friends) are legacy. Even RunnableWithMessageHistory is deprecated in recent langchain-core releases in favour of LangGraph persistence.
  • Legacy chains such as LLMChain and RetrievalQA moved to langchain-classic.
  • create_agent replaced initialize_agent, AgentExecutor and LangGraph's create_react_agent.

A real-life example

An accounts-payable team at a Chennai logistics firm receives 900 supplier invoices a week as PDFs. Their extraction pipeline touches almost every component: PyPDFLoader reads the PDF, a ChatPromptTemplate asks for the vendor name, GSTIN, invoice number, date and total, the chat model reads it, and with_structured_output(Invoice) returns a validated Pydantic object. A callback logs cost per invoice. No retriever or agent is needed, which is itself a good interview point: you use the components the job needs, not all of them.

Follow-up questions to expect

  • "Where does conversation memory live now?" — In LangGraph persistence: pass a checkpointer and a thread_id, and the message list is saved after every step.
  • "What is the difference between a retriever and a vector store?" — A vector store stores and searches vectors; a retriever is the simpler interface "query in, documents out", which may wrap a vector store, a keyword index, or a web search.
  • "What is langchain-core for?" — It holds the base interfaces every other package depends on, so provider packages can release on their own schedule.