Architecture & Core Concepts
This chapter covers LangChain 1.0 layering, the agent loop, and when to use LangGraph.
Layered stack
- langchain-core: vendor-neutral abstractions
- LangGraph: stateful, loop-capable runtime with persistence
- LangChain 1.0: standard agent loop + middleware on top of LangGraph
Agent = Model + Harness
The harness delivers the right context at the right time.
Loop on LangGraph
create_agent builds a LangGraph graph:
- model node: LLM call, may emit tool_calls
- tools node: run tools, append results to messages
Middleware wraps model entry/exit like web middleware.
LangChain vs LangGraph
Guidance: start with LangChain; drop to LangGraph for custom orchestration; embed create_agent as a subgraph when needed.
Workflows vs agents
See LangGraph Workflows for patterns.
Runnable & LCEL
Pre-1.0 LCEL composed Runnables with |. Runnables remain the low-level protocol; agents are the main 1.0 path via create_agent. Integration classes like ChatOpenAI are still Runnables usable in graph nodes.
Versions
- Align
langchain1.x withlanggraph1.x - Avoid legacy
AgentExecutor/initialize_agentin new projects - Docs: docs.langchain.com