Introduction to LangChain
What is LangChain?
LangChain is an open-source framework for building LLM applications, maintained by LangChain Inc.. It packages model calls + tools + state + orchestration into a composable agent harness, so you can ship chatbots, RAG systems, and automation agents in Python (and JavaScript).
LangChain 1.0 (2025) is a major consolidation: the core focuses on the agent loop, runs on the LangGraph runtime, and adds Middleware for context engineering and control.
The ecosystem
Key point: LangChain 1.0 agents run on LangGraph. Drop down to LangGraph when you need fine control; compose both (e.g. embed create_agent subgraphs in custom graphs).
LangChain 1.0 at a glance
Official framing:
Agent = Model + Harness
Harness = model + prompt + tools + middleware (right context at the right time)
Agent loop (mental model)
The model loops until the task is done. Middleware hooks (before_model, after_model, wrap_model_call, etc.) power summarization, memory, human-in-the-loop, and subagent delegation.
Comparison
When to choose LangChain: agents, workflows, observability in one stack. For doc-heavy RAG-only apps, LlamaIndex or plain API may suffice.
Good fit / caveats
Good fit: tool-using agents, RAG, persistent sessions, HITL, LangSmith tracing.
Watch out: one-shot prompts (use API directly), ultra-low latency (framework overhead), regional provider/compliance constraints.
Packages
GitHub: langchain-ai/langchain, langchain-ai/langgraph