liveBook · Manning

Chapter 5: Agentic workflows with LangGraph

What you will learn in chapter 5 of AI Agents and Applications

Introduces agentic workflows as structured, multistep processes in which an LLM makes decisions within predefined boundaries.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces agentic workflows as structured, multistep processes in which an LLM makes decisions within predefined boundaries.

Key terms: agentic workflows, predefined components, explicit state management

5.1 Understanding agentic workflows and agents

This section distinguishes agentic workflows from agents by how much freedom the LLM has to determine the application's next steps.

Key terms: agentic workflow, workflow, agent, LLM, tool

5.1.1 Workflows

Defines workflows as LLM-guided choices among limited next steps and distinguishes two common workflow patterns.

Key terms: workflow, LLM, next step, Controller-Worker, Router, controller, worker

5.1.2 Agents

Defines LLM-based agents by their goal-directed use of language models and contrasts their adaptable flows with fixed prompt–response systems.

Key terms: LLM-based agents, language models, actions, goals, fixed prompt–response systems, dynamic workflows, real-time data, available tools, memory of past interactions, feedback

5.1.3 When to use agent-based architectures

Explains when agentic workflows or agents are worth using and why their added complexity must be justified.

Key terms: LLM-based workflows, agents, explicit state management, dynamic control

5.1.4 Agent development frameworks

The section compares agent development frameworks by their focus and tradeoffs, highlighting LangGraph’s role in building stateful, persistent workflows.

Key terms: LangGraph, stateful, persistent agentic workflows, graph-based execution, AutoGPT, CrewAI, n8n, LangFlow, tradeoffs

5.2 LangGraph basics

Introduces LangGraph as a graph-based extension of LangChain for organizing stateful, multi-step agentic workflows.

Key terms: nodes, edges, state, LangChain, LangGraph, LLMs, embeddings, retrievers, branching paths, stateful processing

5.3 Moving from LangChain chains to LangGraph

This section explains why complex applications may outgrow linear LangChain chains and how LangGraph’s graph-based workflows address their limits.

Key terms: LangChain, linear chains, state, LangGraph, explicit state management, conditional branching, cyclical workflows, graph-based structure, data flows, multi-step reasoning

5.4 LangGraph core components

Introduces the state, nodes, and edges that make up a LangGraph workflow, including how its path can change at runtime.

Key terms: state object, ResearchState, TypedDict, nodes, edges, directed flow, conditional edges, runtime state, entry points, end conditions

5.4.1 StateGraph structure

5.4.2 State management and typing

This subsection explains why LangGraph uses explicit, strongly typed state and how nodes update that state.

Key terms: state management, strongly typed state, ResearchState, node, current state, updates, overall state

5.4.3 Node functions and edge definitions

This subsection defines nodes as state-processing functions and edges as transitions between nodes, including state-based conditional transitions.

Key terms: node, current state, updates, edges, valid transitions, linear edge, conditional edge, state

5.4.4 Entry points and end conditions

This subsection states that a LangGraph graph needs a starting point and clear end conditions.

Key terms: starting point, end conditions

5.5 Turning the web research assistant into an AI agent

Introduces a LangGraph upgrade to the web research assistant that routes its work according to the relevance of web-page summaries.

Key terms: LangGraph, LangChain, relevance of summaries, search queries, final report, dynamic control

5.5.1 Original LangChain implementation overview

This section recaps the web research assistant’s sequential LangChain workflow and explains why its linear flow and lack of explicit state make adaptation and troubleshooting difficult.

Key terms: sequential chains, web research assistant, research report, rigid and linear, conditional flow, explicit state, error handling, debugging

5.5.2 Identifying components for conversion

The section identifies the web research assistant’s LangGraph nodes, the state each node needs and updates, and the conditional route that can repeat research before writing a report.

Key terms: nodes, Assistant Selector, Query Generator, Web Searcher, Content Summarizer, Relevance Evaluator, Report Writer, route_based_ on_relevance, threshold, iteration count

5.5.3 Step-by-step transformation process

This section converts a linear LangChain research assistant into a stateful LangGraph workflow that can repeat searches when its results are not relevant enough.

Key terms: state, composite state, inner types, node function, current state, updated state information, Relevance Evaluator, conditional edge, Query Generator, iteration

5.5.4 Code comparison and benefits realized

Compares the LangGraph version of the case study with traditional LangChain chains, emphasizing the benefits of explicit state, modular graph structure, and conditional flow.

Key terms: conditional edges, relevance evaluation, conditional flow control, explicit state management, state, node, modular components, nodes, edges, clear flow control

5.6 Summary

This chapter summary recaps how LangGraph represents agentic workflows as stateful graphs, how their nodes and routing work, and why they help when moving beyond linear LangChain chains.

Where this is used later

Concepts explained in this chapter

← Chapter 4: Building a research summarization engine Chapter 6: RAG fundamentals with ChromaDB →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.