# LangChain

> LangChain is an open-source software framework, available for Python and JavaScript, that provides building blocks for applications powered by language models, such as model interfaces, prompt templates, retrieval, tool calling and agents.

Also called: LangChain framework, LangGraph, LangSmith, LangChain agents. Category: Tools and platforms. Source: https://aibuildindex.com/glossary/langchain

## In the index

- LangChain: median $3,000, middle half $400 to $12,000, 695 priced briefs (https://aibuildindex.com/tools/langchain)
- LangGraph: median $4,400, middle half $500 to $14,100, 216 priced briefs (https://aibuildindex.com/tools/langgraph)

LangChain is one of the most widely used developer frameworks for building with language models. It gives developers a common set of components for the parts that most AI applications share: calling a model, formatting prompts, retrieving documents, letting a model call tools, and chaining these steps together. Its companion libraries cover agents and monitoring. For buyers, LangChain appearing in a proposal signals a code-based build, as opposed to a no-code tool, and its use has trade-offs worth understanding.

## How it works

The core library offers standard interfaces so that models from different providers, vector stores and document loaders can be swapped with little code change. Developers compose these into pipelines: load documents, split them into chunks, embed and store them, then at question time retrieve passages and pass them to a model, which is the [retrieval-augmented generation](https://aibuildindex.com/glossary/retrieval-augmented-generation) pattern. Tool calling lets a model request actions such as searching a database or sending an email.

LangGraph, from the same team, is a library for building stateful, multi-step [AI agents](https://aibuildindex.com/glossary/ai-agent) as graphs of steps, with support for loops, branching, memory, human approval points and resuming after interruption. LangSmith is the team's commercial platform for tracing, debugging and evaluating applications, whether or not they use LangChain itself, and is an example of [observability](https://aibuildindex.com/glossary/observability) tooling for AI systems.

An example: a builder uses LangChain to connect a support assistant to a help centre and a ticketing API, LangGraph to manage a flow where the assistant gathers details, looks up the order and escalates to a person, and LangSmith to inspect conversations that went wrong.

## What it means for cost

Using a framework can shorten build time by reusing tested components, and live figures for builds naming LangChain are on the [LangChain tool page](https://aibuildindex.com/tools/langchain). Its abstractions also add a layer to learn and maintain, and some teams prefer to call model APIs directly for simple applications. Questions worth asking a builder:

- Which parts of the framework are used, and why is it needed for this build?
- How will the application be tested and monitored once live?
- Is the code structured so another developer could take it over?

The framework itself is free and open-source; running costs come from model calls, hosting, vector storage and any paid monitoring service.

## Common questions

### What is the difference between LangChain and LangGraph?

LangChain provides the components for working with models, data and tools. LangGraph is a separate library for orchestrating those components into stateful agents and workflows, with explicit control over each step. Many agent builds use both together.

### Is LangChain needed to build a RAG system?

No. A RAG system can be built by calling a model API and a vector database directly, or with other frameworks such as [LlamaIndex](https://aibuildindex.com/glossary/llamaindex). LangChain is a convenience, and its value grows with the number of components and providers involved.

## Related terms

- [LlamaIndex](https://aibuildindex.com/glossary/llamaindex): LlamaIndex is an open-source framework, available for Python and TypeScript, for connecting language models to a business's own data, with tools for loading and parsing documents, building indexes, retrieval, and agents that work over that data.
- [Retrieval-augmented generation (RAG)](https://aibuildindex.com/glossary/retrieval-augmented-generation): Retrieval-augmented generation is a way of answering questions with a language model that first looks up relevant passages in your own documents, then writes an answer grounded in what it found.
- [AI agent](https://aibuildindex.com/glossary/ai-agent): An AI agent is software built around a language model that can plan steps, call tools such as APIs, databases or a browser, look at the results and keep going until it completes a task, rather than only replying to a single message.
- [Orchestration](https://aibuildindex.com/glossary/orchestration): Orchestration is the coordination layer of an AI or automation system that decides which steps, models, tools or agents run, in what order, with what data, and what happens when a step fails.
- [Function calling](https://aibuildindex.com/glossary/function-calling): Function calling is a capability that lets a language model request that the application run a defined tool, such as a database lookup, an API call or a calculation, by returning the tool's name and structured arguments instead of plain text.
- [Observability](https://aibuildindex.com/glossary/observability): Observability is the ability to see what a live system is doing and why, through logs, traces and metrics, so that errors, slow responses, rising costs and poor AI outputs can be found and explained.
