Black Friday Deals For Authors Are On Now!

Leanpub Header

Skip to main content

Agentic AI Engineering: From First Principles to Multi-Agent Systems

Agentic AI Engineering: From First Principles to Multi-Agent Systems
This book is 100% completeLast updated on 2026-11-24

A complete, beginner-friendly course in agentic AI in one book. Across 36 chapters you go from "what is an agent?" to self-improving loops and multi-agent systems, with every idea shown in working Python. The code runs on a free practice model, so you can learn without an API key, then switch to Anthropic, OpenAI, DeepSeek or Gemini with one line.

Minimum price

$15.89

$18.98

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
About

About

About the Book

Most material on AI agents assumes you already know how to build them. This book does not. It starts with what a language model is and how a program talks to one, teaches the Python you need along the way, and builds upward one small step at a time until you are designing systems of several agents working together.

Every chapter follows the same rhythm: a plain-language explanation, a diagram, a short program, and the real output of that program printed underneath. Nothing is hand-waved. When the book says a design is more reliable, it measures it. When a design turns out worse than expected, the book shows that result too and explains why.

A single running example ties everything together. You help Maya, who runs a small solar-lamp shop called Lumen Market, automate her help desk. Her agent starts by answering one question, then learns to look up orders, remember customers, search the shop handbook, issue refunds with approval, and finally hand work to a team of specialist agents.

All programs use only the Python standard library and a small companion toolkit that ships with the book. A built-in practice model lets you run every example offline and for free.

## What you will learn

* AI agent basics — how language models work, tokens and context windows, prompts, the agent loop, tools, memory and retrieval

* Agentic workflows and design patterns — prompt chaining, routing, reflection, tool use, planning, and orchestrator–worker designs

* Practical engineering — evaluation sets and confidence intervals, error analysis, context management, reliability, cost control, security and prompt injection, running agents in production

* Self-improving agent loops — learning from feedback, experience memory, automatic prompt optimisation, the improvement flywheel, and how to stop a loop from gaming its own score

* Multi-agent systems — when a team beats a single agent and when it does not, team architectures, negotiation, the MCP and A2A protocols, and engineering teams of agents

* Two capstone projects — a research assistant and a full multi-agent help desk, each built, tested and evaluated from start to finish

## What is inside

* 36 chapters in 7 parts, 668 pages

* 85 complete programs, each printed with its real output

* Diagrams and charts throughout

* Learning objectives, key-idea boxes, "in plain words" explanations and a summary in every chapter

* "Try it yourself" exercises with answers to selected questions

* Appendices on setup, a Python quick reference, the mathematics used, a provider quick reference and reusable templates

* Glossary, references and a full index

## Who it is for

* Beginners who can use a computer and want to learn agentic AI properly, including the Python it needs

* Students taking an AI or software engineering course

* Developers who have called a chat API and want to build real agents

* Lecturers and trainers who need a structured text with exercises and runnable code

Author

About the Author

Benjamin App

Benjamin is a lecturer in Computer Science at prestigious university, and holds a PhD in software engineering and active research in cybersecurity and applied AI. After years of watching capable students give up on AI because the textbooks assumed too much, he wrote the book he wished he could hand them. It explains each concept the way a child would learn it, through a character named Alex, while keeping the full mathematics, formulas and code, so that readers finish with real understanding instead of memorised terms.

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub