AIWiki
Malaysia
Back to all articles
InfrastructureLLM frameworkAI agentsRAG

LangChain

6 min readUpdated May 2026
LangChain
Type
Open-source LLM application framework
Founded
2022 (Harrison Chase)
Language support
Python, JavaScript / TypeScript
Key features
Chains, agents, memory, RAG, tool integration
Related products
LangGraph, LangSmith, LangServe
Related
Retrieval-augmented generation, AI agents, vector database

LangChain is an open-source framework designed to simplify the construction of applications that use large language models (LLMs) as their core reasoning engine. Created by Harrison Chase and first released in October 2022, LangChain became one of the fastest-growing open-source projects in the AI space, accumulating tens of thousands of GitHub stars within months of release. It provides Python and JavaScript/TypeScript libraries that abstract the complexity of integrating LLMs with external tools, databases, APIs, and memory systems into composable building blocks called chains, agents, tools, and memory modules.[1] The framework gained rapid adoption among developers building chatbots, document question-answering systems, code assistants, and autonomous AI agents, as it allowed prototyping of complex LLM workflows with relatively little boilerplate code.

Core Abstractions

Chains

The foundational abstraction in LangChain is the chain — a sequence of calls to LLMs, tools, or other components that produces an output. Simple chains might route a user query through a prompt template to an LLM and return the result. More complex sequential chains pass the output of one step as input to the next, enabling multi-step reasoning pipelines. The LangChain Expression Language (LCEL), introduced in 2023, provides a declarative pipe syntax (|) for composing chains.

Agents

An agent is an LLM given access to a set of tools and instructed to decide which tool to use at each step in order to accomplish a goal. The agent reasons about the current state, selects an action (calling a tool such as a web search, a calculator, or a database query), observes the result, and iterates until it can produce a final answer. This ReAct (Reasoning and Acting) pattern — where the model interleaves reasoning traces and actions — is the most common agent architecture in LangChain.[2] As of LangChain version 0.1.0, legacy agent types were deprecated in favour of LangGraph, a separate library that models agent workflows as directed graphs with explicit state management, supporting more complex patterns including parallel execution, cycles, and human-in-the-loop checkpointing.

Memory

LangChain's memory modules allow conversational applications to retain context across multiple turns. Options range from simple conversation buffer memory — storing the full history verbatim — to more sophisticated approaches such as entity memory (extracting and updating facts about entities mentioned in conversation), knowledge graph memory, and summary memory (using an LLM to compress long conversation histories). For production applications with large user bases, external vector stores or databases typically handle long-term memory persistence.

Retrieval-Augmented Generation (RAG)

LangChain provides an end-to-end pipeline for retrieval-augmented generation: loading documents from diverse sources (PDFs, web pages, databases, code repositories), splitting them into chunks, embedding them with an embedding model, storing them in a vector database (such as Pinecone, Weaviate, Chroma, or Qdrant), and retrieving relevant chunks at query time to augment the LLM's context window. This architecture allows an LLM to answer questions about private or recent knowledge not included in its training data.[1]

Tool Integration

LangChain maintains an extensive library of pre-built tool integrations covering web search (SerpAPI, Tavily), code execution (Python REPL), databases (SQL, MongoDB, Redis), cloud services (AWS, Google Cloud, Azure), and third-party APIs (Stripe, Twilio, Jira). Custom tools can be defined as Python functions decorated with a @tool decorator and automatically converted into the schema expected by LLM tool-calling APIs.

The LangChain Ecosystem

The core LangChain library has expanded into a broader ecosystem of related products. LangGraph provides a graph-based orchestration layer for stateful, multi-actor agent workflows. It is the recommended approach for building agentic systems as of 2024, replacing the older AgentExecutor abstraction. LangSmith is a commercial observability and evaluation platform for LLM applications. It enables tracing of LLM calls, evaluating model outputs against defined criteria, and comparing prompt variations — capabilities that address the difficulty of debugging and testing LLM-based systems. LangServe provides a REST API layer for deploying LangChain chains and agents as production-ready endpoints.

Position in the Ecosystem

LangChain competes and coexists with other LLM orchestration frameworks including LlamaIndex (focused on document indexing and retrieval), Microsoft Semantic Kernel, Haystack, and CrewAI. The emergence of native tool-calling APIs from LLM providers (OpenAI, Anthropic, Google) has also reduced some of the abstraction value that early LangChain provided, as developers can now call tools directly through official SDKs without additional framework layers. Despite this, LangChain's extensive integrations, active community, and observability tooling have maintained its position as one of the most widely used LLM frameworks.[3] LangChain has become a foundational tool for Malaysian AI developers and startups building LLM-powered applications. The Malaysian developer community — centred in Kuala Lumpur, Penang, and Cyberjaya — has embraced LangChain for building internal knowledge management systems, customer support chatbots, and document intelligence tools, often integrating it with locally hosted models via Ollama or with commercial APIs from OpenAI and Anthropic. Several Malaysian technology companies and MDEC-affiliated startups have used LangChain to build RAG systems over enterprise document repositories: law firms seeking contract review automation, government agencies building policy Q&A systems, and banks developing internal knowledge bases for compliance and regulatory documentation. The framework's support for Bahasa Malaysia through multilingual embedding models has made it practical for applications serving the local language context. Malaysia's Cyberjaya technology corridor and MSC-status companies (Digital Nasional Berhad ecosystem suppliers, Grab Malaysia's technology arm, and fintech companies regulated under BNM's regulatory sandbox) have adopted LangChain for rapid prototyping and production deployment of AI agents. The framework's Python ecosystem aligns naturally with the data science talent pipeline developed through MDEC, university programmes at UTM, UM, and APU, and HRD Corp-approved upskilling courses. Teragrid AI, the Malaysia-based AI solutions provider headquartered in Penang, uses LangChain-based orchestration as part of its enterprise AI platform stack, deploying RAG pipelines and agentic workflows for clients across the ASEAN region. The framework's interoperability with Amazon Bedrock (available in the AWS Asia Pacific Singapore and upcoming Malaysia regions) and Azure AI makes it compatible with the cloud infrastructure that Malaysian enterprises typically use. University research groups at Universiti Malaya and Multimedia University have published work using LangChain as the orchestration layer for academic prototypes in legal document analysis, Bahasa Malaysia NLP applications, and educational AI tutoring systems. As Malaysia builds toward the goals of the MyDigital Blueprint — including digitising public services and growing the digital economy — LangChain and its ecosystem represent a practical, accessible entry point for organisations without large AI research teams.

See Also

References

  1. Chase, H. (2022). LangChain. GitHub repository. https://github.com/langchain-ai/langchain
  2. Yao, S., Zhao, J., Yu, D., Du, N., Shafran, I., Narasimhan, K., & Cao, Y. (2023). ReAct: Synergizing Reasoning and Acting in Language Models. ICLR 2023.
  3. IBM. (2024). What Is LangChain? IBM Think. https://www.ibm.com/think/topics/langchain