Introduction

  • TL;DR: LangChain is an open-source framework/ecosystem for building LLM-powered applications and agents, focusing on composable components and integrations.
  • LCEL (LangChain Expression Language) enables declarative composition of chains with consistent execution features (streaming/batch/async).
  • LangGraph targets low-level orchestration for long-running, stateful agents modeled as graphs.
  • LangServe deploys runnables/chains as REST APIs (FastAPI + Pydantic).
  • LangSmith provides observability and evaluation workflows for agent development and operations.

In this post, we cover LangChain with the main keywords upfront: LangChain, LCEL, LangGraph, LangServe, LangSmith, RAG, agents—including what changed in v1 and what you should standardize for production.


LangChain in One Page

LangChain is described as a framework for building agents and LLM-powered applications and for chaining interoperable components and third-party integrations.

Why it matters:

  • Most engineering time goes into integrations, orchestration, and reliability rather than a single model call. LangChain standardizes that surface area.

What Changed: LCEL, Core/Community split, and v1

LCEL (LangChain Expression Language)

LCEL introduced a declarative way to compose chains while supporting streaming, batch, and async execution patterns.

Why it matters:

  • Clear composition = easier debugging and safer refactoring.

Core vs Community packages

LangChain’s architecture evolved to separate base abstractions (langchain-core) from third-party integrations (langchain-community).

Why it matters:

  • Smaller dependency surface and clearer ownership of stability vs integrations.

v1 (2025-10-20): Agent-centric simplification + “classic” for legacy

The docs describe v1.0.0 (dated 2025-10-20) as a major revamp where higher-level abstractions converge around an agent abstraction built on LangGraph, while legacy functionality moves to langchain-classic / @langchain/classic.

Why it matters:

  • Treat LangGraph + LangChain as a coherent agent stack, and use the migration guide if you rely on older APIs.

Practical Build Pattern: RAG with LCEL (Python skeleton)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_core.runnables import RunnablePassthrough
from langchain.chat_models import init_chat_model

llm = init_chat_model("gpt-4.1-mini", provider="openai")

def retrieve_context(question: str) -> str:
    return "Context placeholder (replace with your retriever/vector store)..."

prompt = ChatPromptTemplate.from_messages([
    ("system", "Answer using ONLY the provided context."),
    ("human", "Question: {question}\n\nContext:\n{context}")
])

chain = (
    {"context": retrieve_context, "question": RunnablePassthrough()}
    | prompt
    | llm
    | StrOutputParser()
)

print(chain.invoke("Why is LCEL useful in LangChain?"))

Why it matters:

  • RAG quality is mostly about retrieval/contexting and output validation—not just the model call. LangChain gives you a standard pipeline.

Deployment: LangServe (concept)

LangServe deploys LangChain runnables and chains as a REST API (FastAPI integration).

1
2
3
4
5
from fastapi import FastAPI
from langserve import add_routes

app = FastAPI()
add_routes(app, chain, path="/rag")

Why it matters:

  • It reduces the “notebook-to-service” gap and makes your chain a clean deployable unit.

Orchestration: When to use LangGraph

LangGraph is positioned as a low-level orchestration framework/runtime for long-running, stateful agents modeled as graphs.

1
2
3
4
5
6
7
flowchart LR
  U[User] --> A[Agent Node]
  A -->|tool call| T[Tool Node]
  T --> A
  A -->|needs approval| H[Human Review]
  H --> A
  A --> O[Final Answer]

Why it matters:

  • Complex agent workflows need explicit control (state, retries, approvals). Graphs help you make that control auditable.

Ops: LangSmith for tracing and evaluation

LangSmith docs describe an integrated workflow across observability, evaluation, and deployment (including self-hosting options).

Why it matters:

  • Without traces and evaluations, you can’t reliably reproduce failures or measure improvements across prompt/model/data changes.

Security Note (2025-12): Serialization Injection CVEs

  • Python: CVE-2025-68664 affects LangChain serialization (dumps()/dumpd()) in certain versions, per NVD.
  • JavaScript: CVE-2025-68665 affects LangChain JS serialization via toJSON()/JSON.stringify(), per NVD/Red Hat.

Why it matters:

  • Agent stacks process a lot of untrusted input. Patch quickly, review serialization/deserialization paths, and enforce dependency scanning.

Conclusion

  • LangChain provides a composable framework for LLM apps and agents, with LCEL/Runnables as a core composition model.
  • v1 reorganized the developer experience around agent building (LangGraph-based) and pushed legacy APIs to classic packages.
  • For production: pair LangServe (deployment) with LangSmith (observability/evaluation), and keep a tight security/upgrade discipline.

Summary

  • LangChain = composable LLM/agent framework + integrations
  • LCEL = declarative chain composition with consistent execution semantics
  • LangGraph = stateful agent orchestration using graphs
  • LangServe = REST deployment for runnables/chains
  • LangSmith = tracing/evaluation for reliable ops

#langchain #langgraph #langserve #langsmith #lcel #rag #agents #llmops #python #vectordb

References

  • (langchain-ai/langchain: The platform for reliable agents, living doc)[https://github.com/langchain-ai/langchain]
  • (langchain - PyPI, living doc)[https://pypi.org/project/langchain/]
  • (langchain-core - PyPI, living doc)[https://pypi.org/project/langchain-core/]
  • (langchain-community - PyPI, living doc)[https://pypi.org/project/langchain-community/]
  • (LangChain Expression Language, 2023-08-01)[https://blog.langchain.com/langchain-expression-language/]
  • (Introducing LangServe, 2023-10-12)[https://blog.langchain.com/introducing-langserve/]
  • (langserve - PyPI, living doc)[https://pypi.org/project/langserve/]
  • (LangGraph overview - Docs by LangChain, living doc)[https://docs.langchain.com/oss/python/langgraph/overview]
  • (LangSmith docs - Docs by LangChain, living doc)[https://docs.langchain.com/langsmith/home]
  • (Philosophy - Docs by LangChain, 2025-10-20)[https://docs.langchain.com/oss/python/langchain/philosophy]
  • (LangChain v1 migration guide, living doc)[https://docs.langchain.com/oss/python/migrate/langchain-v1]
  • (CVE-2025-68664 Detail - NVD, recent)[https://nvd.nist.gov/vuln/detail/CVE-2025-68664]
  • (CVE-2025-68665 Detail - NVD, recent)[https://nvd.nist.gov/vuln/detail/CVE-2025-68665]
  • (Build a RAG agent with LangChain, living doc)[https://docs.langchain.com/oss/python/langchain/rag]
  • (Towards LangChain 0.1: LangChain-Core and community, living doc)[https://blog.langchain.com/the-new-langchain-architecture-langchain-core-v0-1-langchain-community-and-a-path-to-langchain-v0-1/]