AI developers · Part 06
LangChain / LangGraph
Chains, graphs, shared state and checkpoints for multi-step agents.
Last updated
- LangChain.jsA toolbox of ready-made parts for LLM apps: model wrappers, document loaders, text splitters, vector stores, retrievers and tools. Full TypeScript, no Python needed.
- Chat modelsOne interface for OpenAI, Claude, Gemini and Ollama. Swap the provider without rewriting your calls.
- Document loadersReady-made readers for PDFs, web pages, GitHub repos, Notion and more.
- Text splittersChunk text smartly, by headings, paragraphs or code functions, with a chosen size and overlap.
- RetrieversAn object that answers "give me the top K chunks for this query". It wraps the vector search from Part 5.
- tool() with ZodDefine a tool once with a Zod schema. LangChain turns it into the JSON schema the model needs.
- LangGraph.jsA framework for building agents as a graph of steps with shared, saved state.
- Graph stateData shared by every step in the graph, most often the messages array plus a few fields of your own.
- Nodes and edgesNodes are functions that do one step. Edges say which node runs next.
- Conditional edgesAn edge that looks at the state and picks the next node, so the model's output can choose the path.
- createReactAgentA prebuilt ReAct agent: give it a model and tools, and it runs the loop for you.
- CheckpointingLangGraph saves the state after every step (in memory or Postgres). A conversation can resume tomorrow, and a crash doesn't lose progress.
- interrupt()Pauses the graph before a risky node. It resumes when the user approves.
- When to use whichOne call or simple chat: the raw SDK. RAG pipeline: LangChain. Single-loop agent: a plain loop or createReactAgent. Branches, approvals, memory: LangGraph.