← Discover MCPs and Agents
a
AgentAI & MLGitHub

ai-agents-the-definitive-guide

Repo for AI Agents The Definitive Guide

Links

README

From the repo.

⭐ 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. The book has an accompanying website with quizzes and additional material, as well as a Discord channel.

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

NotebookColab
Code ExamplesOpen In Colab

Chapter 2 — Architectures and Patterns: Planning, Reactivity, and Multi-Agent-Systems

NotebookColab
Chain-of-Thought (CoT)Open In Colab
Tree-of-Thought (ToT)Open In Colab
ReActOpen In Colab
Human-in-the-Loop (HITL)Open In Colab
Hierarchical Agent TeamsOpen In Colab
SwarmsOpen In Colab

Chapter 3 — Advanced Planning, Reasoning, and Scalable Execution in Agents

NotebookColab
ART + RULEROpen In Colab
RULER Cat PoemsOpen In Colab
TreeQuest (AB-MCTS)Open In Colab

Chapter 4 — Models Behind the Agents: Capabilities and Optimization

NotebookColab
Supervisor Agent TeamOpen In Colab

Chapter 5 — From Prototypes to Production: Contracts, Tools, and Reliable Execution

NotebookColab
Deep AgentsOpen In Colab
MCP with LangGraphOpen In Colab
Product Reliability RuleOpen In Colab
Pydantic Agent ConsistencyOpen In Colab

Chapter 6 — Secure Execution and Tool Governance

NotebookColab
A2A + MCP GovernedOpen In Colab
MCP Server with ComposioOpen In Colab
LangGraph + E2B SandboxOpen In Colab
Programmatic Tool Calling (Monty)Open In Colab

Chapter 7 — Deploying Agents in Real Products

NotebookColab
Hardening BackboneOpen In Colab
Inference BackendsOpen In Colab
Model FallbackOpen In Colab

Chapter 8 — Foundational Evaluation and Operational Observation of Agentic Systems

NotebookColab
OWASP ASI 2026Open In Colab
Evaluation HarnessOpen In Colab

Chapter 9 — Customized and Advanced Evaluation of Agentic Systems

NotebookColab
AgentVistaOpen In Colab
External Evaluation Pipelines (Langfuse)Open In Colab
External Evaluation Pipelines (LangSmith)Open In Colab
RULER Trace Answer Ranking (LangSmith)Open In Colab

Chapter 10 — Agent Memory: How Persistence Turns Agents Into Evolving Systems

NotebookColab
Agent Memory with LangGraphOpen In Colab
Memory vs. No MemoryOpen In Colab
Memory TopologiesOpen In Colab

Chapter 11 — From Compute to Cost: Designing Efficient Agentic Systems

NotebookColab
Agent Cost Estimator by TopologyOpen In Colab
Memoizing Swarm Research EngineOpen In Colab
Memory Footprint, Throughput & GPU RequirementsOpen In Colab

Chapter 12 — Threat Modeling for AI Agents

NotebookColab
LlamaFirewallOpen In Colab

Collected info

  • 2,430 stars
  • 471 forks
  • Language: Jupyter Notebook
  • Source updated: 9/23/2026