Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

Books by Imran Ahmad, PhD

30 Agents Every AI Engineer Must Build

Book Cover

Build production-ready agent systems using proven architectures and patterns

From the author of 50 Algorithms Every Programmer Should Know

Author: Imran Ahmad, PhD
Publisher: Packt Publishing, 2026

Buy on Amazon


About This Book

The AI landscape is shifting from passive, reactive systems to autonomous, goal-directed intelligent agents—systems that perceive their environment, make decisions, and take actions with minimal human intervention. This book presents 30 essential agent architectures that every AI engineer must master to build effective, production-ready systems.

Raw LLMs alone are not enough. The key to building transformative AI systems lies in understanding how to architect agents that decompose complex tasks, connect to external tools and data sources, maintain memory across interactions, collaborate with humans and other agents, learn from experience, and make ethical decisions aligned with human values.

Each chapter includes working code, formal architectural patterns, real-world case studies, and guidance on avoiding common implementation pitfalls. Every pattern has been tested against the production realities of latency, cost, reliability, and security that define real-world deployments.

Who This Book Is For

This book is for AI engineers, software developers, ML researchers, and technical leads building intelligent systems. It's ideal for those deploying LLM-powered applications or transitioning from traditional ML to agentic frameworks. Python experience and basic ML knowledge are recommended.


Quick Start

# Clone the repository git clone https://github.com/PacktPublishing/30-Agents-Every-AI-Engineer-Must-Build.git cd 30-Agents-Every-AI-Engineer-Must-Build # Navigate to a chapter cd chapter05 # Install base dependencies pip install -r requirements.txt # Install your chosen provider's dependencies pip install -r requirements-openai.txt # For OpenAI GPT-4o pip install -r requirements-claude.txt # For Anthropic Claude Sonnet 4 pip install -r requirements-gemini.txt # For Google Gemini Flash 2.5 pip install -r requirements-ollama.txt # For local Ollama (no API key) # (Optional) Configure your API key for Live Mode cp .env.template .env # Set ONE of: OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_API_KEY # Launch the notebook jupyter notebook ch05_foundational_architectures.ipynb

Software and Hardware Requirements

RequirementDetails
OSmacOS, Windows, or Linux
RAM8 GB minimum; 16 GB recommended
Python3.10 or later
GPUNVIDIA GPU with CUDA 12+ (recommended, not required)
Toolsgit, terminal, virtual environment tool (venv, conda, or uv)
API KeysNone required — every chapter runs in Simulation Mode with built-in MockLLM responses. Optional: OpenAI, Anthropic, or Google API key unlocks Live Mode. Local Ollama requires no key.
OllamaOptional — for local LLM mode: install Ollama, then ollama pull deepseek-v2:16b and ollama pull llama3.1:8b. 16 GB+ RAM recommended.

Choose Your LLM Provider

Every chapter includes five pre-executed notebook variants — pick the one that matches your setup:

Notebook SuffixProviderAPI KeyModel
__RUN_NO_KEY_SIMULATIONNone (MockLLM)NoneBuilt-in chapter-derived mock responses
__RUN_OPENAI_GPT4oOpenAIOPENAI_API_KEYGPT-4o / GPT-4o-mini
__RUN_CLAUDE_Sonnet4AnthropicANTHROPIC_API_KEYClaude Sonnet 4
__RUN_GEMINI_Flash25GoogleGOOGLE_API_KEYGemini Flash 2.5
__RUN_LOCAL_OLLAMA_DeepSeek_V2_16BOllama (local)NoneDeepSeek V2 16B + Llama 3.1 8B embeddings

All five variants produce equivalent pedagogical output with identical cell structure. Every notebook is pre-executed with outputs saved, so you can browse them directly on GitHub without running any code.

  • No setup at all? Open the __RUN_NO_KEY_SIMULATION notebook — it runs entirely on MockLLM with no dependencies.
  • Want real LLM output? Set one API key in .env and open the matching notebook.
  • Prefer local inference? Install Ollama, pull the models, and open the __RUN_LOCAL_OLLAMA_DeepSeek_V2_16B notebook — no API key, no cloud calls, everything stays on your machine. See LOCAL_LLM_SETUP.md for step-by-step instructions on Windows, macOS, and Linux.
  • Which provider is best? See the LLM Provider Comparison Summary for head-to-head results across all 17 chapters with Bloom's taxonomy analysis, visualizations, and per-domain recommendations.

Table of Contents

Part 1: Agent Foundations and the Engineering Toolkit

Build the conceptual and practical foundation for designing, developing, and deploying intelligent agent systems. These chapters establish the theoretical vocabulary and engineering discipline that distinguish principled agent development from ad hoc prompt engineering.

ChapterTitleTopicsReal-World Use Case
Chapter 01Foundations of Agent EngineeringEvolution from rule-based to LLM-powered agents · Cognitive architecture · Agent Development Lifecycle · Progression Framework
Chapter 02The Agent Engineer's ToolkitLangChain, LlamaIndex, AutoGPT · LLM selection · Vector databases · Tool integration · Cloud platforms
Chapter 03The Art of Agent PromptingSystem prompts · Persona construction · Agent-to-agent protocols · Chain-of-thought · Prompt version control
Chapter 04Agent Deployment and Responsible DevelopmentInfrastructure scaling · Cost management · Prompt injection defenses · Bias detection · Regulatory complianceNovaClaim Insurance — Deploying AI agents for 40K claims/month

Part 2: Core Agent Architectures

Explore the fundamental agent architectures that serve as composable building blocks. Each architecture is designed to be combined with others to produce systems whose capabilities exceed the sum of their individual components.

ChapterTitleAgents CoveredReal-World Use Case
Chapter 05Foundational Cognitive ArchitecturesThe Autonomous Decision-Making Agent · The Planning Agent · The Memory-Augmented Agent
Chapter 06Information Retrieval and Knowledge AgentsThe Knowledge Retrieval Agent (advanced RAG) · The Document Intelligence Agent · The Scientific Research Agent
Chapter 07Tool Manipulation and Orchestration AgentsThe Tool-Using Agent · The Chain-of-Agents Orchestrator · The Agentic Workflow SystemShieldPoint Insurance — 5-agent claims pipeline cutting cycle time from 12 days to 3.5
Chapter 08Data Analysis and Reasoning AgentsThe Data Analysis Agent · The Verification and Validation Agent · The General Problem Solver

Part 3: Specialized Application Agents

Extend core architectures into domains with stringent requirements for reliability, safety, and domain expertise. Each chapter includes production deployment considerations, a working codebase, and a real-world use case study with fictional companies, stakeholder profiles, and revenue impact analysis.

ChapterTitleAgents CoveredReal-World Use Case
Chapter 09Software Development AgentsThe Code-Generation Agent · The Security-Hardened Agent · The Self-Improving AgentVaultPay — Fintech startup catching PCI violations in CI/CD and fixing a declining support chatbot
Chapter 10Conversational and Content Creation AgentsThe Conversational Agent · The Content Creation Agent · The Recommendation AgentMindBridge Health — Campus wellness platform with crisis-safe chatbot serving 31K students
Chapter 11Multi-Modal Perception AgentsThe Vision-Language Agent · The Audio Processing Agent · The Physical World Sensing AgentMeridian Facilities — 22-building smart property management with 17% energy reduction
Chapter 12Ethical and Explainable AgentsThe Ethical Reasoning Agent · The Explainable AgentTalentForward + ClearPath Health — Fair hiring (DI 0.73 → 0.80+) and explainable clinical diagnosis

Part 4: Domain-Specific Agent Systems with Real-World Use Cases

Apply the full range of agent architectures to transform professional domains where complexity, regulation, and human impact are most acute. Each chapter includes a detailed use case study with a fictional company navigating real industry constraints — failed alternatives, regulatory requirements, revenue impact, and a step-by-step mapping of how the code solves each problem.

ChapterTitleAgents CoveredReal-World Use Case
Chapter 13Healthcare and Scientific AgentsThe Healthcare Intelligence Agent · The Scientific Discovery AgentPinnacle Health + NovaMateria Labs — Bayesian sepsis detection cutting missed cases by 79%; materials discovery compressed 60%
Chapter 14Financial and Legal Domain AgentsThe Financial Advisory Agent · The Legal Intelligence AgentMeridian Wealth + Cartwright Legal — Compliance-by-architecture for $2.8B RIA; hallucination-proof legal research
Chapter 15Education and Knowledge AgentsThe Education Intelligence Agent · The Collective Intelligence AgentLearnPath — Adaptive Python tutor raising completion from 52% to 78% across 12K learners
Chapter 16Embodied and Physical World AgentsThe Embodied Intelligence Agent · The Domain-Transforming Integration AgentArcticWing Aerial — Autonomous drone ops in Ottawa winter, scrub rate 38% → 14%
EpilogueThe Future of Intelligent AgentsAutonomous agent evolution · Agent societies and emergent behaviors · Brain-inspired cognitive architectures

Chapter Structure

Each chapter follows a consistent six-part structure designed for both learning and reference:

  1. Conceptual Foundation — Core principles and architectural patterns
  2. Implementation Guide — Detailed code examples highlighting essential components
  3. Case Studies — Real-world applications solving practical problems
  4. Design Patterns and Variations — Alternative approaches for different contexts
  5. Integration Considerations — Combining agents into more powerful systems
  6. Common Pitfalls — Avoiding typical implementation mistakes

How to Use This Book

This book accommodates three distinct reading approaches:

  • Sequential: Chapters 1–4 → 5–12 → 13–16 → Epilogue (full foundation to specialization)

  • Domain-Focused: Start with Chapters 1–4 for foundations, then jump directly to your industry vertical:

    If you work in...Start hereThen explore
    HealthcareCh 13 (Bayesian diagnosis, scientific discovery)Ch 12 (explainability, fairness) → Ch 11 (medical imaging)
    Finance or LegalCh 14 (portfolio advisory, contract analysis)Ch 4 (cost management, compliance) → Ch 12 (audit trails)
    InsuranceCh 7 (claims workflow, HITL escalation)Ch 4 (deployment patterns) → Ch 9 (compliance scanning)
    EducationCh 15 (adaptive tutoring, knowledge tracing)Ch 10 (conversational agents) → Ch 9 (self-improving agents)
    Software EngineeringCh 9 (code generation, PCI/HIPAA scanning)Ch 7 (tool orchestration) → Ch 12 (explainable decisions)
    Facilities / IoTCh 11 (sensor fusion, proportional control)Ch 8 (data analysis) → Ch 7 (workflow automation)
    Robotics / DronesCh 16 (safety envelopes, cascade analysis)Ch 11 (perception agents) → Ch 4 (resilience patterns)
  • Reference: Look up specific agent architectures as needed for particular projects


The 30 Agents at a Glance

#AgentChapter
1The Autonomous Decision-Making AgentCh 5: Foundational Cognitive Architectures
2The Planning AgentCh 5: Foundational Cognitive Architectures
3The Memory-Augmented AgentCh 5: Foundational Cognitive Architectures
4The Knowledge Retrieval AgentCh 6: Information Retrieval & Knowledge Agents
5The Document Intelligence AgentCh 6: Information Retrieval & Knowledge Agents
6The Scientific Research AgentCh 6: Information Retrieval & Knowledge Agents
7The Tool-Using AgentCh 7: Tool Manipulation & Orchestration Agents
8The Chain-of-Agents OrchestratorCh 7: Tool Manipulation & Orchestration Agents
9The Agentic Workflow SystemCh 7: Tool Manipulation & Orchestration Agents
10The Data Analysis AgentCh 8: Data Analysis & Reasoning Agents
11The Verification and Validation AgentCh 8: Data Analysis & Reasoning Agents
12The General Problem SolverCh 8: Data Analysis & Reasoning Agents
13The Code-Generation AgentCh 9: Software Development Agents
14The Security-Hardened AgentCh 9: Software Development Agents
15The Self-Improving AgentCh 9: Software Development Agents
16The Conversational AgentCh 10: Conversational & Content Creation Agents
17The Content Creation AgentCh 10: Conversational & Content Creation Agents
18The Recommendation AgentCh 10: Conversational & Content Creation Agents
19The Vision-Language AgentCh 11: Multi-Modal Perception Agents
20The Audio Processing AgentCh 11: Multi-Modal Perception Agents
21The Physical World Sensing AgentCh 11: Multi-Modal Perception Agents
22The Ethical Reasoning AgentCh 12: Ethical & Explainable Agents
23The Explainable AgentCh 12: Ethical & Explainable Agents
24The Healthcare Intelligence AgentCh 13: Healthcare & Scientific Agents
25The Scientific Discovery AgentCh 13: Healthcare & Scientific Agents
26The Financial Advisory AgentCh 14: Financial & Legal Domain Agents
27The Legal Intelligence AgentCh 14: Financial & Legal Domain Agents
28The Education Intelligence AgentCh 15: Education & Knowledge Agents
29The Collective Intelligence AgentCh 15: Education & Knowledge Agents
30The Embodied Intelligence AgentCh 16: Embodied & Physical World Agents

Errata

Figure 1.3 — Communication Patterns in Agent Cognitive Architecture (p. 12)

Issue: One of the two "Reasoning/Evaluation" nodes is duplicated.

Correction: Replace the duplicated "Reasoning/Evaluation" node with "Tool use/Action interface".

Corrected Figure

Figure 1.3 Corrected


Figure 1.5 — Hybrid Agents (p. 13)

Issue: The label "Coal" is a typo.

Correction: Change "Coal" to "Goal".

Corrected Figure

Figure 1.5 Corrected


Figure 1.14 — The Agentic AI Progression Framework (p. 14)

Issue: Levels 1 and 2 were incorrectly labeled.

Correction:

  • Level 0 — Manual operations — Non-agentic systems
  • Level 1 — Reactive agents — Rule-based automation
  • Level 2 — Tool-using agents — Augmented execution
  • Level 3 — Planning agents — Contextual and goal-oriented
  • Level 4 — Learning agents — Adaptive and evolving

Corrected Figure

Figure 1.14 Corrected

About the Author

Imran Ahmad on LinkedIn

Imran Ahmad, PhD

Imran Ahmad, PhD is a data scientist at the Advanced Analytics Solution Center (A2SC) within the Canadian Federal Government, where he builds and deploys machine learning systems for mission-critical applications. In his 2010 doctoral thesis, he introduced a linear programming-based algorithm for optimal resource assignment in large-scale cloud computing environments. In 2017, he pioneered the development of StreamSensing, a real-time analytics framework that has become the foundation of several research papers on processing multimedia data within machine learning paradigms.

Dr. Ahmad holds a visiting professorship at Carleton University in Ottawa and is an authorized instructor for Google Cloud and Microsoft Azure. He is the author of the bestselling 50 Algorithms Every Programmer Should Know (Packt Publishing, Second Edition 2023), which has been widely adopted in both academic curricula and industry training programs. Every pattern in this book has been tested against the production realities of latency, cost, reliability, and security that define real-world deployments.


Get in Touch

关于 About

30 Agents Every AI Engineer Must Build, published by Packt

语言 Languages

Jupyter Notebook95.9%
Python3.9%
Shell0.2%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
75
Total Commits
峰值: 34次/周
Less
More

核心贡献者 Contributors