agent-workflow
LangChain / LangGraph
Overview
LangChain is the standard framework for building applications powered by large language models. It provides abstractions for chat models, prompt templates, output parsers, tool integration, and retrieval augmented generation. LangChain Expression Language (LCEL) enables declarative composition of these components into chains using a pipe syntax.
LangGraph extends LangChain with a graph-based runtime for building stateful, multi-step agent workflows. It models agent logic as a state graph where nodes are functions, edges define control flow, and state is persisted across turns via checkpointing. LangGraph is the recommended approach for any agent that requires loops, branching, tool-calling cycles, human-in-the-loop intervention, or long-running conversations.
Key characteristics:
- LangChain: model abstraction, prompt management, output parsing, tool definitions, retrieval
- LangGraph: state machines for agents, persistence, streaming, human-in-the-loop, multi-agent orchestration
- LCEL: composable pipe syntax for simple prompt-model-parser chains
- Production-ready: built-in checkpointing, error handling, streaming, and observability
Chat Models
Chat models are the primary interface to LLMs. Always import from langchain_<provider> packages rather than the deprecated langchain.chat_models.