LangChain for Beginners: Understanding Model Integration and Tool Calling in One Lesson

LangChain compensates for the knowledge, tool, and memory gaps of native large models through chain-based encapsulation
The article starts with the three major limitations of native large models: knowledge limited by training time, no direct access to external systems, and no native multi-turn conversation memory, illustrated by DeepSeek's inability to predict future weather. It then introduces LangChain as an open-source framework for developing LLM-powered applications, analogous to Spring's encapsulation of Servlet, with the core idea of linking models and external resources into a chain where the model handles understanding and decisions and the Chain connects each step. It covers Agent and RAG use cases and core operations like message passing, model invocation, structured output, and tool calling, and advises mastering LangChain before exploring upper-layer ecosystems and reading the official docs.
Why Do We Need LangChain?
Many developers who are just starting to learn about large models call the model API directly, but they quickly run into bottlenecks. According to the analysis by the Bilibili creator, native large models have three inherent shortcomings: knowledge is limited by training time, they cannot directly access external systems, and they do not have multi-turn conversation memory.
Take DeepSeekAd as an example. With intelligent search turned off, if you ask about future weather, the model will clearly reply that it cannot predict it. This shows that the model's own knowledge ends at its training date, and information beyond that scope cannot be obtained.

Similarly, the model cannot directly operate a weather app or call external interfaces, nor can it automatically remember context—the multi-turn dialogue capability in a chat window is implemented by the application layer, not native to the model.
LangChain's Core Positioning
LangChain is an open-source framework for developing applications powered by large language models. The creator used a vivid analogy: just as Spring encapsulates the cumbersome operations of Servlet, LangChain also encapsulates the common logic in AI application development, such as model invocation, tool integration, and context management.
Its name is made up of “Language” and “Chain,” and its core idea is to connect large models and external resources into a single chain. For example, a typical process: read a local document → hand it to the model for understanding → the model decides whether to call a tool → the tool returns a result → organize the answer. The model is responsible for understanding and decision-making, while the Chain is responsible for connecting each step.

Use Cases: Agent and RAG
The creator highlighted two types of projects: Agent and RAG. Agent emphasizes autonomous decision-making and tool calling by the model, while RAG combines retrieval and generation to solve issues related to the timeliness of model knowledge and private data. Both types of scenarios rely on LangChain's componentized capabilities.
Agent refers to a program form that uses a large model as the decision-making core and can autonomously plan steps and call external tools to complete tasks. Unlike the traditional “one input, one output” invocation method, an Agent usually runs in a loop: the model observes the current state, decides the next action (for example, calling search, querying a database, or executing code), and after receiving the tool's returned result, reasons again until the task is complete. The Agent abstraction provided by LangChain encapsulates common logic such as the “think—act—observe” loop, tool descriptions and invocation formats, and records of intermediate steps. Developers only need to register tools and provide a goal.
RAG (Retrieval-Augmented Generation) is a technical approach that combines retrieval from external knowledge bases with large model generation. Its typical process is: first split documents and vectorize them for storage in a vector database; when a user asks a question, vectorize the question in the same way and retrieve the most relevant snippets; then insert these snippets as context into the prompt for the model to answer. RAG can alleviate the problems that a model's knowledge ends at its training date and that it cannot access a company's private data. Compared with fine-tuning, it is lower cost and keeps knowledge more up to date, making it the mainstream solution for enterprise knowledge Q&A applications.
Key Operations: Message Passing and Model Invocation
LangChain provides a standardized message-passing mechanism and model invocation interface. Developers can quickly implement structured output and tool calling through preset components without writing complex logic from scratch. In the tutorial, the creator demonstrated the code implementation of these operations and suggested learning alongside the official documentation.

In LangChain, a Message is the basic unit of conversational interaction. Common types include: SystemMessage (sets the model's role and behavioral constraints), HumanMessage (user input), AIMessage (model reply, which may carry a tool call request), and ToolMessage (the tool execution result passed back to the model). Model APIs from different vendors have different field formats, and LangChain uses a unified message object as an adaptation layer, so the same code can switch between different models such as OpenAI and DeepSeek.
Structured output means having the model return results according to a predefined schema (such as JSON or a Pydantic model), making it easy for programs to parse and use directly rather than performing fragile string extraction from natural language. Tool Calling / Function Calling means the model outputs a structured invocation intent based on the tool's name and parameter descriptions, and the framework is responsible for actually executing it and feeding the result back to the model. These two capabilities are the foundation for building Agents and are also where LangChain's encapsulation value is most concentrated.
Learning Advice
The creator emphasized that LangChain is currently one of the most solid frameworks. Although many upper-layer ecosystems (such as wrappers for DeepSeek and OpenAI) are faster, their customization capabilities are limited, and complex business needs still require returning to LangChain. It is recommended to master LangChain first before coming into contact with other ecosystems; understanding will be easier that way. The official documentation has both Chinese and English versions, and reading them side by side can help you get the latest feature updates.

Overall, this lesson starts from the limitations of models and gradually unfolds LangChain's positioning, core modules, and basic operations. It is suitable as an entry point for large model application development.
One-line Summary
LangChain makes up for the knowledge, tool, and memory shortcomings of native large models through chain-based encapsulation
Paragraph Summary
The article starts from the three major limitations of native large models: knowledge is limited by training time, they cannot directly access external systems, and they do not have native multi-turn conversation memory. It illustrates this with the example that DeepSeek cannot predict future weather. On this basis, it introduces LangChain's positioning—an open-source framework for developing applications powered by large language models—by analogy with Spring's encapsulation of Servlet. Its core idea is to connect models and external resources into a chain, with the model responsible for understanding and decision-making and the Chain responsible for connecting each step. The article introduces two typical application scenarios, Agent and RAG, as well as core operations such as message passing, model invocation, structured output, and tool calling. Finally, it recommends mastering LangChain solidly before exploring upper-layer ecosystems and reading the official documentation more often.
Related articles

Is Anthropic Unbeatable? A Deep Dive into Fable 5.2
A deep dive into Anthropic Fable 5.2 and Mythos 5.2: benchmark dominance and a leap in the sciences, but self-built tests expose weaknesses. Why real competitiveness comes from task division between models, not a single strongest one.

Why Rockets Don't Land Horizontally Like Airplanes: A Physics and Engineering Trade-off
Why don't rockets land horizontally like airplanes with wings? This article explains the engineering trade-offs behind Shuttle-style landings and Falcon 9 vertical landings from three angles: wing lift conditions, orbital velocity costs, and reusable booster structural reuse.

Can AI Governance Tools Block Agent and API Calls?
A Reddit developer questions whether AI governance tools only flag Agent calls rather than block them. We analyze the flagging vs. real-time blocking capability gap, vendor demo mismatches, and key questions to ask when buying.