AI Engineering
Learn LLMs, RAG, agents, secure tools, and production AI through practical insurance examples.
What LangGraph is and why it exists
LangGraph represents execution as a graph of steps sharing explicit state. Nodes do work and edges select the next step; the graph can contain both ordinary code and model decisions. It supports applications that need branching, repeated tool use, and…
State and reducers
State is the structured data shared by graph steps, such as current intent, evidence IDs, and task phase. A reducer specifies how a new update combines with an existing state field. Some fields replace earlier values; others safely combine multiple updates.
Nodes, edges, conditional edges, and routing
A node is a function performing one graph step. An edge describes the next step, while a conditional edge selects from allowed destinations based on state. Routing can use model output, deterministic checks, or both.
Practical TypeScript graph with an approval pause
This is a minimal orchestration demonstration, not an insurance backend. Dependencies are @langchain/langgraph and zod. It uses the documented StateSchema style; older tutorials may use Annotation.Root. Select compatible package versions before adopting…
Checkpoints, persistence, and memory
A checkpoint records execution progress and state at a recovery boundary. Persistence saves it outside the process. Memory is selected information reused by later turns or tasks; a checkpoint is not automatically good long-term user memory.
Interrupts and human review
An interrupt pauses graph execution and exposes a payload for external input. Resumption supplies the requested value. The node containing the interrupt can run again from its beginning on resume, so code before the pause may repeat.
Tool integration and the agent loop in a graph
A graph can separate model decisions, tool execution, and stop checks into different nodes. The model node proposes calls; the tool node uses approved business services. Conditional routing returns to the model only while permitted progress remains.
Subgraphs and multi-agent graphs
A subgraph is a smaller graph used as a component of a larger one. A multi-agent graph assigns model-driven responsibilities to separate nodes or subgraphs. Subgraphs support modularity even when no multi-agent behavior is involved.
Streaming graph events
Graph streaming exposes progress such as state updates, node events, and model token events. It lets a UI distinguish “retrieving,” “waiting for approval,” and “complete.” Stream modes and event APIs vary by version.
Errors, retry logic, and recovery
Error handling distinguishes recoverable infrastructure failures, invalid user input, unsupported model decisions, and business failures. Retry repeats an operation after an appropriate transient failure. Recovery uses persisted progress and reconciliation to…
Production architecture and choosing LangGraph
A production graph sits within an authenticated application, durable execution service, approved tools, checkpoint store, and monitoring system. LangChain supplies components; LangGraph controls stateful execution. A graph can be deterministic, agentic, or…
Difficulty is an editorial estimate. Completion means you chose to mark a question as understood.