AI Agents: A Practical Guide, and the Chapters to Read First
A free 40,000-word ebook on building AI agents, from a framework-free first agent to production. The key ideas, a chapter guide, and which chapters to read first for your role.

AI Agents: A Practical Guide is a free, 12-chapter ebook on building AI agents and getting them into production. It runs about 40,000 words, with working Python examples from the first agent loop through deployment. It is for developers, tech leads and product owners who need to ship an agent, not only understand one. You read it in the browser, free, with no signup.
At that length, almost nobody should read it front to back on day one. This post gives you the ideas worth keeping and a reading path for your role, so you can start with the three or four chapters that matter for your job.
The gap this book is written for
Agent demos are easy. Agents that survive real users are not. Gartner predicts that over 40% of agentic AI projects will be canceled by the end of 2027. It cites escalating costs, unclear business value and inadequate risk controls. The same release estimates that only about 130 of the thousands of vendors selling "agentic AI" offer real agentic capabilities.
Each of those three causes has a chapter. Cost control runs through chapters 3, 9 and 10. Business value is chapter 11's ROI framework. Risk controls are chapter 9. The book's bias is practical: build the simplest thing that works, measure it, then add autonomy.
It is the building companion to my other agent ebook. AI Agents and the Security Nightmare Nobody's Solving covers identity, authorization and governance for agents once they touch production systems. This one covers how to build them well in the first place.
What is inside, chapter by chapter
| Chapter | What you get from it |
|---|---|
| 1. What Are AI Agents? | A working definition, chatbot vs. copilot vs. agent, the autonomy spectrum and five common misconceptions. |
| 2. Types of AI Agents | Six agent architectures from reactive to hierarchical, with a decision flowchart for picking one. |
| 3. Building Your First Agent | A research agent built from scratch in Python, with no framework, plus testing, debugging and a pitfalls table. |
| 4. Tool Use and Function Calling | How function calling differs across providers, tool naming and descriptions, a tool registry, and input and output sanitization. |
| 5. Memory and Context Management | Working, short-term and long-term memory, pruning and summarization, retrieval strategies and what not to store. |
| 6. Planning and Reasoning Patterns | Chain of thought, ReAct, Plan-and-Execute, Tree of Thoughts, Reflexion and LATS, compared on cost and latency. |
| 7. Multi-Agent Systems | Orchestrator, peer, hierarchical and blackboard designs, plus the anti-patterns and when to avoid multi-agent entirely. |
| 8. Retrieval-Augmented Generation for Agents | Chunking, embeddings, hybrid search, reranking, agentic RAG and the five ways RAG answers go wrong. |
| 9. Agent Guardrails and Safety | A risk taxonomy, input, output and tool guardrails, prompt injection defenses, cost circuit breakers and a 26-item pre-launch checklist. |
| 10. Deploying Agents to Production | Containers, queue-based scaling, state, tracing, model routing, canary releases and a deployment checklist. |
| 11. Real-World Use Cases and Patterns | Agents for engineering, support, data, sales, security, DevOps, research and email, with an ROI formula. |
| 12. The Future of AI Agents | Computer use, agent-to-agent communication with A2A, MCP (Model Context Protocol), the trust problem and what to build first. |
Six ideas from the book worth keeping
1. Use an agent only where the flowchart needs a judgment box
Chapter 1 gives the cleanest test I know for whether a task needs an agent. If you can draw a flowchart that covers every case, write traditional software. If the flowchart needs a "use judgment" box, consider an agent. Its example: you do not need an agent to run payroll, but one can help work out how to set up payroll for a new country.
The same chapter separates three things people call agents. A chatbot answers when you ask. A copilot suggests while you work. An agent takes a goal and works through many steps itself. Its advice on autonomy: start semi-autonomous, with the agent pausing for approval at key steps, and remove checkpoints only once you trust it.
2. Build one agent without a framework first
An agent is a loop that calls a model and runs tools. Chapter 3 builds one in plain Python so you can see exactly what frameworks abstract. Its pitfalls table is the part to bookmark. Cap the number of steps. Stop the run if the last three tool calls were identical. Return tool errors to the model as strings instead of crashing the loop. Check that a requested tool exists before calling it.
3. Tool descriptions are the model's only documentation
Chapter 1 notes that the design of an agent's toolset often matters more than the choice of model. Chapter 4 shows how to get it right. Name tools as verb-noun pairs, such as search_knowledge_base instead of a bare search tool. Every description should say what the tool does, when to use it, what it returns and what happens with bad input. Start with three to five tools and add more only when the agent needs them.
4. ReAct is the default reasoning pattern
Chapter 6 compares six patterns on complexity, latency and cost. ReAct, which interleaves reasoning steps with tool calls, comes from a 2022 paper by Yao and colleagues. The chapter recommends it as the default for tool-using agents. Use Plan-and-Execute when the steps are known in advance, as in a data pipeline. Use Reflexion, where the agent critiques and retries its own work, when correctness is worth the extra calls. The patterns compose: a planner on top, ReAct for each step.
5. Default to a single agent
Chapter 7 opens by saying most tasks do not need multiple agents. Split only when one agent keeps failing at part of a task, when you need an independent checker, or when work fans out in parallel. Its heuristic for when to split: a system prompt over about 800 words with several "modes" or personas is usually several agents crammed into one. It also names the failures to avoid: the committee of eight agents doing one agent's job, and the telephone game where detail decays at every handoff.
6. Price the agent before you build it
Chapter 11 gives a simple ROI formula: time saved multiplied by hourly cost and volume, minus build, running and maintenance cost. Its illustrative example is ticket triage. If the agent handles 70% of triage, it saves 126 hours a month and pays back its build in about 19 months at the starting volume. The chapter's lesson on failure is blunt: integration, auth and state are most of the work, and the agent itself is the smaller part.
Reading paths by role
- If you have 20 minutes: chapter 1, then the "When NOT to Use Multi-Agent" section at the end of chapter 7.
- If you are a developer building your first agent: chapters 1, 3, 4 and 6, in that order. Run the code in chapter 3 before reading further.
- If you are a tech lead choosing an architecture: chapters 2, 6 and 7. Together they cover agent types, reasoning patterns and when to split work across agents.
- If you are shipping to production: chapters 5, 8, 9 and 10. That covers memory, retrieval, guardrails and operations, and ends with two checklists.
- If you are a product or engineering manager: chapters 1, 11 and 12. You get the vocabulary, the use cases with an ROI model, and a "what to build today" list.
- If you review agents for risk: chapter 9 here, then the security ebook linked above for identity and governance.
One caution. Chapters that name specific frameworks, products and context-window sizes age fastest in this field. The November 2026 update refreshed them. Chapter 7 now lists the OpenAI Agents SDK, which replaced Swarm, and Microsoft Agent Framework, which succeeded AutoGen. The patterns in chapters 3 through 10 do not depend on those names.
Where the book connects across the site
Model choice sets your context budget, your price per call and how long you can rely on a model. The AI Models context window reference keeps current figures for the models chapter 5 discusses. The rest of that app covers pricing and retirement dates.
Chapter 11's use cases map onto the Technology Rewired page for software development. It traces how that category moved from on-premises tools to SaaS to agents, with a 0 to 5 autonomy score. Once your agent is live, my piece on why nobody owns agent behavior picks up where chapter 10's observability section stops.
FAQ
Do I need to know Python to use this book?
For chapters 3 through 10, yes, at a basic level. The examples are Python and call LLM APIs directly. Chapters 1, 2, 11 and 12 are mostly prose and tables, so a product manager or executive can read them without running any code.
Does the book teach a specific framework like LangChain or CrewAI?
No. It builds agents from scratch first so you understand the loop, tools, memory and planning yourself. Chapter 7 compares multi-agent frameworks and gives a starting recommendation, but nothing in the book depends on one.
How is this different from the AI agents security ebook?
This book is about building and running agents: architecture, tools, memory, reasoning, RAG, guardrails and deployment. The security ebook is about identity, authorization, MCP security and governance for agents in an enterprise. Builders should start here; security teams should start there.
Is there a PDF version?
No. Each chapter is a free web page you can read, bookmark or link to, with no email gate. That also means corrections and updates reach every reader at once.
More like this
All AI Security & Agents- AI Security & AgentsStop Obsessing Over Prompts: What Actually Matters for AI SuccessPrompt engineering is overrated. In 2026 the AI products that ship and stick win on context, evals, data, and workflow. Here is the…
- AI Security & AgentsOpenAI Just Changed Everything: Why GPT OSS Could Be the Most Important AI Release You've Never Heard OfOpenAI just released GPT OSS - their first open-source AI models since 2019. These aren't just free downloads; they're transparent,…
- GEO & AI SearchThe AI Content Crisis: How LLMs Are Draining Media Revenue - and the Technologies Fighting BackLLMs scrape publisher content thousands of times per single referral, destroying the ad and subscription revenue that funds journalism.
Get new AI Security & Agents writing
Enjoyed this? Subscribe and tell us what you read most. AI Security & Agents is already ticked for you. No tracking pixels, unsubscribe with one click.