Understanding LLMs, Agents, and AI Workflows

Understanding LLMs, Agents, and AI Workflows

When I start learning a new technology, I prefer to begin with the big picture before diving into implementation details. If I understand why something exists and where it fits into the overall architecture, learning the technical details becomes much easier.

Since I'm new to LLMs and agentic AI, I decided to first build a high-level understanding of some common technologies in this ecosystem: LLMs, LangChain, Agents, LangGraph, and Pydantic. Rather than immediately following tutorials or copying code, I wanted to answer a simple question:

"Why do these tools exist, and what problem does each one solve?"

Here's my understanding so far.

At the center of everything is the Large Language Model (LLM). An LLM is simply an AI model that receives a prompt and generates a response. A basic application can call an LLM directly, receive the output, and return it to the user. This works well for simple tasks such as answering questions, summarizing text, or generating content.

As applications become more complex, however, a single LLM call is often not enough. A project may require multiple prompts, reusable templates, structured outputs, document retrieval, or connections to external services. Instead of building all of these utilities from scratch, developers use LangChain, which provides reusable building blocks for developing LLM-powered applications.

The next concept is an Agent. Unlike a simple LLM call, an agent can reason about a task and decide which tools to use. For example, if a user asks an AI to create a character and save it, the agent might decide to generate the character, call an image generation tool, and finally store the result in a database. The key idea is that the model decides what actions to take instead of only generating text.

For applications with predefined workflows, relying entirely on an agent can be unpredictable. This is where LangGraph becomes useful. LangGraph lets developers define a workflow as a graph or state machine. Each node performs a specific task, updates the application's state, and passes the result to the next node. The overall execution follows a predefined path, with support for conditions, loops, retries, and branching.

Coming from a cloud engineering background, I found it helpful to think of LangGraph as being conceptually similar to AWS Step Functions. In AWS Step Functions, you orchestrate multiple Lambda functions using a state machine that defines the execution flow. Each state performs one responsibility, updates the state, and decides what happens next. LangGraph follows a very similar idea, except instead of orchestrating Lambda functions, it orchestrates AI-related tasks such as prompt generation, reasoning, image generation, validation, and saving outputs. This analogy made LangGraph much easier for me to understand.

Finally, there is Pydantic. LLMs often generate structured data such as JSON, but the output may contain missing fields or incorrect data types. Pydantic provides data models and validation, ensuring that the generated data matches the expected schema before the application continues processing it. In many ways, it serves a role similar to typed DTOs with runtime validation in traditional software development.

Read more