@0xGky: The companion code for O'Reilly's "AI Agents - The Definitive Guide" is now live: 12 chapters, 35 Notebooks in total. Starting with ReAct, Tree of Thought, multi-agent systems, and building all the way up to memory, evaluation, cost...
Summary
The companion code repository for O'Reilly's "AI Agents - The Definitive Guide" is now online, containing 12 chapters with a total of 35 Jupyter Notebooks covering ReAct, Tree of Thought, multi-agent systems, memory, evaluation, cost, and threat modeling. Every Notebook comes with a ready-to-run Colab link.
View Cached Full Text
Cached at: 11/24/26, 11:33 PM
O’Reilly published AI Agents - The Definitive Guide.
The companion code is now live: 12 chapters, 35 notebooks in total. It starts with ReAct, Tree of Thought, and multi-agent setups, then works through memory, evaluation, cost, and safety.
Colab links are pre-configured for every notebook — open them in your browser and run, no local environment required.
The final chapter is dedicated to threat modeling for agents — a solid hands-on exercise. 🔗 https://github.com/Nicolepcx/ai-agents-the-definitive-guide…
Nicolepcx/ai-agents-the-definitive-guide
Source: https://github.com/Nicolepcx/ai-agents-the-definitive-guide
⭐ If you find this repository helpful, please consider giving it a ⭐ here on GitHub (click the star button in the top right corner) It’s a quick way to show support for this openly available code. ⭐
OReilly_logo_rgb.png
AI Agents - The definitive Guide
This is the corresponding code for the book AI Agents - The Definitive Guide the book can be found here and on Amazon (https://www.amazon.com/Agents-Definitive-Deployment-Evaluation-Production/dp/B0GTYKTZHG/ref=sr_1_1?crid=3IKPXNW1IGD7V&dib=eyJ2IjoiMSJ9.n6XdCRmcIshseCli02TdjNbRQDKjQdxsP1qL6u931_bI2BtpzIRu5R9-o2YkOb_vzPUHPjhf4OoJU0trC-J3JmVQq6-SPw_ESya-oNpS-KR_8Z9BT3OiAZtJrwvA-MietSkrVBlK-0fs_pKJ5lgNNlF_oAxQYPzMOHeovQXa2dXt5D3LlnrVrZp_ZOQSQpMBJMGXrVKT4FSwOqW4ioOEhymB94LPQi3W15wVpSjkftM.tvvAb5_XOOez9Drd930kMnl_WBhjvEhzEp1C9miRRSc&dib_tag=se&keywords=ai+agents+the+definitive+guide&qid=1782032850&sprefix=ai+agents+the%2Caps%2C232&sr=8-1). The book has an accompanying website (https://ai-agents-the-definitive-guide.com/) with quizzes and additional material, as well as a Discord channel (https://discord.gg/pqeHTvzdhJ).
TOC
- Chapter 1 From LLMs to Agents: The Foundational Blueprint
- Chapter 2 Architectures and Patterns: Planning, Reactivity, and Multi-Agent-Systems
- Chapter 3 Advanced Planning, Reasoning, and Scalable Execution in Agents
- Chapter 4 Models Behind the Agents: Capabilities and Optimization
- Chapter 5 From Prototypes to Production: Contracts, Tools, and Reliable Execution
- Chapter 6 Secure Execution and Tool Governance
- Chapter 7 Deploying Agents in Real Products
- Chapter 8 Foundational Evaluation and Operational Observation of Agentic Systems
- Chapter 9 Customized and Advanced Evaluation of Agentic Systems
- Chapter 10 Agent Memory: How Persistence Turns Agents Into Evolving Systems
- Chapter 11 From Compute to Cost: Designing Efficient Agentic Systems
- Chapter 12 Threat Modeling for AI Agents
Instructions and Navigation
All of the code is organized into folders. Each folder starts with CH followed by the chapter number. For example, CH01.
The notebooks are then organized as follows: ch01_attention_mechanism_variations.ipynb, where ch01 indicates the chapter
and attention_mechanism_variations what is done in the notebook.
Repo structure
`` ├── LICENSE ├── README.md <- The top-level README for developers using this project. ├── CH01 <- Per chapter folder with Jupyter notebooks. ├── [name].ipynb <- Jupyter notebooks with naming as mentioned above. ├── CH02 <- Per chapter folder with Jupyter notebooks. … <- Same structure for all chapters. ├── utils <- Custom classes and functions and utility functions. ├── resources <- Some miscellaneous resources.
``
Running the Notebooks
Every notebook can be opened and run on Google Colab directly from the links below. Just click the Open In Colab badge next to the notebook you want to run.
Chapter 1 — From LLMs to Agents: The Foundational Blueprint
| Notebook | Colab |
|---|---|
| Code Examples | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH01/ch01_code_examples.ipynb) |
Chapter 2 — Architectures and Patterns: Planning, Reactivity, and Multi-Agent-Systems
| Notebook | Colab |
|---|---|
| Chain-of-Thought (CoT) | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH02/ch02_CoT.ipynb) |
| Tree-of-Thought (ToT) | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH02/ch02_ToT.ipynb) |
| ReAct | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH02/ch02_react.ipynb) |
| Human-in-the-Loop (HITL) | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH02/ch02_HITL.ipynb) |
| Hierarchical Agent Teams | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH02/ch02_hierarchical_agent_teams.ipynb) |
| Swarms | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH02/ch02_swarms.ipynb) |
Chapter 3 — Advanced Planning, Reasoning, and Scalable Execution in Agents
| Notebook | Colab |
|---|---|
| ART + RULER | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH03/ch03_ART_RULER.ipynb) |
| RULER Cat Poems | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH03/ch03_RULER_cat_poems.ipynb) |
| TreeQuest (AB-MCTS) | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH03/ch03_TreeQuest.ipynb) |
Chapter 4 — Models Behind the Agents: Capabilities and Optimization
| Notebook | Colab |
|---|---|
| Supervisor Agent Team | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH04/ch04_supervisor_agent_team.ipynb) |
Chapter 5 — From Prototypes to Production: Contracts, Tools, and Reliable Execution
| Notebook | Colab |
|---|---|
| Deep Agents | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH05/ch05_deep_agents.ipynb) |
| MCP with LangGraph | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH05/ch05_mcp_langgraph.ipynb) |
| Product Reliability Rule | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH05/ch05_product_reliability_rule.ipynb) |
| Pydantic Agent Consistency | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/CH05/ch05_pydantic_agent_consistency.ipynb) |
Chapter 6 — Secure Execution and Tool Governance
| Notebook | Colab |
|---|---|
| A2A + MCP Governed | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch06/ch06_A2A_MCP_Governed.ipynb) |
| MCP Server with Composio | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch06/ch06_MCP_server_composio.ipynb) |
| LangGraph + E2B Sandbox | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch06/ch06_langgraph_E2B.ipynb) |
| Programmatic Tool Calling (Monty) | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch06/ch06_programmatic_tool_calling_monty.ipynb) |
Chapter 7 — Deploying Agents in Real Products
| Notebook | Colab |
|---|---|
| Hardening Backbone | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch07/ch07_hardening_backbone.ipynb) |
| Inference Backends | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch07/ch07_inference_backends.ipynb) |
| Model Fallback | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch07/ch07_model_fallback.ipynb) |
Chapter 8 — Foundational Evaluation and Operational Observation of Agentic Systems
| Notebook | Colab |
|---|---|
| OWASP ASI 2026 | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch08/ch08_OWASP_ASI_2026.ipynb) |
| Evaluation Harness | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch08/ch08_eval_harness.ipynb) |
Chapter 9 — Customized and Advanced Evaluation of Agentic Systems
| Notebook | Colab |
|---|---|
| AgentVista | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch09/ch09_agentvista.ipynb) |
| External Evaluation Pipelines (Langfuse) | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch09/ch09_example_external_evaluation_pipelines_Langfuse.ipynb) |
| External Evaluation Pipelines (LangSmith) | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch09/ch09_example_external_evaluation_pipelines_langsmith.ipynb) |
| RULER Trace Answer Ranking (LangSmith) | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch09/ch09_ruler_trace_answer_ranking_langsmith.ipynb) |
Chapter 10 — Agent Memory: How Persistence Turns Agents Into Evolving Systems
| Notebook | Colab |
|---|---|
| Agent Memory with LangGraph | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch10/ch10_agent_memory_langgraph.ipynb) |
| Memory vs. No Memory | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch10/ch10_memory_no_memory.ipynb) |
| Memory Topologies | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch10/ch10_memory_topologies.ipynb) |
Chapter 11 — From Compute to Cost: Designing Efficient Agentic Systems
| Notebook | Colab |
|---|---|
| Agent Cost Estimator by Topology | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch11/ch11_agent_cost_estimator_based_on_topology.ipynb) |
| Memoizing Swarm Research Engine | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch11/ch11_memoizing_swarm_research_engine.ipynb) |
| Memory Footprint, Throughput & GPU Requirements | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch11/ch11_memory_footprint_throughput_and_GPU_requirements.ipynb) |
Chapter 12 — Threat Modeling for AI Agents
| Notebook | Colab |
|---|---|
| LlamaFirewall | Open In Colab (https://colab.research.google.com/github/Nicolepcx/ai-agents-the-definitive-guide/blob/main/ch12/ch12_LlamaFirewall.ipynb) |
Similar Articles
@bkdgiffug: If you're doing Agent development, save this resource for later. The O'Reilly book *AI Agents - The Definitive Guide* h…
The O'Reilly book 'AI Agents - The Definitive Guide' has open-sourced its companion code, featuring 12 chapters and 35 notebooks covering AI agent development topics with Colab support and a chapter on threat modeling.
@x5cnhp: Agent developers, heads up—this freebie opportunity is one you'll seriously regret missing if you pass it up! That O'Re…
O'Reilly's book AI Agents - The Definitive Guide has had its full companion code released on GitHub — 12 chapters and 35 Colab-ready Jupyter notebooks covering agent fundamentals, multi-agent collaboration, production concerns, and threat modeling, available for free regardless of whether you own the book.
@tom_doerr: Official source code for O'Reilly's AI Agents definitive guide https://github.com/Nicolepcx/ai-agents-the-definitive-gu…
Official source code repository for O'Reilly's book 'AI Agents - The Definitive Guide', containing Jupyter notebooks and utilities for building AI agents.
@realchendahuang: A massive full-stack open-source tutorial for AI engineering has appeared on GitHub. It breaks down 20 stages and 523 m…
一个覆盖 20 个阶段、523 个模块的大型全栈开源 AI 工程教程出现在 GitHub 上,涵盖从线性代数、Transformer 到多智能体与生产部署的完整内容,并可一键安装为 Claude Code 或 Codex 的 Agent Skill,实现本地化的一对一辅导式学习。
@alacheng: Learning Agents from Scratch — a great free online course. It doesn't just cover LLM API calls; it covers memory systems, multi-agent systems, agentic RL, and more, plus practical code for a small agent. Easy to understand yet in-depth. https://github.com/Haozhe-X…
The open-source bilingual AI Agent textbook "agent_learning" has been released — 23 chapters covering everything from scratch: memory systems, RAG, multi-agent systems, Agentic RL, and production deployment, along with runnable reference Agent code and tests.