Hubbry Logo
LangChainLangChainMain
Open search
LangChain
Community hub
LangChain
logo
7 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
LangChain
LangChain
from Wikipedia
LangChain
DeveloperHarrison Chase
Initial releaseOctober 2022
Stable release
0.1.16[1] / 11 April 2024; 18 months ago (11 April 2024)
Repositorygithub.com/langchain-ai/langchain
Written inPython and JavaScript
TypeSoftware framework for large language model application development
LicenseMIT License
WebsiteLangChain.com

LangChain is a software framework that helps facilitate the integration of large language models (LLMs) into applications. As a language model integration framework, LangChain's use-cases largely overlap with those of language models in general, including document analysis and summarization, chatbots, and code analysis.[2]

History

[edit]

LangChain was launched in October 2022 as an open source project by Harrison Chase, while working at machine learning startup Robust Intelligence. In April 2023, LangChain had incorporated and the new startup raised over $20 million in funding at a valuation of at least $200 million from venture firm Sequoia Capital, a week after announcing a $10 million seed investment from Benchmark.[3][4]

In the third quarter of 2023, the LangChain Expression Language (LCEL) was introduced, which provides a declarative way to define chains of actions.[5][6]

In October 2023 LangChain introduced LangServe, a deployment tool to host LCEL code as a production-ready API.[7]

In February 2024 LangChain released LangSmith, a closed-source observability and evaluation platform for LLM applications, and announced a US $25 million Series A led by Sequoia Capital.[8] On 14 May 2025 the company launched LangGraph Platform into general availability, providing managed infrastructure for deploying long-running, stateful AI agents.[9]

Capabilities

[edit]

LangChain's developers highlight the framework's applicability to use-cases including chatbots,[10] retrieval-augmented generation,[11] document summarization,[12] and synthetic data generation.[13]

As of March 2023, LangChain included integrations with systems including Amazon, Google, and Microsoft Azure cloud storage;[14] API wrappers for news, movie information, and weather; Bash for summarization, syntax and semantics checking, and execution of shell scripts; multiple web scraping subsystems and templates; few-shot learning prompt generation support; finding and summarizing "todo" tasks in code; Google Drive documents, spreadsheets, and presentations summarization, extraction, and creation; Google Search and Microsoft Bing web search;[15] OpenAI, Anthropic, and Hugging Face language models; iFixit repair guides and wikis search and summarization; MapReduce for question answering, combining documents, and question generation; N-gram overlap scoring; PyPDF, pdfminer, fitz, and pymupdf for PDF file text extraction and manipulation; Python and JavaScript code generation, analysis, and debugging; Milvus vector database[16] to store and retrieve vector embeddings; Weaviate vector database[17] to cache embedding and data objects; Redis cache database storage; Python RequestsWrapper and other methods for API requests; SQL and NoSQL databases including JSON support; Streamlit, including for logging; text mapping for k-nearest neighbors search; time zone conversion and calendar operations; tracing and recording stack symbols in threaded and asynchronous subprocess runs; and the Wolfram Alpha website and SDK.[18] As of April 2023, it can read from more than 50 document types and data sources.[19]

LangChain tools

[edit]
Tool name Account required? API key required? Licencing Features Documentation URL
Alpha Vantage No Yes Proprietary Financial data, analytics https://python.langchain.com/docs/integrations/tools/alpha_vantage
Apify No Yes Commercial Web scraping, automation https://python.langchain.com/docs/integrations/providers/apify/
ArXiv No No Open Source Scientific papers, research https://python.langchain.com/docs/integrations/tools/arxiv
AWS Lambda Yes Yes Proprietary Serverless computing https://python.langchain.com/docs/integrations/tools/awslambda
Bash No No Open source Shell environment access https://python.langchain.com/docs/integrations/tools/bash
Bearly Code Interpreter No Yes Commercial Remote Python code execution https://python.langchain.com/docs/integrations/tools/bearly
Bing Search No Yes Proprietary Search engine https://python.langchain.com/docs/integrations/tools/bing_search
Brave Search No No Open source Privacy-focused search https://python.langchain.com/docs/integrations/tools/brave_search
ChatGPT Plugins No Yes Proprietary ChatGPT https://python.langchain.com/docs/integrations/tools/chatgpt_plugins
Connery No Yes Commercial API actions https://python.langchain.com/docs/integrations/tools/connery
Dall-E Image Generator No Yes Proprietary Text-to-image generation https://python.langchain.com/docs/integrations/tools/dalle_image_generator
DataForSEO No Yes Commercial SEO data, analytics https://python.langchain.com/docs/integrations/tools/dataforseo
DuckDuckGo Search No No Open source Privacy-focused search https://python.langchain.com/docs/integrations/tools/ddg
E2B Data Analysis No No Open source Data analysis https://python.langchain.com/docs/integrations/tools/e2b_data_analysis
Eden AI No Yes Commercial AI tools, APIs https://python.langchain.com/docs/integrations/tools/edenai_tools
Eleven Labs Text2Speech No Yes Commercial Text-to-speech https://python.langchain.com/docs/integrations/tools/eleven_labs_tts
Exa Search No Yes Commercial Web search https://python.langchain.com/docs/integrations/tools/exa_search
File System No No Open source File system interaction https://python.langchain.com/docs/integrations/tools/filesystem
Golden Query No Yes Commercial Natural language queries https://python.langchain.com/docs/integrations/tools/golden_query
Google Cloud Text-to-Speech Yes Yes Proprietary Text-to-speech https://python.langchain.com/docs/integrations/tools/google_cloud_texttospeech
Google Drive Yes Yes Proprietary Google Drive access https://python.langchain.com/docs/integrations/tools/google_drive
Google Finance Yes Yes Proprietary Financial data https://python.langchain.com/docs/integrations/tools/google_finance
Google Jobs Yes Yes Proprietary Job search https://python.langchain.com/docs/integrations/tools/google_jobs
Google Lens Yes Yes Proprietary Visual search, recognition https://python.langchain.com/docs/integrations/tools/google_lens
Google Places Yes Yes Proprietary Location-based services https://python.langchain.com/docs/integrations/tools/google_places
Google Scholar Yes Yes Proprietary Scholarly article search https://python.langchain.com/docs/integrations/tools/google_scholar
Google Search Yes Yes Proprietary Search engine https://python.langchain.com/docs/integrations/tools/google_search
Google Serper No Yes Commercial SERP scraping https://python.langchain.com/docs/integrations/tools/google_serper
Google Trends Yes Yes Proprietary Trend data https://python.langchain.com/docs/integrations/tools/google_trends
Gradio No No Open source Machine learning UIs https://python.langchain.com/docs/integrations/tools/gradio_tools
GraphQL No No Open source API queries https://python.langchain.com/docs/integrations/tools/graphql
HuggingFace Hub No No Open source Hugging Face models, datasets https://python.langchain.com/docs/integrations/tools/huggingface_tools
Human as a tool No No N/A Human input https://python.langchain.com/docs/integrations/tools/human_tools
IFTTT WebHooks No Yes Commercial Web service automation https://python.langchain.com/docs/integrations/tools/ifttt
Ionic Shopping No Yes Commercial Shopping https://python.langchain.com/docs/integrations/tools/ionic_shopping
Lemon Agent No Yes Commercial Lemon AI interaction https://python.langchain.com/docs/integrations/tools/lemonai
Memorize No No Open source Fine-tune LLM to memorize information using unsupervised learning https://python.langchain.com/docs/integrations/tools/memorize
Nuclia No Yes Commercial Indexing of unstructured data https://python.langchain.com/docs/integrations/tools/nuclia
OpenWeatherMap No Yes Commercial Weather data https://python.langchain.com/docs/integrations/tools/openweathermap
Polygon Stock Market API No Yes Commercial Stock market data https://python.langchain.com/docs/integrations/tools/polygon
PubMed No No Open source Biomedical literature https://python.langchain.com/docs/integrations/tools/pubmed
Python REPL No No Open source Python shell https://python.langchain.com/docs/integrations/tools/python
Reddit Search No No Open source Reddit search https://python.langchain.com/docs/integrations/tools/reddit_search
Requests No No Open source HTTP requests https://python.langchain.com/docs/integrations/tools/requests
SceneXplain No No Open source Model explanations https://python.langchain.com/docs/integrations/tools/sceneXplain
Search No No Open source Query various search services https://python.langchain.com/docs/integrations/tools/search_tools
SearchApi No Yes Commercial Query various search services https://python.langchain.com/docs/integrations/tools/searchapi
SearxNG No No Open source Privacy-focused search https://python.langchain.com/docs/integrations/tools/searx_search
Semantic Scholar API No No Open source Academic paper search https://python.langchain.com/docs/integrations/tools/semanticscholar
SerpAPI No Yes Commercial Search engine results page scraping https://python.langchain.com/docs/integrations/tools/serpapi
StackExchange No No Open source Stack Exchange access https://python.langchain.com/docs/integrations/tools/stackexchange
Tavily Search No Yes Commercial Question answering https://python.langchain.com/docs/integrations/tools/tavily_search
Twilio No Yes Commercial Communication APIs https://python.langchain.com/docs/integrations/tools/twilio
Wikidata No No Open source Structured data access https://python.langchain.com/docs/integrations/tools/wikidata
Wikipedia No No Open source Wikipedia access https://python.langchain.com/docs/integrations/tools/wikipedia
Wolfram Alpha No Yes Proprietary Computational knowledge https://python.langchain.com/docs/integrations/tools/wolfram_alpha
Yahoo Finance News No Yes Commercial Financial news https://python.langchain.com/docs/integrations/tools/yahoo_finance_news
Youtube No Yes Commercial YouTube access https://python.langchain.com/docs/integrations/tools/youtube
Zapier Natural Language Actions No Yes Commercial Workflow automation https://python.langchain.com/docs/integrations/tools/zapier

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
LangChain is an open-source framework designed to simplify the development of applications powered by large language models (LLMs), enabling the creation of AI agents that integrate LLMs with external data sources, tools, and APIs. It provides modular components, pre-built architectures, and over 1,000 integrations with models, databases, and services to streamline the full lifecycle of LLM applications, from prototyping to production deployment. Available in both Python and JavaScript versions, LangChain emphasizes flexibility, avoiding vendor lock-in while supporting reliable agent engineering. Originating as a side project in October 2022 by Harrison Chase, a former machine learning engineer at Robust Intelligence, LangChain quickly gained traction following the launch of ChatGPT in November 2022. The project was incorporated in January 2023, with Chase as CEO and Ankush Gola as co-founder, and has since evolved into a comprehensive platform used by companies such as Rakuten, Cisco, and Moody's for production AI systems. Key milestones include raising a $10 million seed round in April 2023 led by Benchmark, a $25 million Series A in February 2024 led by Sequoia Capital at a post-money valuation of $200 million, and a $125 million Series B in October 2025 at a post-money valuation of $1.25 billion. The framework's GitHub repository has amassed over 118,000 stars as of November 2025, reflecting its active community and widespread adoption. At its core, LangChain offers abstractions like chains, agents, and retrieval-augmented generation (RAG) to handle complex workflows, such as chatbots, document question-answering, and data extraction. It integrates seamlessly with related tools like LangGraph for building stateful, multi-actor applications and LangSmith for observability, debugging, and monitoring of LLM traces. Licensed under the MIT license, LangChain remains freely available while the company provides enterprise features through its platform.

Overview

Definition and Purpose

LangChain is an open-source framework for building applications with large language models, providing abstractions for chains, agents, and retrieval-augmented generation. It is a modular framework implemented in Python and JavaScript, designed for orchestrating large language models (LLMs) within applications, and has become one of the most popular LLM orchestration frameworks. It enables developers to compose and integrate key components—such as prompts, models, memory, and output parsers—into cohesive systems that leverage LLMs for tasks like reasoning and context-aware processing. The framework's core purpose is to streamline the development of LLM-powered applications, from rapid prototyping to scalable production deployment, by abstracting the intricacies of multi-step LLM interactions, external data integration, and state management. This abstraction reduces boilerplate code and promotes reusability, allowing developers to focus on application logic rather than low-level API handling. LLM orchestration refers to frameworks and patterns for coordinating Large Language Model calls with other components like retrieval systems, tools, and external APIs to build complex AI applications. Orchestration handles the flow of data between components, manages conversation state, and implements patterns like chain-of-thought and multi-step reasoning. Major orchestration frameworks include LangChain (a comprehensive toolkit in Python and JavaScript), LlamaIndex (Python-focused on data indexing and retrieval), Semantic Kernel (Microsoft .NET-focused), and Haystack (Python pipeline-oriented). These frameworks provide abstractions for common patterns including RAG pipelines, agent loops, and tool use, positioning LangChain as a versatile option within this ecosystem for building scalable LLM applications. Emerging in 2022 amid the growing prominence of LLMs like GPT-3, LangChain addresses early adoption challenges, particularly the absence of standardized approaches for building reliable multi-step workflows that chain LLM calls effectively. In a typical high-level workflow, user inputs are formatted into prompts that invoke LLMs, with subsequent output parsing to refine results and enable further processing.

Key Principles

LangChain's foundational design emphasizes modularity, enabling developers to construct applications by composing interchangeable components such as prompts, models, and retrievers in a flexible manner. This approach allows for seamless mixing and matching of elements without vendor lock-in, promoting reusability across different LLM ecosystems. Extensibility is another core principle, rooted in LangChain's open-source architecture, which facilitates custom integrations and extensions by providing high-level abstractions for key elements like prompts, models, and retrievers. These abstractions accommodate a wide range of LLMs from various providers, empowering developers to tailor solutions to specific needs without starting from scratch. To address the inherent non-determinism of LLMs, LangChain incorporates observability as a key focus, offering built-in support for tracing and evaluation mechanisms that allow debugging and monitoring of complex chains. This feature, integrated early through tools like LangSmith, enables detailed inspection of application behavior, iteration on performance, and identification of issues in production environments. Interoperability is prioritized through standardized interfaces for tools, data sources, and external components, ensuring compatibility across diverse systems. In 2025, these principles evolved to better support multi-framework ecosystems, enhancing integration with emerging agentic and graph-based workflows. For instance, retrieval-augmented generation (RAG) exemplifies modularity by combining retrieval modules with LLM chains to ground responses in external data.

History

Origins and Founding

LangChain was founded by Harrison Chase, a graduate of Harvard University with degrees in statistics and computer science, who had previously worked as a machine learning engineer at Kensho Technologies, a fintech startup focused on AI applications in finance. In 2022, while employed at Robust Intelligence, Chase initiated LangChain as a personal side project to tackle the emerging challenges in building applications with large language models (LLMs). The framework originated from Chase's recognition of the limitations in early LLM experimentation, where developers relied on custom, one-off scripts to handle prompt formatting, model invocations, and output parsing, lacking standardized tools for more complex, production-ready integrations. The project's timing aligned closely with the explosive rise of generative AI, particularly following the public launch of ChatGPT by OpenAI on November 30, 2022, which sparked widespread interest in LLM-powered applications but highlighted the need for reusable patterns to streamline development. LangChain addressed this by providing modular abstractions for chaining LLM calls with external data sources, memory management, and agentic behaviors, enabling developers to compose sophisticated workflows without reinventing core functionalities. This focus on practicality emerged from Chase's hands-on experience in ML engineering, where he observed the ad-hoc nature of LLM interactions hindering scalable app building amid the post-ChatGPT hype. Chase open-sourced LangChain on GitHub in October 2022, just weeks before ChatGPT's debut, marking its debut as a lightweight Python library centered on prompt templating and basic LLM orchestration. The repository quickly gained traction, amassing over 5,000 stars by February 2023 and tripling to 18,000 by April, reflecting the community's enthusiasm for a tool that simplified LLM app prototyping during the early generative AI boom. At its inception, LangChain operated without a formal company structure, relying on community contributions and Chase's solo efforts to iterate on core utilities for LLM chaining and integration. This grassroots approach laid the groundwork for its evolution into a structured organization in subsequent years.

Development Milestones

LangChain Inc. was formally incorporated on January 31, 2023, with Harrison Chase as CEO and Ankush Gola as co-founder, to support the ongoing development of the open-source project, enabling the founders to transition to full-time work on the framework. This move was followed shortly by a $10 million seed funding round in April 2023, led by Benchmark, which provided the resources to expand the team and accelerate feature development. In February 2024, the company raised a $25 million Series A round led by Sequoia Capital, achieving a post-money valuation of $200 million. In October 2025, LangChain secured a $125 million Series B round also led by Sequoia Capital, reaching a $1.25 billion valuation and unicorn status. In July 2023, LangChain released LangSmith, a platform designed to address key challenges in building LLM applications by offering tools for debugging, testing, evaluating, and monitoring chains and agents. This launch filled a critical observability gap in the ecosystem, allowing developers to trace LLM interactions and iterate more effectively on production-grade systems. The following year, in January 2024, the team introduced LangGraph as an extension to the core framework, providing a library for constructing stateful, graph-based workflows that support cyclical processes and multi-actor agent interactions. LangChain achieved significant version stability with the release of v1.0 in October 2025, marking a milestone for both the core library and LangGraph. The LangChain v1.0 update introduced a standardized core agent loop integrated with middleware for enhanced extensibility, while LangGraph v1.0 added support for stateful persistence, improving reliability for long-running applications. These releases emphasized production readiness, with a focus on interoperability across models, tools, and deployment environments to facilitate scalable agentic AI systems. By 2025, the project had grown substantially in the developer community, surpassing 100,000 GitHub stars and contributing to emerging standards in multi-agent orchestration through open-source collaborations.

Core Components

LangChain's core components provide abstractions essential for building applications with large language models, including document loaders for ingesting data from various sources into structured documents, text splitters for implementing chunking strategies to divide large texts into manageable pieces, embeddings for generating vector representations of text to capture semantic meaning, vector stores for integrating with databases to store and query these vectors for similarity searches, retrievers for abstracting search mechanisms to fetch relevant information based on queries, and chains for creating composable workflows that sequence LLM interactions and other components. Document loaders are foundational components in Retrieval-Augmented Generation (RAG) systems that extract text and metadata from various file formats and data sources for indexing. Supported formats typically include PDF, Word documents, PowerPoint, HTML, Markdown, plain text, CSV, and JSON. Data sources include local files, cloud storage such as S3, Google Drive, and Azure Blob, databases, web scraping, and SaaS applications like Notion, Confluence, and Slack. Quality document loading is crucial, as errors or omissions at this stage propagate through the entire pipeline; PDFs, in particular, require careful handling due to layout complexity. LangChain provides an extensive collection of loaders, comparable to those in LlamaIndex, while for production systems, dedicated parsing services like Unstructured.io often provide better quality than basic loaders.

Chains and Prompts

In LangChain, the foundational mechanism for orchestrating interactions with language models and other components is the LangChain Expression Language (LCEL), a declarative syntax for composing chains using the Runnable interface. LCEL enables modular, composable workflows by sequencing elements such as prompts, model invocations, and output parsers with the pipe operator (|), e.g., chain = prompt | model | parser. This approach supports linear execution for tasks like text generation or data extraction, promoting reusability and avoiding custom coding for integrations. Legacy chain classes, such as LLMChain and SequentialChain, are deprecated since version 0.1.17 and should be replaced with LCEL for new development. LCEL chains emphasize deterministic execution, where components are invoked sequentially, with outputs from one feeding into the next, facilitating multi-stage reasoning or transformations. All LCEL components implement the Runnable interface, allowing standardized invocation, streaming, batching, and async support. LangChain supports several key orchestration patterns through LCEL, including sequential chains for fixed step sequences, router chains for dynamic path selection based on inputs, agent loops for LLM-driven tool selection, and parallel execution for concurrent operations across multiple components. Prompts serve as the input structuring layer within chains, using the PromptTemplate class to define reusable string formats that incorporate dynamic placeholders, such as {user_input} or {context}, via Python's f-string syntax or partial formatting methods. This templating ensures consistent guidance for the LLM, improving response reliability across invocations; for example, a prompt might specify "Summarize the following text in three bullet points: {text}" to direct concise output. PromptTemplate objects are directly integrable into LCEL chains, where they are populated with runtime variables before model execution. Output parsers handle the post-processing of LLM responses to enforce structure, transforming unstructured text into parseable formats like dictionaries or objects. The PydanticOutputParser, for instance, leverages Pydantic models to define and validate JSON schemas, rejecting invalid outputs and retrying if needed, which is particularly useful for extracting fields like "summary" or "key_points" from free-form generations. In an LCEL chain, the parser follows the model step, ensuring downstream components receive clean, typed data. A representative workflow is the construction of a summarization chain using LCEL, where a PromptTemplate instructs the LLM to condense input text—e.g., "Write a concise summary of the following: {input_text}"—followed by model invocation and parsing via PydanticOutputParser to yield a structured JSON object with attributes like "main_idea" and "supporting_points". This can be assembled as chain = prompt | llm | parser for single-document handling or extended with document loaders and splitters for multi-document scenarios, using a "stuff" approach that aggregates content into a single prompt for efficient processing of moderate-length texts. Such LCEL chains exemplify linear LLM interactions, scalable to extensions like agents for non-linear decision-making.

Models and Outputs

LangChain provides abstractions for integrating with large language models (LLMs) through standardized interfaces, enabling seamless interaction with various providers. The ChatOpenAI class, for instance, facilitates access to OpenAI's chat models such as GPT-3.5-turbo or GPT-4, handling API calls via the OpenAI API key and supporting parameters like temperature, max tokens for output length limits, and frequency penalties to control generation. Similarly, the HuggingFaceHub integration allows invocation of open-source models hosted on Hugging Face, requiring an API token and supporting tasks like text generation and summarization through the Inference API. These abstractions implement the Runnable interface, which manages underlying API requests, error handling, and response formatting, while also enabling streaming outputs for real-time applications by yielding tokens incrementally during generation. Beyond chat models, LangChain supports non-generative models for tasks like embeddings, which convert text into vector representations for similarity searches. The HuggingFaceEmbeddings class leverages sentence-transformer models, such as the default "sentence-transformers/all-mpnet-base-v2," to produce dense embeddings locally or via the Hugging Face hub, integrating with libraries like transformers for efficient computation without external API dependencies. This abstraction handles batch embedding of multiple texts and normalizes vectors as needed, making it suitable for downstream applications like retrieval-augmented generation (RAG) pipelines where embeddings facilitate document ranking. Output handling in LangChain transforms raw, unstructured LLM responses into usable formats through dedicated parsers, mitigating issues like inconsistent or erroneous outputs. Classes such as JsonOutputParser and PydanticOutputParser extract structured data, converting free-form text into JSON objects or validated Pydantic models, respectively, by defining schemas that guide parsing. For reliability, the RetryOutputParser wraps other parsers and employs an LLM to iteratively fix parsing failures, such as malformed JSON due to hallucinations, by prompting the model to correct errors up to a configurable retry limit. This approach ensures robust post-processing, with parsers implementing the Runnable interface for chaining with models. To optimize for production environments, LangChain's model invocations support efficient patterns like batch processing and asynchronous execution. The batch method processes multiple inputs in parallel using thread pools, reducing latency for high-volume tasks, while abatch and ainvoke enable concurrent async operations via asyncio, ideal for scalable deployments handling numerous requests. These features, combined with token management and streaming, allow developers to build responsive applications without custom orchestration code.

Advanced Features

Agents and Tools

In LangChain, agents are autonomous systems powered by large language models (LLMs) that dynamically decide on sequences of actions to accomplish tasks, rather than following predefined chains of operations. These agents leverage the LLM as a reasoning engine to select appropriate tools, execute them, and iterate based on observations until reaching a resolution. This approach enables more flexible and adaptive interactions with external environments, such as querying databases or performing computations, by interleaving thought processes with actionable steps. A prominent agent type in LangChain is the ReAct agent, which implements the ReAct paradigm of synergizing reasoning and acting, as introduced in the seminal work on ReAct. As of LangChain v1.0 (October 2025), legacy functions like create_react_agent have been deprecated; the recommended way to create ReAct agents is via create_agent in langchain.agents, which integrates an LLM, a prompt template, and a list of tools. For more advanced agent workflows, including stateful and multi-actor applications, see the LangGraph section. Tools in LangChain serve as the interfaces that allow agents to interact with external systems or perform computations beyond the LLM's inherent capabilities. Each tool is defined with a name, description, and schema for inputs and outputs, enabling the agent to select and invoke it based on the task context. Pre-built tools include integrations like SerpAPI for web search, which enables real-time information retrieval, and mathematical utilities such as a calculator for arithmetic operations. LangChain also provides toolkits, such as the official GitHub Toolkit, which offers capabilities including fetching and listing issues, commenting on issues and pull requests, creating and updating files, opening pull requests, and searching repositories. Custom tools can be created by wrapping Python functions with the @tool decorator, which automatically generates the necessary schema from function signatures and docstrings; for example, a function to fetch weather data could be decorated and bound to an agent for location-based queries. These tools are passed as a list to the agent during initialization, allowing the LLM to reference their descriptions in its decision-making process. The legacy AgentExecutor class, deprecated in LangChain v1.0 (October 2025), previously managed the runtime loop for agent execution by handling cycles of observation, reasoning, action, and feedback until task completion, with safeguards like maximum iterations to prevent infinite loops. Current agent execution uses LCEL runnables or LangGraph for more robust handling, supporting asynchronous execution and callbacks for monitoring progress. For example, in a ReAct setup, the system would parse the LLM's output for tool calls, run the selected tool, and append the result to the conversation history for subsequent reasoning steps. As of LangChain v1.0 (October 2025), basic multi-agent configurations in core LangChain—where a central agent coordinates specialized sub-agents for divided tasks—are deprecated. Recommended multi-agent systems, including supervisor-worker hierarchies, are built using LangGraph's graph-based orchestration (see the LangGraph section). Legacy core setups used simple prompting and execution loops for collaborative problem-solving, such as one agent handling data retrieval while another performs analysis. Both LangChain and Dify support agent types and strategies including ReAct, tool calling, and multi-agent collaboration. LangChain offers built-in agents such as Plan-and-Execute via LangGraph, which enables custom state machines with loops and human-in-the-loop capabilities for advanced workflows. In comparison, Dify provides Agent nodes that integrate strategies like reflection and planning within visual workflows, facilitating easier design of autonomous agents.

Memory and Retrieval

LangChain incorporates memory mechanisms to manage state across interactions, enabling large language model (LLM) applications to retain and utilize context from previous exchanges. This state management is crucial for conversational agents and chains that require awareness of prior inputs and outputs. As of LangChain v1.0 (October 2025), many legacy memory types have been deprecated in favor of LCEL-compatible runnables and LangGraph checkpointers for persistence. Memory types are designed to handle short-term chat history or extract and store key information for longer-term recall, preventing the need to reprocess full histories in each LLM call. A fundamental memory type is ConversationBufferMemory, which maintains a simple buffer of the entire conversation history as a list of messages or a formatted string. It appends new human and AI messages to this buffer after each interaction and returns the full history when prompted, making it suitable for short-term retention in straightforward chat applications. For instance, in a conversational chain, this memory ensures the LLM receives the cumulative dialogue as context, though it may become inefficient for extended sessions due to token limits. For production use, integrate with LangGraph's InMemorySaver or database-backed checkpointers for thread-level persistence. The legacy ConversationEntityMemory, deprecated since LangChain v0.3.4 and removed in v1.0.0, previously extracted named entities—such as people, places, or concepts—from recent chat history using an LLM and generated concise summaries for each, stored in an entity store for retrieval across sessions. Current alternatives include custom entity extraction via LLM tools or LangGraph state management with custom schemas to track entities. Retrieval capabilities in LangChain augment LLM context by integrating external knowledge sources through semantic search, addressing limitations in models' parametric knowledge. Vector stores, such as FAISS (Facebook AI Similarity Search), index high-dimensional embeddings of documents to enable fast approximate nearest-neighbor searches based on query similarity. Embeddings, generated by models like those from OpenAI or Hugging Face, represent text chunks as vectors capturing semantic meaning, allowing retrieval of contextually relevant passages even for paraphrased queries. For instance, to perform a filtered similarity search in a FAISS vectorstore, use: vectorstore.similarity_search(query, k=10, filter={'document_type': {'$eq': 'tiendas_fisicas'}}). This filters results to chunks matching the metadata condition, reducing noise from irrelevant documents. Building effective retrieval indexes involves document loaders, text splitters, and embedders to create searchable corpora from raw data. Document loaders provide a standard interface for ingesting data from diverse sources into LangChain's Document format, which includes text and metadata. Quality document loading is foundational for RAG systems—errors or omissions at this stage can propagate through the entire pipeline. Supported formats typically include PDF, Word documents, PowerPoint, HTML, Markdown, plain text, CSV, and JSON. Data sources encompass local files, cloud storage such as S3, Google Drive, and Azure Blob, databases, web scraping, and SaaS applications like Notion, Confluence, and Slack. Document loader quality varies significantly by format and library, with PDFs particularly requiring careful handling due to layout complexity. LangChain and LlamaIndex offer extensive collections of loaders, while for production systems, dedicated parsing services like Unstructured.io often provide superior quality compared to basic loaders. Text splitters then partition these documents into overlapping chunks—typically by character count, tokens, or semantic boundaries—to fit LLM context windows while preserving meaning. Embedders subsequently transform these chunks into vectors, which are persisted in the vector store for querying via retrievers that return the top-k most similar documents. This pipeline enables scalable knowledge bases for RAG applications. To extend memory beyond ephemeral sessions, LangChain supports long-term persistence through integrations with databases, facilitating episodic (event-based) or procedural (step-based) recall. For entity tracking, use custom state in LangGraph with stores like Redis or SQLite. Chat message histories can persist full conversation buffers in databases such as PostgreSQL, Azure CosmosDB, or Xata, allowing retrieval of past interactions for multi-session continuity via checkpointers. These persistent stores ensure memory survives application restarts, supporting production-scale applications where context spans user sessions or evolves over time. In agent loops, such retrieval can briefly provide historical context to inform tool selection or action planning.

LangGraph

Graph-Based Architecture

The core design philosophy of LangGraph is graph-based; it models workflows as state machines with nodes for agents/tools and edges for conditional transitions; it supports explicit state, branching, loops, and persistence. LangGraph employs a graph-based architecture to model complex, stateful workflows, where the core elements consist of nodes, edges, and a shared state mechanism. Nodes represent individual units of computation, such as function calls or invocations of large language models (LLMs), which process and update the graph's state. Edges define the flow between nodes, including fixed transitions that proceed to a predetermined next node or conditional edges that dynamically route execution based on the current state, enabling branching logic. The shared state serves as a persistent data structure—typically defined using a TypedDict, Pydantic model, or the built-in MessagesState for conversational contexts—that is passed and modified across all nodes and edges, ensuring continuity throughout the workflow. Graphs in LangGraph are constructed using the StateGraph class, which requires specifying a state schema to initialize the structure. Developers add nodes via the .add_node method, associating each with a callable function, and connect them using .add_edge for direct links or .add_conditional_edges for logic-driven paths, where a routing function evaluates the state to select the next node. To enable persistence, the graph is compiled with a checkpointer, such as MemorySaver for in-memory storage or database-backed options like PostgresSaver, which captures state snapshots at each step and associates them with thread identifiers. This allows workflows to resume from interruptions, maintaining thread-specific state without restarting from the beginning. This architecture excels in handling cyclical processes that require iteration or external input, such as iterative refinement where an agent repeatedly evaluates and improves its outputs until meeting predefined criteria, or human-in-the-loop approvals that pause execution for manual review before proceeding. For instance, to implement a human-in-the-loop workflow, developers can add a special node or tool that triggers human review, such as via an API call or by using an interrupt mechanism. After human approval, the state can be modified using .update_state() to incorporate the feedback. The graph is then compiled with options like interrupt_before=["human_review_node"] to pause execution at the specified node, ensuring controllability in sensitive domains like finance or healthcare. A research agent might loop through search, analysis, and validation nodes, using conditional edges to decide whether to refine results based on quality checks. With the October 2025 release of LangChain 1.0, which uses LangGraph as its underlying runtime, native support for middleware was introduced within agent loops. This allows developers to insert custom hooks at key points such as before or after model calls, enhancing flexibility for features like automated summarization, privacy redaction, or seamless integration of human oversight. This middleware system builds on the core graph primitives to facilitate custom persistence strategies, enabling more robust handling of long-running, interruptible workflows without altering the underlying state management.

Example: Building a Core Workflow for a Gmail AI Agent

LangGraph's graph-based architecture is particularly suited for building AI agents that interact with external services, such as a Gmail AI agent for tasks like reading, composing, or managing emails. The following outlines the core steps to construct such a workflow, adapted from official tutorials for agentic applications. First, define the AgentState using TypedDict to manage the workflow's state, typically including a sequence of messages that accumulates over iterations:

python

from typing import Annotated, Sequence import operator from langchain_core.messages import BaseMessage from typing_extensions import TypedDict class AgentState(TypedDict): messages: Annotated[Sequence[BaseMessage], operator.add]

from typing import Annotated, Sequence import operator from langchain_core.messages import BaseMessage from typing_extensions import TypedDict class AgentState(TypedDict): messages: Annotated[Sequence[BaseMessage], operator.add]

Next, create a prompt template with system instructions for the agent (e.g., guidelines for handling Gmail tasks) and include a MessagesPlaceholder to insert the conversation history:

python

from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder system_prompt = "You are a helpful assistant that can interact with Gmail to read, send, or manage emails." prompt = ChatPromptTemplate.from_messages([ ("system", system_prompt), MessagesPlaceholder(variable_name="messages"), ])

from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder system_prompt = "You are a helpful assistant that can interact with Gmail to read, send, or manage emails." prompt = ChatPromptTemplate.from_messages([ ("system", system_prompt), MessagesPlaceholder(variable_name="messages"), ])

Bind the large language model (LLM) to relevant tools, such as Gmail-specific tools for fetching emails or sending messages:

python

from langchain_core.tools import tool

from langchain_core.tools import tool

Example Gmail tool (implementation depends on Gmail API integration)

@tool def read_gmail_emails(query: str): """Read emails from Gmail based on a query.""" # Implementation here pass @tool def send_gmail_email(to: str, subject: str, body: str): """Send an email via Gmail.""" # Implementation here pass llm_with_tools = llm.bind_tools([read_gmail_emails, send_gmail_email])

Define the `agent_node` function to invoke the LLM with the current state and return an `AIMessage`: ```python from langchain_core.messages import AIMessage def agent_node(state: AgentState): messages = prompt.format_messages(**state) response = llm_with_tools.invoke(messages) return {"messages": [response]}

Define the `agent_node` function to invoke the LLM with the current state and return an `AIMessage`: ```python from langchain_core.messages import AIMessage def agent_node(state: AgentState): messages = prompt.format_messages(**state) response = llm_with_tools.invoke(messages) return {"messages": [response]}

Define a router function to check for tool calls in the agent's response and decide the next step:

python

def router(state: AgentState): last_message = state["messages"][-1] if isinstance(last_message, AIMessage) and last_message.tool_calls: return "tools" return "end"

def router(state: AgentState): last_message = state["messages"][-1] if isinstance(last_message, AIMessage) and last_message.tool_calls: return "tools" return "end"

Build the StateGraph, add nodes for the agent and tools, and define edges: from the start to the agent, a conditional edge from the agent to tools or end, and from tools back to the agent:

python

from langgraph.graph import StateGraph, END workflow = StateGraph(state_schema=AgentState) workflow.add_node("agent", agent_node) workflow.add_node("tools", tool_node) # Define tool_node to call tools and append results workflow.set_entry_point("agent") workflow.add_conditional_edges("agent", router, {"tools": "tools", "end": END}) workflow.add_edge("tools", "agent")

from langgraph.graph import StateGraph, END workflow = StateGraph(state_schema=AgentState) workflow.add_node("agent", agent_node) workflow.add_node("tools", tool_node) # Define tool_node to call tools and append results workflow.set_entry_point("agent") workflow.add_conditional_edges("agent", router, {"tools": "tools", "end": END}) workflow.add_edge("tools", "agent")

Finally, compile the application, optionally with a checkpointer for persistence:

python

from langgraph.checkpoint.memory import MemorySaver app = workflow.compile(checkpointer=MemorySaver())

from langgraph.checkpoint.memory import MemorySaver app = workflow.compile(checkpointer=MemorySaver())

This workflow enables the Gmail AI agent to iteratively reason, call tools as needed, and maintain state across interactions, demonstrating LangGraph's capability for cyclical, tool-enabled processes.

Differences from LangChain Core

LangChain's core framework is designed for building sequential, linear workflows, where components such as chains and agents execute in a predefined order, making it ideal for straightforward tasks like prompt chaining or simple agent interactions. In contrast, LangGraph introduces a graph-based architecture that excels in managing complex, non-linear processes, including cycles for iterative refinement, conditional branches for decision-making, and multi-actor coordination where multiple agents or tools interact dynamically. This shift from linearity to graphs allows LangGraph to handle scenarios requiring loops or parallel execution, which are challenging or inefficient in core LangChain setups. Regarding state management, LangChain core typically employs ephemeral memory that resets between runs, suitable for one-off or stateless applications but limiting reliability in extended sessions. LangGraph, however, incorporates persistent state through checkpointers, which save the application's state to a database at each step, enabling fault-tolerant resumption, human-in-the-loop interventions, and long-running processes without data loss. This feature is particularly valuable for production environments where interruptions occur, as it ensures continuity across threads or sessions. While LangGraph's graph structure adds setup overhead—such as defining nodes, edges, and state schemas—for simple sequential tasks, it provides significant advantages for advanced applications by supporting features like conditional routing based on runtime decisions or tool outputs. Core LangChain remains more lightweight and faster to prototype for basic chains, but transitioning to LangGraph is recommended when workflows demand branching logic or iterative cycles to avoid manual workarounds that increase complexity. To provide practical guidance on selecting between the two, LangChain is recommended for beginners, simple retrieval-augmented generation (RAG), chatbots, single tool calls, or rapid prototyping, owing to its low learning cost and abundant resources. In contrast, LangGraph is suited for applications requiring cyclic decision-making (e.g., agents repeatedly calling tools until resolution), multi-agent collaboration, state persistence (e.g., resuming after interruptions), or fine-grained workflow control; typical scenarios include autonomous agents, customer service systems, and automated workflows. A suggested learning path is to master LangChain (including LangChain.js) for the basics before transitioning to LangGraph for advanced needs, as it has a steeper learning curve but offers greater power once graph structures are understood. LangGraph offers pros such as fine-grained control over workflows and adaptability through its cyclic graphs and stateful orchestration, making it ideal for complex, iterative analysis. However, its cons include added complexity that may be unsuitable for simple tasks. As of the October 2025 release of LangGraph 1.0, interoperability between the two has been enhanced, allowing LangChain core components—like chains, prompts, and agents—to be seamlessly embedded as nodes within LangGraph workflows, facilitating hybrid applications without full rewrites. This integration builds on LangChain agents now running atop the LangGraph runtime, promoting a unified ecosystem for scaling from simple to sophisticated AI systems.

Integrations and Ecosystem

Supported Models and Databases

LangChain supports a wide array of large language model (LLM) providers through standardized interfaces, enabling developers to integrate models from various sources seamlessly. Key integrations include OpenAI's GPT series, which powers generative tasks via API calls with support for fine-tuning and streaming outputs. Anthropic's Claude models are also natively supported, offering capabilities in ethical AI and long-context processing. For open-source options, Hugging Face provides access to thousands of transformer-based models, facilitating local or cloud-based inference. Additionally, wrappers for local inference tools like Ollama allow running models such as Llama or Mistral on user hardware without external dependencies. Furthermore, SAP AI Core integrates with LangChain via the Generative AI Hub SDK, enabling access to LLMs from providers such as OpenAI and Google within the SAP Business Technology Platform (BTP). In the realm of vector databases, LangChain integrates with several specialized stores optimized for retrieval-augmented generation (RAG) workflows, supporting both semantic and hybrid search modalities that combine keyword matching with vector similarity. Pinecone offers a managed, serverless vector database with scalable indexing and real-time updates. Weaviate, an open-source option, enables hybrid search through its GraphQL API and supports modular plugins for embeddings and authentication. Chroma provides a lightweight, embeddable vector store suitable for prototyping, with built-in persistence and similarity search functions. SAP HANA Cloud Vector Engine is fully integrated into the SAP HANA Cloud database and supports similarity search (including cosine and Euclidean distances as well as maximal marginal relevance), self-query retrievers with metadata filtering, knowledge graphs via RDF, and SPARQL QA chains, facilitated by the official langchain-hana package. Beyond models and stores, LangChain includes extensive integrations for data ingestion and processing. Document loaders, foundational to RAG systems, extract text and metadata from various file formats and data sources for indexing, with quality issues—such as errors in PDF handling due to layout complexity—potentially propagating through the pipeline. Supported formats include PDF, Word documents, PowerPoint, HTML, Markdown, plain text, CSV, and JSON, while data sources encompass local files, cloud storage (e.g., S3, Google Drive, Azure Blob), databases, web scraping, and SaaS applications (e.g., Notion, Confluence, Slack). LangChain provides loaders for over 50 formats, handling these through parsers like PyPDF for PDFs and direct querying for SQL databases, as well as web sources such as Wikipedia dumps or Google Drive files; for production systems, dedicated services like Unstructured.io often yield higher quality than basic loaders. See the Core Components section for detailed descriptions. Embeddings are supported from providers like OpenAI for high-dimensional representations and Cohere for multilingual capabilities, allowing flexible vectorization of text inputs. The tool ecosystem further extends functionality with APIs for external services, including Wikipedia for knowledge retrieval, Google Search via SerpAPI for real-time web queries, and custom bindings for enterprise tools like Salesforce or HubSpot. These integrations collectively form a robust foundation for building production-grade LLM applications. LangSmith is a platform developed by the LangChain team to support the development lifecycle of LLM applications, offering tools for tracing, debugging, testing, evaluating, and monitoring chains and agents. It provides observability features such as real-time tracing of application runs, alerting for performance issues, and high-level usage insights to ensure reliability in production environments. Additionally, LangSmith includes datasets for systematic prompt testing and evaluation, enabling developers to benchmark and refine prompts against predefined inputs and expected outputs. LangServe complements LangChain by facilitating the deployment of chains and runnables as production-ready REST APIs, leveraging FastAPI for efficient serving and Pydantic for data validation. This allows scalable deployment of LangChain applications without extensive custom infrastructure, supporting features like streaming responses and integration with cloud services for high-throughput scenarios. The LangChain community is vibrant and collaborative, centered around its GitHub repository, which has garnered over 118,000 stars as of November 2025, reflecting widespread adoption among developers building LLM-powered applications. Community engagement extends to dedicated forums for troubleshooting and idea-sharing, as well as a Slack channel for real-time discussions, events, and showcasing agent implementations. Contributors have played a key role in advancing interoperability standards, notably through the Agent Protocol initiative, which defines framework-agnostic APIs for serving and communicating with LLM agents in production. In the broader ecosystem, major LLM orchestration frameworks include LangChain, a comprehensive toolkit available in Python and JavaScript for coordinating LLM calls with retrieval systems, tools, and APIs; Semantic Kernel, a Microsoft-developed framework focused on .NET environments with strong enterprise integrations for multi-agent orchestration and compliance; Haystack, a Python-based, pipeline-oriented framework emphasizing production-ready RAG pipelines and semantic search; and LlamaIndex, which prioritizes data indexing and retrieval for RAG workflows. While LangChain offers modular chaining and agent orchestration suitable for a wide range of applications, Semantic Kernel excels in enterprise settings with Azure compatibility but may require more configuration outside Microsoft ecosystems; Haystack provides structured pipelines for data-heavy tasks but has a narrower scope for dynamic agents compared to LangChain; and LlamaIndex complements LangChain by streamlining data connectors and query engines for specialized retrieval needs. Choosing an orchestration framework depends on application complexity, team expertise, and flexibility requirements, with trade-offs including steeper learning curves for comprehensive tools like LangChain and Semantic Kernel, increased debugging complexity in multi-agent setups, and dependency management challenges in production environments. Simple applications may use direct API calls, while complex multi-step applications benefit from these framework abstractions. Other complementary tools include Weights & Biases (wandb), which offers experiment tracking and tracing integrations for LangChain applications, enabling logging and monitoring of LLM workflows. Additionally, Dify serves as a related project focused on visual workflows for agentic applications, providing Agent nodes that integrate strategies such as reflection and planning; for a detailed comparison of supported agent types and strategies between LangChain and Dify, see the "Agents and Tools" subsection under Advanced Features. Additionally, Scorecard provides evaluation and tracing capabilities for LLM applications, supporting open-source frameworks through its OpenLLMetry standard to facilitate debugging and performance assessment in development pipelines.

Applications and Use Cases

Common Implementations

LangChain has been widely adopted for building conversational agents in customer support scenarios, where it enables chatbots with persistent memory to handle user interactions over multiple turns. For instance, Klarna integrated LangChain's LangGraph and LangSmith to develop an AI assistant that resolves customer queries 80% faster by incorporating retrieval-augmented generation (RAG) for accessing FAQs and transaction histories, reducing reliance on human agents for routine tasks. This approach allows the chatbot to maintain context from prior conversations, providing personalized responses while integrating with external tools like databases for real-time account verification. In retrieval-augmented generation (RAG) systems, LangChain facilitates question-answering over proprietary document corpora, particularly in fields requiring precise information retrieval such as legal research. Legal firms have deployed LangChain-based RAG pipelines that use vector search to query vast repositories of case law, statutes, and contracts, enabling lawyers to retrieve relevant precedents and generate summaries without manual sifting. For example, these systems embed documents into vector databases like Pinecone or FAISS, then retrieve and augment LLM prompts to produce accurate, cited responses, improving efficiency in due diligence processes. Automation workflows leveraging LangChain often involve multi-agent setups for complex data analysis tasks, where specialized agents collaborate to process and interpret information. In enterprise environments, such systems automate report summarization by chaining agents—one for data extraction, another for insight generation, and a third for validation—applied in sectors like finance for analyzing market reports and forecasting trends. These workflows, built using core components like chains and agents, enable scalable processing of unstructured data into actionable intelligence. By 2025, production deployments of multi-agent AI powered by LangChain have become prominent in e-commerce for delivering personalized product recommendations. Retail platforms such as those using Shopify have implemented LangChain to orchestrate agents that analyze user behavior, inventory data, and past purchases, generating tailored suggestions that boost conversion rates by integrating RAG with recommendation engines. For example, these systems dynamically query customer profiles and product catalogs to suggest complementary items in real-time, enhancing user engagement in high-volume online stores.

Benefits and Challenges

LangChain accelerates application development by providing pre-built abstractions for integrating large language models (LLMs), such as chains and agents, enabling developers to connect models like OpenAI or Anthropic with minimal code—often under 10 lines. This modularity reduces boilerplate, allowing focus on higher-level logic rather than low-level API management. The framework benefits from a robust community ecosystem, including official Slack channels, forums, and GitHub repositories where developers share integrations and troubleshoot issues collaboratively. This support fosters rapid iteration, with community-contributed packages extending core functionality to hundreds of third-party tools. Scalability is enhanced through LangServe, which deploys LangChain applications as production-ready REST APIs, supporting high-throughput serving with FastAPI and automatic OpenAPI schema generation for seamless integration into larger systems. Despite these advantages, LangChain presents challenges, including a steep learning curve for configuring complex chains and agents, particularly for beginners unfamiliar with its modular design. The framework can introduce overhead in simple applications, such as basic prompt-response setups, where direct LLM API calls might suffice without the added abstraction layers, potentially increasing memory usage and execution time. Additionally, LangChain's reliance on external LLM providers introduces dependencies on evolving APIs, which can lead to compatibility issues during updates or rate limit changes across models. In 2025, the release of LangChain v1.0 marks a maturation milestone, emphasizing production reliability through streamlined error handling, stable core APIs, and improved structured output generation in agent loops, reducing latency and enhancing debugging. However, this evolution has sparked discussions on the framework's necessity, as simpler alternatives like native API integrations gain traction for lightweight tasks. Adoption remains strong, with LangChain's open-source libraries achieving over 90 million monthly downloads and powering services used by 35% of Fortune 500 companies, particularly for agentic workflows.

References

Add your contribution
Related Hubs
User Avatar
No comments yet.