The term “agent” has been used across computer science for decades, but in the context of modern AI, it has taken on a very specific meaning. An AI agent is a system built around a large language model (LLM) that can autonomously perceive its environment, make decisions, take actions, and adapt based on feedback — all in pursuit of a goal defined by a human.
Unlike a traditional chatbot that produces a single response to a single prompt, an agent operates in a loop: it reasons about what to do next, executes an action (such as calling a tool, writing code, or searching the web), observes the result, and decides whether to continue, adjust its plan, or return a final answer.
Anthropic draws an important architectural distinction between two types of agentic systems:
Workflows are systems where LLMs and tools are orchestrated through predefined code paths. A developer specifies the sequence of steps, and the LLM fills in the details at each step. The flow of control is deterministic.
Agents are systems where the LLM dynamically directs its own processes and tool usage, maintaining control over how it accomplishes tasks. The flow of control is model-driven.
In practice, most production systems fall on a spectrum between these two extremes. A customer service bot might follow a mostly deterministic workflow (greet → classify → route → respond) but allow the model to choose which knowledge base article to cite. A coding agent, on the other hand, might be almost entirely autonomous, deciding which files to read, what changes to make, and how to test its work.
Workflows Agents
┌─────────────────┐ ┌─────────────────────┐
Control: │ Developer │ │ LLM │
Flexibility: │ Low │ │ High │
Predictability│ High │ │ Lower │
Complexity: │ Lower │ │ Higher │
└─────────────────┘ └─────────────────────┘
The shift from single-turn LLM calls to agentic architectures is driven by a simple observation: iterative refinement dramatically improves output quality.
Andrew Ng’s research at DeepLearning.AI demonstrated this powerfully. On the HumanEval coding benchmark:
The improvement from adding an agentic workflow to GPT-3.5 far exceeded the improvement from upgrading to GPT-4 in zero-shot mode. This is a fundamental insight: how you use the model often matters more than which model you use.
Andrew Ng identified four key agentic design patterns that drive this improvement:
These four patterns form the conceptual foundation of this book. We will explore each in depth, along with several workflow patterns that provide additional structure and control.
Anthropic’s guide to building effective agents identifies five workflow patterns commonly seen in production:
A critical principle runs through all expert guidance on agentic systems: start with the simplest solution that works.
“When building applications with LLMs, we recommend finding the simplest solution possible, and only increasing complexity when needed.” — Anthropic
Agentic systems trade latency and cost for better task performance. Before building an agent, consider:
Use workflows when:
Use agents when:
This book will take you from foundational concepts to production-ready patterns:
Each chapter includes Python code examples demonstrating the pattern, discussion of when to use (and not use) the pattern, and practical tips from production deployments.
Let’s begin.
Navigation: