AI Agents — The Definitive Guide (Companion Code)
Official companion repository for the O'Reilly book 'AI Agents - The Definitive Guide', with twelve chapters of runnable Jupyter notebooks covering everything from LLMs to production-grade agents.
A book-companion notebook repo, not a deployable Agent product. Notebooks require API keys (OpenAI, LangSmith, etc.) and third-party services (Composio, E2B, Langfuse) with no visible key-management or least-privilege guidance — clear deductions. HITL and the secure-execution/threat-modeling chapters show author awareness of confirmation and governance, but these are teaching content, not repo-level mechanisms. Rollback has no evidence at all. Attribution to the book, website and Discord is reasonably clear.
Naming is mostly self-consistent, but README states CH-prefixed folders while Colab links use lowercase ch06/ch07..ch12 — a concrete inconsistency; dependency availability relies solely on Colab with no requirements/lock file evidence, so version drift is a real risk; no evidence on failure messages.
Audience (learners/engineers) and scenarios are clear across 12 chapters covering planning, evaluation, deployment, cost and threat modeling; Colab one-click badges indicate good environment fit. Capability boundaries and trigger precision are essentially unaddressed.
Information architecture is a strength: repo tree, per-chapter tables, naming conventions, Colab badges as install notes, rich examples. But known limitations are absent; LICENSE appears in the tree while license metadata is unknown (conservative low score); no versioning or changelog; maintenance rests on a single unverified account with no stated commitment.
Good usability as a learning resource: runnable per-chapter notebooks, companion quiz site and Discord. Marginal value comes from systematic coverage of agent topics. Cost-benefit is reasonable (free, Colab-hosted) though users bear their own API costs with no stated warning.
Code maps one-to-one to book chapters with links to book/site — moderate traceability; but static evidence cannot corroborate code correctness, and promotional language is not separated from fact — deductions.
- License file is listed but its content is unverified — confirm LICENSE terms before any commercial use.
- Notebooks depend on third-party services and API keys; run in a controlled environment and watch for key leakage and data egress.
- No requirements/lock file evidence; dependency drift may make notebooks non-reproducible.
- Colab links for ch06+ use lowercase paths, slightly inconsistent with the README naming rule.
- This is teaching companion code, not a production Agent framework; do not base safety or compliance decisions on it.
What does this agent do, and when should you use it?
This repository is the official code companion to the O'Reilly book 'AI Agents - The Definitive Guide', organized as Jupyter notebooks grouped into folders CH01 through CH12. Each chapter maps to a book topic: from LLM foundations and architecture patterns (CoT, ToT, ReAct, multi-agent teams, Swarms) through advanced planning and reasoning, productionization, secure execution and tool governance, evaluation and observability, agent memory, cost efficiency, and threat modeling. Every notebook ships with a one-click 'Open In Colab' badge, so readers can run examples without any local setup. The repo also includes a utils directory, a resources directory, and is backed by a companion book website with quizzes plus a Discord community. It is positioned as a learning and reference resource, not a deployable agent product.
The repository provides roughly thirty Jupyter notebooks named by chapter (e.g., ch02_CoT.ipynb, ch03_TreeQuest.ipynb, ch06_MCP_server_composio.ipynb), each demonstrating one concrete technique: Chapter 2 covers Chain-of-Thought, Tree-of-Thought, ReAct, Human-in-the-Loop, hierarchical agent teams, and swarms; Chapter 3 covers ART+RULER and TreeQuest (AB-MCTS); Chapter 5 covers Deep Agents, MCP with LangGraph, and Pydantic agent consistency; Chapter 6 covers governed A2A+MCP, an MCP server with Composio, LangGraph with E2B sandbox, and programmatic tool calling (Monty); Chapter 7 covers inference backends and model fallback; Chapters 8-9 cover an evaluation harness, OWASP ASI 2026, and Langfuse/LangSmith evaluation pipelines; Chapter 10 covers LangGraph agent memory and memory topologies; Chapter 11 covers cost estimation by topology plus GPU memory/throughput requirements; Chapter 12 covers LlamaFirewall. Code builds on the LangChain/LangGraph ecosystem and calls third-party services including E2B, Composio, Langfuse, LangSmith, and LlamaFirewall.
- An engineer reading the book wants to run the companion code chapter by chapter in Colab to see how ReAct, hierarchical teams, and swarms behave in practice.
- A team moving agent prototypes to production studies the Chapter 5-7 notebooks for Pydantic consistency checks, model fallback, and inference backend choices.
- A security team needs threat modeling and tool governance for agent systems, using the Chapter 6 MCP governance and E2B sandbox examples plus the Chapter 12 LlamaFirewall notebook.
- A platform team building an agent evaluation practice references the Chapter 8-9 evaluation harness, OWASP ASI 2026, and Langfuse/LangSmith pipeline examples.
- A technical lead sizing compute and cost for agentic systems uses the Chapter 11 cost estimator and GPU memory/throughput notebooks for capacity planning.
- A researcher compares how memory topologies affect agent behavior by running the Chapter 10 memory experiment notebooks.
What are this agent's strengths and limitations?
- Maps one-to-one to a published O'Reilly book, with a twelve-chapter structure covering the full agent engineering spectrum from foundations to threat modeling.
- All notebooks run with one click in Colab, so examples are reproducible with zero local configuration.
- Examples are current with the ecosystem, covering MCP, A2A, Deep Agents, E2B sandbox, LlamaFirewall, and OWASP ASI 2026.
- Backed by a companion website with quizzes and additional material, plus an active Discord channel.
- It is a teaching codebase, not a deployable product — there is no unified dependency manifest or version pinning, so local reproduction requires solving dependencies yourself.
- Many notebooks depend on third-party paid or registration-gated services (E2B, Composio, Langfuse, LangSmith), adding account and key-management overhead to run everything.
- The license type is not stated in repository metadata; confirm the LICENSE file's terms before commercial or internal-training reuse.
- Code is tightly coupled to fast-moving LangChain/LangGraph APIs, so notebooks may need adaptation as the ecosystem evolves.
How do you install or deploy this agent?
No local installation is required to run: every notebook in the README has an 'Open In Colab' badge that opens it directly in Google Colab. To run locally, clone the repo with git clone https://github.com/Nicolepcx/ai-agents-the-definitive-guide, install Jupyter plus the dependencies each notebook needs (the README provides no requirements.txt or pinned versions), and configure the required LLM provider and third-party service (E2B, Composio, Langfuse, LangSmith, etc.) API keys inside the notebooks.
How do you use this agent?
- Find the target chapter table in the README and click the Colab badge for a notebook (e.g., ch02_react.ipynb in Chapter 2); 2. Fill in API keys as instructed inside the notebook; 3. Run cells in order and inspect outputs. Notebooks are named CH-number plus topic, and the code depends on custom classes and functions in the repo's utils directory. Start with ch01_code_examples.ipynb for foundations, then dive into later chapters as needed.