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.
- Source repo
- Nicolepcx/ai-agents-the-definitive-guide
- Stars
- ★ 3k
- Last updated
- 3mo ago
- Primary language
- Jupyter Notebook
- FA score
- 34/100 · Major gaps
At a glance
- How it runs
- Works with
- Universal · cross-platform
- Cost
- Free software; you pay for model usage
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- 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.
- Not a fit if
- Teams wanting a deployable agent product; this is teaching code only
- Readers unwilling to sign up for E2B, Composio, Langfuse or LangSmith accounts
- Website
- oreilly.com ↗ set on GitHub
- Maintenance
- Commits in the last 6 monthslast commit 2026-08-01+8.1 ★/day over 7 days
- Source review
- 34/100 · Major gaps 1 safety controls not found
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.
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.
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 does this agent compare with similar options?
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| AI Agents — The Definitive Guide (Companion Code) This agent | 34 · Major gaps | Library / SDKFree + model costs | ★ 3k | 3mo ago | Jupyter Notebook | — |
| AI Agent Engineering Textbook | 60 · Some gaps | FrameworkFree | ★ 682 | 24d ago | HTML | — |
| Agent Systems Handbook | 62 · Some gaps | Web appFree | ★ 314 | 1mo ago | MDX | — |
| Generative AI with LangChain | 41 · Major gaps | Library / SDKFree + model costs | ★ 1.5k | 3mo ago | Jupyter Notebook | OpenAI API · Claude API |
How does FollowAgents rate this agent?
Why each dimension lost points
The README describes chapter-organized agent examples and lists topics including HITL, tool governance, secure execution, and threat modeling, but the supplied material does not show concrete permission scopes, sensitive-data handling, confirmation for external side effects, dependency security, or recovery mechanisms. Those criteria receive 1 only for topic-level or basic documentation evidence; rollback receives 0 because no recovery mechanism is shown. The README points to a book, companion site, and Discord, but does not establish code provenance or maintainer identity, so source attribution receives 1.
The README gives a chapter structure and example index, providing partial evidence of product organization. The sample contains no code, dependency manifest, error handling, or failure messages, so self-consistency and dependency availability receive 1, and failure messages receive 0.
The twelve-chapter outline spans foundational patterns, production deployment, evaluation, memory, cost, and threat modeling, supporting a broad set of use cases and earning 2. The README does not clearly define example capability boundaries, earning 1. Chapter and notebook topics make example selection reasonably clear, earning 2 for trigger precision. Run guidance mainly points to Google Colab and does not specify local or other environment requirements, so environment fit receives 1.
The README provides a table of contents, chapter mapping, and notebook naming guidance, earning 2 for information architecture. Colab badges offer limited startup guidance, earning 1 for install notes. Naming guidance exists, but capitalization and directory forms vary across examples, earning 1 for naming stability. The chapter index and example listing are useful, though there is no FAQ, earning 2. No known limitations, license text, version, or changelog are shown; LICENSE appears only in the structural outline, so license receives 0. The README does not identify a maintainer or update path, earning 1 for maintenance responsibility.
Chapter indexes, notebook titles, and Colab links help readers locate and open examples, earning 2 for output usability. Coverage across agent patterns, deployment, governance, and evaluation adds value beyond a single-topic example set, earning 2 for marginal value. There is no overall account of runtime or resource costs, so cost-benefit receives 1.
The README gives partial traceability between the book, chapters, and notebooks, earning 1 for claim traceability. Only the README is supplied, with no code or tests for independent corroboration, earning 0 for cross-source corroboration. It identifies the repository as companion code and lists its structure, but does not distinguish documented examples from validated capabilities or explain their limits, earning 1 for fact-inference separation.
- Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
- This assessment uses only the supplied README sample. Unprovided files are unknown, and no notebook execution or independent verification is claimed.
- The README lists a LICENSE file but does not provide its contents, so usage and redistribution terms cannot be confirmed from this material.
- Colab links point to the repository's main branch while the review targets a pinned revision; the links alone do not establish the pinned revision's contents or runnability.
FAQ
Is AI Agents — The Definitive Guide (Companion Code) free?
Is AI Agents — The Definitive Guide (Companion Code) open source?
Is AI Agents — The Definitive Guide (Companion Code) safe to use?
Is AI Agents — The Definitive Guide (Companion Code) still maintained?
Who makes AI Agents — The Definitive Guide (Companion Code)?
What is AI Agents — The Definitive Guide (Companion Code)'s official website?
Thanks — we use this to improve the page.