[KongchangAI]
· 2 min read· 1,191 words

Getting Started with LangChain: Core Concepts of the Agent Development Framework

Getting Started with LangChain: Core Concepts of the Agent Development Framework

LangChain is a structured framework that fills the three major gaps of LLMs and supports Agent development.

Starting from "why we need LangChain," the article points out that it is not a simple API wrapper but a structured development framework analogous to Spring in the Java ecosystem. LLMs have three inherent limitations: knowledge constrained by training data, inability to directly interact with external systems, and no state retention capability. LangChain addresses these three capabilities through Function Call tool invocation, system integration, and memory management. The article also explains the meaning behind the Lang and Chain naming, emphasizing the chaining of models with tools, data sources, and memory components to break through single-point capability boundaries, and provides a learning path centered on official documentation covering LangChain, LangGraph, DeepAgents, and LangSmith.

Why Can't LLM Application Development Avoid LangChain?

In the field of Agent development, LangChain is almost the first framework every developer encounters. This beginner-friendly tutorial on Bilibili starts from the most fundamental concepts and tries to answer one question: why do we actually need LangChain instead of just calling the model API directly?

The answer lies in the framework's positioning. According to the video, LangChain itself is an open-source framework for developing applications powered by large language models. It is not a simple API wrapper, but a development framework that provides pre-built agent architectures and rich tool integrations — the video's author uses a vivid analogy: if you've written Java, you can think of LangChain's role in Agent development as analogous to Spring's place in the Java ecosystem.

It is not merely

This analogy gets to the key point: LangChain's value isn't about "whether you can get the model to respond" but about providing a structured development paradigm so developers don't have to build complex integration architectures from scratch.

The Three Inherent Limitations of LLMs, and How LangChain Fills Them

To understand a framework, first look at what problems it solves. The video summarizes the limitations of large language models into three macro dimensions, which are also the core reasons LangChain exists.

Knowledge Limited by Training Data

A model's knowledge is frozen at its training cutoff. If a model's training data ends at a certain date, it cannot answer questions about news, weather, or other information after that point. The video specifically clears up a common misconception: users think some assistants "know everything," but in reality that's already a wrapped application, not the raw model's capability. LangChain uses the Function Call mechanism to let developers invoke tools themselves to fetch data the model can't obtain on its own.

Function Call is a structured output capability provided by large models: developers pre-declare the available tool functions and their parameter formats, and when the model determines during a conversation that a function needs to be called, it returns a JSON object conforming to that format rather than directly giving a natural language answer. The application parses this JSON, actually executes the function (such as querying a weather API or searching a database), then passes the result back to the model, which integrates it into the final reply. Its significance lies in decoupling "model generation" from "real-world operations" — the model only decides what to call and what parameters to pass, while actual execution is done by external code, making results reliable and auditable. LangChain provides a unified wrapper around this mechanism, so tool-calling interfaces from different vendors' models can be integrated with consistent code.

Cannot Directly Interact with External Systems

The model itself cannot call third-party APIs to check the weather, cannot access a company's internal database, and cannot perform complex precise calculations. The video notes that even for operations like addition, subtraction, multiplication, and division, the model may not calculate accurately, but by using Function Call to get feedback and implementing the calculation logic itself, reliable results can be obtained. LangChain's tool integration capabilities are precisely designed for such scenarios.

Applications powered by large language models

No State Retention Capability

A large model is essentially "one question, one answer" — it doesn't naturally remember what you asked in the previous turn. The ability to maintain context across multi-turn conversations doesn't come from the model itself but from memory management at the application layer. This is also one of the key problems LangChain solves — the implementation of short-term context memory and long-term memory forms the foundation of an Agent's conversational capabilities.

And there's another piece

Short-term memory and long-term memory are two levels of Agent memory management. Short-term memory usually refers to the context window of the current session, implemented by concatenating historical messages by turn into the prompt, combined with truncation, summarization, and other strategies to control token consumption; it depends on the model's context length and disappears when the session ends. Long-term memory persists information to external storage — a common approach is to chunk conversations or documents, convert them into vectors via embedding models, store them in a vector database, and during conversation retrieve relevant fragments by semantic similarity to inject into the prompt. The two solve different problems: short-term memory maintains conversational coherence, while long-term memory lets the Agent remember user preferences and domain knowledge across sessions. LangChain provides corresponding memory components and vector store integrations for each.

The Secret in the Name: Lang and Chain

The video interprets the naming of LangChain: Lang stands for Language (large language model), and Chain represents the combination of chained interactions. In plain terms, it means connecting large language models with other resources in a computer in a chained manner, enabling them to interact and thereby building more powerful AI applications or agents.

This naming logic also explains the framework's design philosophy — a single model has limited capabilities, but by stringing models, tools, data sources, and memory components into a chain, you can break through the boundaries of any single point of capability.

Chain in LangChain refers to a series of composable invocation steps: a chain's input passes through prompt templates, model calls, output parsing, and other stages, propagating level by level and ultimately producing a result. Early LangChain centered on various preset Chains as its core abstraction, with developers quickly building flows by connecting components in series; as applications grew more complex, simple linear chains struggled to express branching, loops, and conditional logic, and the framework gradually shifted toward graph-structured orchestration represented by LangGraph, using nodes and edges to describe an Agent's state transitions. Understanding the concept of Chain helps you read a large number of existing tutorials and code examples, and also explains why the framework evolved from "chains" to "graphs."

Documentation System and Learning Path

The LangChain ecosystem is constantly evolving, and the video emphasizes that official documentation should be the primary reference when learning. According to the explanation, the official system mainly includes LangChain, LangGraph, DeepAgents, and LangSmith, among which LangChain is the first stop for beginners. Official documentation is available in both Chinese and English, with the Chinese version largely kept in sync and identical code examples — learners with limited English can read the Chinese version directly, though the latest updates still follow the official English documentation.

The official one here

The documentation defines LangChain overall as a "model plus wrapper framework" and provides highly configurable Agent wrapping capabilities for interacting with various models. For beginners, establishing this macro-level understanding first before moving on to practicing specific APIs will make the path clearer.

Final Thoughts

The value of this tutorial lies in reframing LangChain from "yet another framework to learn" back to "an engineering solution to model deficiencies." The three limitations — knowledge constraints, lack of external interaction, and inability to retain state — correspond to three major capability modules: tool calling, system integration, and memory management. Once you understand this correspondence, learning about the implementation principles of short-term memory and vector-based long-term memory won't feel like memorizing APIs but rather completing a full Agent architecture.

#LangChain#Agent development#Function Call#LangGraph#LLM limitations#memory management
Share:

Related articles