Skip to content

An Illustrated Guide to
AI Agents

With more than 300 custom illustrations, explore the fundamentals of AI Agents!

A recorded TinyAgent session in Windows PowerShell, including its original dolphin ASCII art and agent trace
The coding agent you build in chapter 10, running in its native command-line interface.

Reviews

Chip HuyenAuthor of AI Engineering and
Designing Machine Learning Systems
“The authors are exceptional builders, and this book is a testament to the depth of their knowledge. The generous illustrations and hands-on TinyAgent exercise make the concepts approachable, intuitive, and fun to learn.”
Omar KhattabAssistant professor, MIT EECS
“I have thought a lot about how to teach AI systems, and this book still surprised me with how much of the domain of modern AI agents it could make clear through illustrations. Maarten and Jay do an impressive job identifying and explaining the timeless ideas in this fast-moving field, and I expect this to become the first book I recommend to anyone who wants to understand how modern agents work and how to build them.”
Ofir PressResearch scientist at Meta FAIR,
coauthor of SWE-bench and SWE-agent
“Grootendorst and Alammar explain the entire AI agent stack, from tokenization to multiagent systems, in an engaging visual style. As the field evolves, this book will continue to serve as a useful reference because it covers the subject matter so thoroughly.”

About the Book

Through more than 300 custom illustrations, learn the concepts and practical tools behind AI agents.
Follow hands-on Python examples as you build a TinyAgent from scratch.

An agent selecting the most useful memory for a language model's context window A language model selecting and calling a multiplication tool TinyAgent showing its thought, action, and observation trace in a terminal

Table of Contents

Ten chapters to understand agents with memory, tools, planning, evaluation, collaboration, multimodal understanding, and code.

An agent combines a language model with memory, tools, and planning to act on its environment.
The ideas behind an agent.
TinyAgent's components, with the chapters that introduce the language model, trajectory, memory, tools, MCP, ReAct, and display.
The TinyAgent you build, one component at a time.

About the Authors

Maarten Grootendorst is a Member of Technical Staff at Google DeepMind. He holds two master’s degrees in psychology and one in data science, which he leverages to create visual guides in his AI blog. He is the author and maintainer of open source packages (BERTopic, PolyFuzz, KeyBERT) that have been downloaded millions of times and used by data professionals worldwide. He is the co-author of Hands-On Large Language Models.

Jay Alammar is Director and Engineering Fellow at Cohere. Through his popular AI blog, Jay has helped millions of researchers and engineers visually understand machine learning tools and concepts from the basic to the cutting-edge (Transformers, BERT, GPT-3, Stable Diffusion). Jay is also a co-creator of popular machine learning and natural language processing courses on Deeplearning.ai and Udacity. He is the co-author of Hands-On Large Language Models.

Maarten Grootendorst Jay Alammar