What is the difference between LangChain, LangGraph, LangFlow, and LangSmith?
#gen-ai#langchain
Answer
LangChain vs LangGraph vs LangFlow vs LangSmith
These are four distinct products from LangChain Inc., each serving a different purpose in the AI development ecosystem.
Quick Reference
| Product | Purpose | Who Uses It |
|---|---|---|
| LangChain | Framework for building LLM apps and chains | Developers |
| LangGraph | Stateful, graph-based agent orchestration | Developers building complex agents |
| LangFlow | Visual/no-code UI to build LangChain pipelines | Prototypers, non-coders |
| LangSmith | Observability, tracing, and evaluation platform | All teams in production |
LangChain
The foundation framework — provides building blocks for LLM applications.
pythonfrom langchain_anthropic import ChatAnthropic from langchain_core.prompts import ChatPromptTemplate from langchain_core.output_parsers import StrOutputParser # Build a chain llm = ChatAnthropic(model="claude-opus-4-6") prompt = ChatPromptTemplate.from_messages([ ("system", "You are a helpful assistant"), ("human", "{input}") ]) chain = prompt | llm | StrOutputParser() result = chain.invoke({"input": "Explain RAG in simple terms"})
Key features: LLM integrations, prompt templates, document loaders, vector store wrappers, retrievers, output parsers.
LangGraph
Graph-based agent orchestration — for complex, stateful workflows.
pythonfrom langgraph.graph import StateGraph, END from typing import TypedDict class State(TypedDict): messages: list iteration: int def agent_node(state: State) -> State: response = llm.invoke(state["messages"]) state["messages"].append(response) state["iteration"] += 1 return state def should_end(state: State): return END if state["iteration"] >= 3 else "agent" graph = StateGraph(State) graph.add_node("agent", agent_node) graph.add_conditional_edges("agent", should_end) graph.set_entry_point("agent") app = graph.compile()
Key features: Cyclic graphs, checkpointing, human-in-the-loop, streaming, parallel branches.
LangFlow
Visual drag-and-drop interface — build LangChain pipelines without code.
- Access at after installtext
localhost:7860 - Connect components visually (LLM → Prompt → Retriever → Output)
- Export as Python code
- Good for prototyping and demos
bashpip install langflow langflow run
LangSmith
Observability and evaluation platform — monitor, debug, and improve agents.
pythonimport os os.environ["LANGCHAIN_TRACING_V2"] = "true" os.environ["LANGCHAIN_API_KEY"] = "your-key" # Now all LangChain/LangGraph calls are automatically traced chain.invoke({"input": "test"}) # → View full trace in LangSmith dashboard
Key features: Request tracing, latency tracking, token cost monitoring, prompt playground, dataset management, evaluation runs.
How They Work Together
textLangFlow (visual prototyping) ↓ export code LangChain (code-level building blocks) ↓ for complex agents LangGraph (stateful agent orchestration) ↓ monitored by LangSmith (observability in dev + prod)
When to Use Each
| Stage | Tool |
|---|---|
| Quick prototype, no code | LangFlow |
| Building standard RAG/chain | LangChain |
| Complex stateful agent | LangGraph |
| Debugging agent behavior | LangSmith |
| Production monitoring | LangSmith |