5 Agentic Workflows with LangGraph

 

This chapter covers

  • Overview of agentic workflows and agents
  • LangGraph fundamentals and state management
  • Transition from LangChain chains to an agentic workflow

Large language models are driving a new generation of applications that require more than simple prompt-response exchanges. As applications become more complex, agentic workflows have become essential—a pattern where the LLM orchestrates a structured, multi-step process using predefined components and explicit state management. Unlike fully autonomous agents, agentic workflows follow a predictable sequence of steps and do not dynamically select tools or adapt to context in real time. Instead, they offer reliability, transparency, and modularity by guiding the application through a set flow, using the LLM to make decisions within fixed boundaries.

5.1 Understanding Agentic Workflows and Agents

LLM-powered agent-based systems typically follow one of two core design patterns: agentic workflows and agents. Each pattern shapes how the application operates, as illustrated in figure 5.1. Because these terms are often used interchangeably—but have important differences—it’s essential to understand exactly what is meant by “agentic workflow” and “agent” before diving deeper..

5.1.1 Workflows

5.1.2 Agents

5.1.3 When to Use Agent-Based Architectures

5.1.4 Agent Development Frameworks

5.2 LangGraph Basics

5.3 Moving from LangChain Chains to LangGraph

5.4 LangGraph Core Components

5.4.1 StateGraph Structure

5.4.2 State Management and Typing

5.4.3 Node Functions and Edge Definitions

5.4.4 Entry Points and End Conditions

5.5 Turning the Web Research Assistant into an AI Agent

5.5.1 Original LangChain Implementation Overview

5.5.2 Identifying Components for Conversion

5.5.3 Step-by-Step Transformation Process

5.5.4 Code Comparison and Benefits Realized

5.6 Summary