📄 Page
1
(This page has no text content)
📄 Page
2
Architecting AI Software Systems Crafting robust and scalable AI systems for modern software development Richard D Avila Imran Ahmad
📄 Page
3
Architecting AI Software Systems Copyright © 2025 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Portfolio Director: Kunal Chaudhari Relationship Lead: Denim Pinto Project Manager: K. Loganathan Content Engineer: Deepayan Bhattacharjee Technical Editor: Irfa Ansari Copy Editor: Safis Editing Indexer: Rekha Nair Proofreader: Deepayan Bhattacharjee Production Designer: Alishon Falcon Growth Lead: Mansi Shah First published: October 2025 Production reference: 1300925 Published by Packt Publishing Ltd. Grosvenor House 11 St Paul’s Square Birmingham B3 1RB, UK. ISBN 978-1-80461-597-3 www.packtpub.com
📄 Page
4
Dedicated to my parents Mom, your love and support are the bedrock that I stand on. Dad, you were my first and most influential teacher on architecture. Fate took you from us – I can only imagine the conversations we would have had about what intelligence, software, and architecture are. Your presence was with me in writing this book. – Richard D Avila I dedicate this book to my beloved father, Inayatullah Khan. His wisdom, values, and unwavering support continue to inspire me every day. – Imran Ahmad
📄 Page
5
Contributors About the authors Richard D Avila is a software and systems architect with over two decades of industry experience building complex software systems. He has architected and held leadership roles for building a wide array of software systems to include complex simulations, autonomy, and data analytic sys- tems. He has published in referred journals and industry publications on command-and-control theory, assurance architectures, multi-agent modeling, and machine learning. He was the first expert instructor on data analytics at the University of Maryland, Baltimore County – Training Centers. Before working as a software and systems architect, he served in the US Navy as a sub- marine officer. I would like to thank the Packt editors for their support and guidance, and their insights and recommendations. Special thanks to Deepayan, Loganathan, and Denim. Imran Ahmad, Ph.D, is an accomplished author and data scientist, widely recognized for his best-selling book 50 Algorithms Every Programmer Should Know. He currently lends his expertise to the Advanced Analytics Solution Center (A2SC) within the Canadian Federal Government, where he harnesses machine learning algorithms for mission-critical applications. In his 2010 doctoral thesis, he introduced a linear programming-based algorithm tailored for optimal resource assignment in expansive cloud computing landscapes. Later, in 2017, Dr. Ahmad pioneered the development of a real-time analytics framework, StreamSensing. This tool has become the cornerstone of several of his research papers, leveraging it to process multi- media data within various machine learning paradigms.
📄 Page
6
Outside of his governmental role, Dr. Ahmad holds a visiting professorship at the University of Ottawa. He has also been recognized as an authorized instructor for both Google Cloud and Mi- crosoft. Currently, he is writing a forthcoming book on AI agents, scheduled for publication next year, and is actively engaged in research on large-scale AI agents, exploring how these systems can transform real-world applications. I’m deeply grateful to my wife, Naheed, my son, Omar, and my daughter, Anum, for their unwavering support. A special nod to my parents, notably my father, Inayatullah, for his relentless encouragement to continue learning. Further appreciation goes to Loganathan, Denim, and Deepayan from Packt for their invaluable contributions.
📄 Page
7
About the reviewers Mohamed Osam Abouahmed is a principal architect and consultant providing a unique combination of technical and commercial expertise to resolve complex and business-critical issues through the design and delivery of innovative, technology-driven systems and solutions. Mohamed specializes in network automation solutions and smart systems development and deployment. Mohamed’s hands-on experience, underpinned by his strong project management and academic background, which includes a PMP Certification, Master of Global Management, Master of Busi- ness Administration (International Business), Master of Science in Computer Networking, and BSc in Electronics Engineering, has helped him develop and deliver robust solutions for multiple carriers, service providers, enterprises, and Fortune 200 clients including (among others) AT&T, Cisco Systems, and AWS. He is the author of Building Your AI Agents Army: A Hands-On Guide to Building Intelligent Autono- mous Systems with Open-Source Tools (ISBN 979-8283388939) and Machine Learning in Microservices: Productionizing microservices architecture for machine learning solutions (ISBN: 978-1804612149). Ajay Soni is the creator of the Verb-Oriented Middleware Architecture (VOMA) and the Verb-Object Graph Architecture (VOGA), paradigms established to integrate governance, ex- plainability, and auditable processes into complex AI workflows. With over two decades of ex- perience as a systems architect, AI researcher, and software engineer, his work has impacted high-stakes domains including quantitative finance, aerospace and defense, and enterprise AI. A strong proponent of Model-Based Systems Engineering (MBSE), Ajay uses SysML to bridge the gap between high-level architectural design and robust, practical implementation. His research focuses on enabling real-time, autonomous decision-making on resource-constrained edge de- vices, ensuring every action is both transparent and compliant.
📄 Page
8
Through his company, Enjector Software, Ajay has developed a comprehensive platform for trust- ed autonomy. His expertise has been honed in demanding environments, having architected real-time fraud detection platforms at Barclays, developed large-scale pricing and risk systems at BNP Paribas, and designed distributed, safety-critical software for the Tempest fighter jet pro- gram at Leonardo. This background informs his perspective as a reviewer, bringing a meticulous focus on how governance, explainability, and real-time performance are integrated into complex systems. This is his first contribution as a book reviewer. I appreciate the opportunity to review this insightful book and thank the authors and publishing team. I am also grateful to my family, friends, and colleague Dr. Indu Bhalla for their support and for the valuable discussions that have shaped my perspective on autonomous systems. These conversations have reinforced the importance of ethical governance, which guides my evaluations and reflects the collaborative spirit of my work.
📄 Page
9
(This page has no text content)
📄 Page
10
Table of Contents Preface xix Part I: Architecting Fundamentals 1 Chapter 1: Fundamentals of AI System Architecture 3 Getting the most out of this book – get to know your free benefits ������������������������������������� 5 Next-gen reader • 5 Interactive AI assistant (beta) • 6 DRM-free PDF or ePub version • 6 Introduction to AI systems: architecting the future of intelligence ������������������������������������� 7 What is an AI system? • 9 The pervasive impact of AI infrastructure: powering intelligent solutions across industries • 11 Key components of AI system architectures • 12 Microservice architectures: a modular approach to building complex AI systems ������������ 14 Advantages of microservices for AI • 15 Challenges of microservice architectures • 15 Real-world example: conversational AI microservices implementation • 15 The four core microservices • 16 Role of the API gateway • 17 Conversation flow sequence • 18 Key aspects of microservice communication • 19 Implementation considerations for conversational AI microservices • 20 Why microservices for conversational AI? • 21 Considerations for an AI system ����������������������������������������������������������������������������������������� 21 Scalability: handling growing data and model complexity • 22
📄 Page
11
Table of Contentsx Performance: optimization techniques • 22 Reliability: fault tolerance, error handling, and redundancy • 23 Security: data privacy and model robustness • 23 Data modeling: catalogs and ontologies • 23 Modern AI deployment paradigms ������������������������������������������������������������������������������������ 24 Cloud-native AI architectures • 24 Data lakes and data warehouses in AI architectures: foundations for data-driven intelligence ����������������������������������������������������������������������������������������������������������������������� 25 Data lakes: a vast reservoir of raw data • 25 Data warehouses: structured repositories for analytics • 26 The synergy of data lakes and data warehouses • 27 AI on cloud computing: a game-changer for AI ����������������������������������������������������������������� 27 Benefits of cloud-based AI • 27 Major cloud AI platforms: accelerating innovation with comprehensive toolsets • 28 Key cloud AI platforms • 28 Summary �������������������������������������������������������������������������������������������������������������������������� 29 Relevant reading ��������������������������������������������������������������������������������������������������������������� 29 Chapter 2: The Case for Architecture 31 Consequences of architectural failures ����������������������������������������������������������������������������� 32 The origins of architecting ������������������������������������������������������������������������������������������������ 33 The role of the architect ���������������������������������������������������������������������������������������������������� 35 Balancing vision and precision in AI architecture • 36 AI systems and architecture ���������������������������������������������������������������������������������������������� 37 The holder of the vision ���������������������������������������������������������������������������������������������������� 38 The architectural cycle ������������������������������������������������������������������������������������������������������ 39 Thinking like an architect • 40 Maintaining architectural vision • 42 Modern system architecting ��������������������������������������������������������������������������������������������� 43 Decision-making frameworks for AI architecture • 44 Selecting the right AI approach • 45
📄 Page
12
Table of Contents xi Multi-dimensional decision framework • 45 Business alignment • 45 Data science considerations • 46 Technical constraints • 46 Structured decision process • 46 Balancing innovation and practicality • 47 The language of software architecture • 48 Governance and compliance considerations for AI systems ���������������������������������������������� 49 Governance framework for AI architectures • 49 Explainability in AI architecture design • 50 Regulatory compliance integration • 50 Implementation considerations • 51 Modeling and simulation ��������������������������������������������������������������������������������������������������� 51 What is software systems modeling? • 51 The role of modeling and simulation in AI/ML systems • 52 Architecture and interfaces ����������������������������������������������������������������������������������������������� 53 Interfaces • 53 Interfaces and AI • 54 Summary �������������������������������������������������������������������������������������������������������������������������� 54 Relevant reading ��������������������������������������������������������������������������������������������������������������� 54 Chapter 3: Software Engineering and Architecture 57 Understanding software complexity in AI systems ����������������������������������������������������������� 58 Integration complexity • 59 Case study: healthcare AI integration • 60 Functional complexity • 60 Technical complexity • 61 Verification complexity • 61 Example: verification in computer vision • 62 Human interface complexity • 62 Architecting in practice ����������������������������������������������������������������������������������������������������� 62
📄 Page
13
Table of Contentsxii Approaches for taming software complexity ��������������������������������������������������������������������� 64 Developing the architecture • 65 Integration and cohesion • 66 Project management ��������������������������������������������������������������������������������������������������������� 67 Project initiation • 67 Project planning • 69 Project execution • 70 Monitoring and control • 70 Project closing • 70 Case study: AI project management in action • 70 Summary ��������������������������������������������������������������������������������������������������������������������������� 71 Exercises ��������������������������������������������������������������������������������������������������������������������������� 72 References ������������������������������������������������������������������������������������������������������������������������� 72 Part II: Architecting AI Systems 73 Chapter 4: Conceptual Design for AI Systems 75 Concept of Operations (CONOPS) ������������������������������������������������������������������������������������� 77 CONOPS for AI-centric systems • 78 Understanding the current system • 79 Data-centric view for AI systems • 79 Non-functional requirements for AI systems • 80 The business case for AI systems �������������������������������������������������������������������������������������� 80 Impact of AI technologies on business operations • 82 Organizational integration and human impacts • 83 Scenarios for AI-enabled systems �������������������������������������������������������������������������������������� 83 Creating effective scenarios • 84 AI technology usage in scenarios • 86 Defining success and constraints • 86 Use cases for AI-enabled systems �������������������������������������������������������������������������������������� 87
📄 Page
14
Table of Contents xiii Structure of effective use cases • 87 User classes and AI interaction • 87 Operational modes for AI-enabled systems ���������������������������������������������������������������������� 88 Configuration mode • 88 Startup mode • 89 Execution mode • 89 Maintenance mode • 90 Recovery mode • 90 Shutdown mode • 90 Risk mitigation through conceptual design ���������������������������������������������������������������������� 91 Data quality risk mitigation • 92 Stakeholder expectation management • 92 Integration risk mitigation • 92 Case study: Retail recommendation system ���������������������������������������������������������������������� 93 CONOPS development • 93 Business case • 93 Scenarios and use cases • 93 Operational modes • 94 Implementation challenges and lessons learned • 94 Summary �������������������������������������������������������������������������������������������������������������������������� 95 Exercises ��������������������������������������������������������������������������������������������������������������������������� 96 References ������������������������������������������������������������������������������������������������������������������������� 97 Chapter 5: Requirements and Architecture for AI Pipelines 99 Development pipelines ��������������������������������������������������������������������������������������������������� 100 Data store requirements ������������������������������������������������������������������������������������������������� 102 Data volume and velocity • 102 Data formats and processing approaches • 103 Timeliness and technology selection • 103 Non-functional requirements and governance • 103 Support operations and specialized stores • 103
📄 Page
15
Table of Contentsxiv Algorithmic development components ��������������������������������������������������������������������������� 104 Data quality checks • 104 Data transforms • 105 Data summary • 105 Model building, tuning, and verification • 105 Configuration control • 107 Machine learning performance • 107 Computation infrastructure • 107 Scale processing • 107 Model tuning and verification • 107 Code committal and DevOps • 108 Production pipeline �������������������������������������������������������������������������������������������������������� 108 Data stores • 108 Data operations • 109 Data cleansing • 109 Data transformation • 110 Model execution • 110 Operational status monitoring • 110 Model maintenance • 112 Results and end user stores • 112 Pipeline operations store • 112 Continuous development/integration • 113 Architecture patterns and tactics ������������������������������������������������������������������������������������� 114 Non-functional requirements • 115 Reliability • 115 Maintainability • 115 Usability • 116 Summary ������������������������������������������������������������������������������������������������������������������������� 116 Exercises �������������������������������������������������������������������������������������������������������������������������� 117 References ������������������������������������������������������������������������������������������������������������������������ 117
📄 Page
16
Table of Contents xv Chapter 6: Design, Integration, and Testing 119 Design fundamentals ������������������������������������������������������������������������������������������������������� 119 Requirements • 120 Performance requirements • 120 Non-functional requirements • 120 Security requirements • 121 Compliance requirements • 121 Actors and use cases • 122 System modes • 123 Block definition diagrams ������������������������������������������������������������������������������������������������ 126 Data cleansing • 126 Data transformation • 126 Machine learning model • 127 Pipeline operations • 127 Results store • 128 System tactics and patterns �������������������������������������������������������������������������������������������� 128 Key attributes • 128 Maintainability tactics and patterns • 128 Availability tactics and patterns • 129 Essential patterns for AI systems • 129 Integration and testing ���������������������������������������������������������������������������������������������������� 132 Types of integrations • 132 Integration harness • 134 Testing types • 135 Requirements testing • 136 Use case and scenario testing • 136 Load testing • 137 Model prediction testing • 137 Data quality testing • 138 Error and fault recovery testing • 138
📄 Page
17
Table of Contentsxvi Compliance testing • 138 User interface testing • 139 Continuous development and integration • 139 Summary ������������������������������������������������������������������������������������������������������������������������ 140 Exercises �������������������������������������������������������������������������������������������������������������������������� 141 References ������������������������������������������������������������������������������������������������������������������������ 142 Chapter 7: Architecting a Generative AI System – A Case Study 143 The business challenge: Knowledge management crisis ������������������������������������������������� 144 The vision: Transformation through generative AI ���������������������������������������������������������� 145 Aligning business and technical objectives ��������������������������������������������������������������������� 146 Data science objectives • 146 The architecture: Core components and workflow ���������������������������������������������������������� 147 System overview • 147 Key components • 148 LLM: The cognitive engine • 148 Retrieval system (vector database): The knowledge repository • 149 Web search integration: Real-time information access • 150 From static models to dynamic agents • 151 LangChain agent workflow • 151 User query input • 152 Intelligent routing • 152 Contextual augmentation • 152 Web search (conditional) • 153 Response generation • 153 Feedback loop • 154 Technical infrastructure �������������������������������������������������������������������������������������������������� 154 Cloud compute architecture • 154 End-to-end system architecture �������������������������������������������������������������������������������������� 155 Client tier: User access and experience • 156 Presentation tier: Interface orchestration • 156
📄 Page
18
Table of Contents xvii Application tier: Business logic • 156 Data tier: Information storage and retrieval • 157 External services: Extending capabilities • 157 User interaction patterns ������������������������������������������������������������������������������������������������� 157 Use case: Query resolution • 157 Business impact ��������������������������������������������������������������������������������������������������������������� 159 Operational transformation • 159 Customer experience • 160 Financial outcomes • 160 Cultural evolution • 160 Key architectural principles �������������������������������������������������������������������������������������������� 160 Retrieval-Augmented Generation (RAG) • 161 Adaptive query routing • 162 Feedback-driven learning • 162 Summary ������������������������������������������������������������������������������������������������������������������������� 163 References ������������������������������������������������������������������������������������������������������������������������ 163 Chapter 8: Insights and Future Directions 165 Architecture �������������������������������������������������������������������������������������������������������������������� 165 Building AI-enabled systems ������������������������������������������������������������������������������������������ 166 Data engineering ������������������������������������������������������������������������������������������������������������� 167 Data analytics and models ���������������������������������������������������������������������������������������������� 167 Conceptual design ���������������������������������������������������������������������������������������������������������� 168 Design, integration, and testing ��������������������������������������������������������������������������������������� 169 Future directions of AI and architecture ������������������������������������������������������������������������� 170 Moving forward ��������������������������������������������������������������������������������������������������������������� 171 Chapter 9: Unlock Your Book’s Exclusive Benefits 173 How to unlock these benefits in three easy steps ������������������������������������������������������������� 173 Step 1 • 173 Step 2 • 174
📄 Page
19
Table of Contentsxviii Step 3 • 174 Need help? • 175 Other Books You May Enjoy 178 Index 181
📄 Page
20
Preface The age of Artificial Intelligence (AI) is upon us. Every day, new applications, extensions, or im- provements in almost all aspects of life are being impacted by AI technologies. These technologies are almost entirely realized in complex software. Building complex software is a challenge that requires disciplined and methodical effort to en- gineer. Many times, when complex software systems fail, it is usually that the architecture of the system failed, rather than a specific algorithmic or implementation detail. There exist best practices and lessons learned for building complex software. There also exist plenty of references on the theory and implementation of AI technologies. There do not exist many references for how to build complex software that has AI technologies at its heart. The authors’ main tenet is that the application of architecting concepts and practices is a key en- abler to building complex AI software. In the pages that follow, we will discuss what some of the challenges facing the builder of a complex AI system are. You will learn how you can adapt and use the lessons from architecting to structure and guide the development of a software system. The book looks to balance theory and application: theory so that recommendations are grounded and can be understood, and application so that the book can be useful to you in the here and now. This book is the culmination of decades of experience of the authors with hard-earned lessons, both positive and negative. The age of AI is here; we hope this book will be another tool in your toolbox.