Share E-Book

Grokking AI Applications An illustrated guide for programmers and other curious people (Andrea De Mauro)(Z-Library)

Author

Rating No ratings yet

Log in to rate

Other
Language English

This book shows you how to create AI applications like chatbots, agents, and systems customized to use your own data—even if you’ve never built one before! Supporting his explanations with graphics and using concrete examples and hands-on implementations, author Andrea De Mauro gets you thinking about system design and mental models rather than boilerplate code and syntax debugging. You’ll quickly focus on the right level: how to manage prompts, data, and application components to get the results you want. You’ll start with a bare-bones chatbot, as you learn how to create good prompts and improve accuracy using Retrieval Augmented Generation (RAG). To help your applications live in the real world, the book discusses how to connect them to document collections, structured databases, and CRM tools. You’ll build on this foundation, creating your own agents and equipping them with tools for data analysis and complex reasoning. Reviewer Julien Pohie of Thoughtworks commented, “The emphasis on multi-agent orchestration aligns perfectly with modern engineering best practices.” Step-by-step guidance, rich diagrams, and workflow summaries help you stay oriented, even through advanced material. To emphasize conceptual and design thinking, you’ll start each project using the low-code development tool Langflow. For readers who want to go deeper, every example also includes fully-annotated Python implementations. You’ll see the code, libraries, APIs, and data behind each application, along with practical advice on how to deploy and monitor your applications. Compact by design, this fast-paced book includes eight fully illustrated chapters that build intuition through engaging, memorable, and relatable real-world scenarios. As you read, you’ll experience a shift from AI as the familiar conversational chatbot to AI as an essential part of your application and, further, to the design of multi-agentic teams with specialized roles and supervised coordination.

Format PDF
Size 7.6 MB
8
Views
(First 20 pages)

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Page 1
Andrea De Mauro Illustrated by Ines Schweigert Foreword by Rodrigo Nader An illustrated guide for programmers and other curious people
Page 2
Grokking AI Applications An illustrated guide for programmers and other curious people Andrea De Mauro Illustrated by Ines Schweigert Foreword by Rodrigo Nader MANN ING Shelter ISland Licensed to malky vidal <malkyvidal@gmail.com>
Page 3
For online information and ordering of this and other Manning books, please visit www .manning .com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact Special Sales Department Manning Publications Co. 20 Baldwin Road, PO Box 761 Shelter Island, NY 11964 Email: orders@manning.com ©2026 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. The author and publisher have made every effort to ensure that the information in this book was correct at press time. The author and publisher do not assume and hereby disclaim any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from negligence, accident, or any other cause, or from any usage of the information herein. Manning Publications Co. Development editor: Rebecca Johnson 20 Baldwin Road Technical editor: Rohit Agarwal Shelter Island, NY 11964 Review editors: Radmila Ercegovac and Kishor Rit Production editor: Kathy Rossland Copy editor: Julie McNamee Proofreader: Keri Hales Typesetter: Dennis Dalinnik Cover designer: Marija Tudor ISBN: 9781633435872 Printed in the United States of America Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine. Licensed to malky vidal <malkyvidal@gmail.com>
Page 4
To my son, Suraj Licensed to malky vidal <malkyvidal@gmail.com>
Page 5
Licensed to malky vidal <malkyvidal@gmail.com>
Page 6
v brief contents 1 Peeking inside the black box 1 2 Building your first GenAI app 23 3 Writing the right prompt 47 4 Augmenting LLMs with your own documents 73 5 Expanding GenAI capabilities with tools and agents 101 6 Implementing agentic structures 129 7 Integrating GenAI in your data ecosystem 173 8 Deploying and orchestrating GenAI apps 211 Licensed to malky vidal <malkyvidal@gmail.com>
Page 7
Licensed to malky vidal <malkyvidal@gmail.com>
Page 8
vii contents foreword xi preface xiii acknowledgments xv about this book xvii about the author xxi about the illustrator xxi 1 Peeking inside the black box 1 Our journey ahead 1 The uniqueness of GenAI programming 2 Dealing with LLMs 4 Building GenAI applications that extend LLMs 5 Inside the LLM 9 Understanding GPT: How a real LLM works 15 Summary 22 Licensed to malky vidal <malkyvidal@gmail.com>
Page 9
viii contents 2 Building your first GenAI app 23 Wait a minute, low code? 23 Intro to Langflow 26 Hello, World! Our pirate chatbot 32 What if we coded it? 42 Summary 45 3 Writing the right prompt 47 What makes a good prompt? 48 Prompting enhancement techniques 53 Prompt templates in Langflow 57 What if we coded it? 68 Summary 72 4 Augmenting LLMs with your own documents 73 RAG in a nutshell 74 Building a RAG system in Langflow 83 Taking RAG to the next level 94 What if we coded it? 98 Summary 100 5 Expanding GenAI capabilities with tools and agents 101 Beyond words: When GenAI needs to act 102 Agents and tools 103 Building an agent in Langflow 108 Building a travel agent 114 Taking agents to the next level 122 What if we coded it? 125 Summary 127 Licensed to malky vidal <malkyvidal@gmail.com>
Page 10
contents ix 6 Implementing agentic structures 129 From solo agents to agentic structures 130 Types of agentic structures 131 HealthyChef™ reimagined 133 Setting up an agentic copywriting team 146 What if we coded it? 165 Summary 171 7 Integrating GenAI in your data ecosystem 173 Getting started with KNIME 176 Generating personalized emails at scale 181 What if we coded it? 207 Summary 210 8 Deploying and orchestrating GenAI apps 211 Deploying your GenAI app 212 Orchestrating GenAI apps 219 Setting up a culinary travel agent 223 What if we coded it? 237 Summary 240 Now what happens? 240 index 243 Licensed to malky vidal <malkyvidal@gmail.com>
Page 11
Licensed to malky vidal <malkyvidal@gmail.com>
Page 12
xi foreword Building AI applications is a fundamentally different kind of engineering. In traditional software, you write deterministic logic—sequences of functions where inputs map pre- dictably to outputs, and bugs live in the codebase. With agentic pipelines, you’re design- ing systems where an LLM makes decisions on your behalf. You don’t control the output directly; you influence it through prompt design, retrieval strategies, tool orchestration, and careful observation of how the system reasons. This shift demands new skills, new tools, and a new way of thinking. That’s one of the problems we set out to solve when we created Langflow. The idea was straightforward: give people a visual, open source environment where they could com- pose AI applications by connecting building blocks—models, agents, data sources, tools—without being forced to write everything from scratch. Not because code doesn’t matter, but because the real complexity in AI development has moved. It’s no longer just about implementation. It’s about designing the right flow, testing how an agent behaves, inspecting its reasoning, and iterating quickly until the system works reliably. Whether you’re a software engineer building a multi-agent pipeline, an analyst automating docu- ment classification, or a product team prototyping a customer support bot, the challenge is the same: you need visibility, control, and speed. What I’ve seen over the past few years is that the people building the most impactful AI applications are the ones who understand their domain, who can think in terms of systems—connecting context, reasoning, and action into coherent workflows—and who have access to tools that let them move fast without sacrificing control. The democratiza- tion of AI development isn’t just real—it’s happening blazing fast, right in front of our eyes. Jobs will change, techniques will evolve, and those who keep up with the conver- gence of where all of this is heading will be the ones who make the most out of it. This is what makes Andrea’s book so timely. It puts you in front of real problems—a customer service assistant, a marketing advisor, a travel planner—and walks you through constructing each one step-by-step. Along the way, you learn the techniques that matter Licensed to malky vidal <malkyvidal@gmail.com>
Page 13
xii foreword most: prompt and context engineering, RAG, agentic design, and tool integration. They are the foundational patterns of how AI applications are built today and will likely continue to be built for years to come. In the book, Andrea interestingly covers the nature of LLMs—the nondeterminism, the statelessness, the opacity. He gives you the intuition to understand what’s happening inside the black box, then hands you the practical techniques to work with it effectively. That bal- ance between understanding and pragmatism is what a new generation of builders needs. We’re still early. Agents will become more autonomous, retrieval systems more intelligent, and development environments will increasingly blur the line between writing software and conversing with it. The people who thrive will be the ones who know how to compose AI systems with intention and creativity. This book starts with that foundation. —Rodrigo Nader Cofounder of Langflow Licensed to malky vidal <malkyvidal@gmail.com>
Page 14
xiii Artificial intelligence is big these days. It hardly fits into the typical boundaries of other technology upgrades in the digital space—and, it shouldn’t. AI is a general-purpose technology, like steam power, electricity, the internet, and all the other novelties that sparked industrial revolutions and made the world better in certain aspects, worse in others, and undoubtedly different from before. This forces many of us to think and talk about AI. For better or worse, we find our- selves immersed in an ongoing debate on social media about artificial intelligence, its magical promises, and embarrassing shortcomings. Yet, only a few people are actually in a position to go beyond the “talk” and the more or less grounded opinions about AI, and to know enough about AI to build something useful with it, test it themselves, feel its limitations, and anticipate its real potential. It’s like the world is split into two different groups: those who talk about AI and those who make something useful with it. I wrote this book to empower people to move to the second group. AI is one of those things that you only fully understand when you find yourself build- ing with it. Let me give you an example. Everyone talks about AI agents these days. Beyond the shallow promise of AI agents “automating stuff,” there’s a much more pro- found, complex, and certainly more promising opportunity to rethink the way companies and individuals operate. But the only way to visualize how this is done is to try to do it yourself. In the case of agentic AI, for instance, you need to understand the looped behav- ior of agents, their need for context, and the requirement to create a versatile toolbox for them to operate in the real world. In this book, you learn how agents think, how to give them instructions, and how to provide them with the right context; you build tools for them to act in the real world; and you create groups of agents and experiment with them to see how they can cooperate on what really matters to you. To be clear, you can’t have a custom behavior with a general-purpose tool such as ChatGPT, Copilot, or Claude: you need to build a custom application to see agentic AI serve a specific, repeatable need. This is what you’ll learn to do in this book. preface Licensed to malky vidal <malkyvidal@gmail.com>
Page 15
xiv preface From my experience as an AI advisor, researcher, and teacher, when you build something custom with AI, most of the time is spent on what you wouldn’t expect. Firstly, you spend a significant amount of time ingesting and preprocessing documents and datasets (definitely more time than you want, given that this part isn’t the sexiest and might be boring). Secondly, you invest a lot of time visualizing how the application should operate, its logical flow, and the order and composition of the prompts and instructions required at each step. The actual cod- ing is somewhat of a consequence of this high-level design. Of course, AI coding assistants can also help write code, provided you have a very good idea of how the application should work, what data and knowledge it should use, and what output it should produce. This is why instead of writing a coding-first book (listing the ever-changing Python libraries supporting AI development), I decided to write a design-first book where the focus is to understand what really matters (primitives of AI applications, including agents, tools, retrieval-augmented generation [RAG], prompt engineering), make it happen with a low-code application (such as Langflow), and then deploy it or see how it could be rendered with Python code. This isn’t just to make it easier for you. I followed this approach because I’ve seen with former students that it really unleashes their creativity and potential, regardless of their tech- nical background or coding literacy. Actually, I’ve noticed that business experts, such as mar- keting managers, sales representatives, web designers, HR professionals, lawyers, and so on, are often best positioned to design AI applications that meet their specific needs. This book enables them to move from an idea to a prototype rapidly. I hope you’re enjoying the feeling of getting your hands dirty in AI. By the last page of this book, you’ll have crafted a list of projects to bring to life over the next weeks and months. Ultimately, this is why I wrote this book—to make you a maker of AI applications. Enjoy the ride! Licensed to malky vidal <malkyvidal@gmail.com>
Page 16
xv As I started writing this book, I knew it would be no easy quest. The topic has been (and will be) evolving so rapidly that it has required continuous effort to balance offering solid frameworks with exploring technical novelties. No doubt I would never have been able to make it work by myself. At the end of the ride, I feel pervaded by a strong sense of grati- tude and debt toward the many people who made this happen. Writing this book has been possible only thanks to the eye-opening input, the rigorous feedback, and the heartfelt encouragement of so many wonderful people. Although writ- ing the names of some of them doesn’t do them full justice, let me thank Dimitrios Skoufakis, Michele Pacifico (how could I do without his brilliant advice?), Adam Graham, Alessio Villardita, Giuseppe Papaianni, Michael Berthold, Daniele Abbate, Jamilya Baimukhambetova, Roberto Bellotti, Marcello Lando, Fabio Pistilli, Gilberto Grasso, Leonardo Fenizi, Mario Galietti, Nicola Lopez, Antonio Fazzari, Luca Merlo, Nicolas Kerling, Paolo Palazzo, Lorenzo Ricciardi Celsi, Rosaria Silipo, Ermanna Maiuri, Marcin Czajkowski, Alberto Montanari, Tom Davenport, Michelangelo Ferraro, Guy Peri, and all the other amazing friends, colleagues, and leaders who have passionately worked along- side me to create sustainable value by putting AI and data analytics genuinely at the ser- vice of people and the real problems they face at work. It would have been impossible for me to address this subject without having the oppor- tunity to investigate it systematically alongside my many precious partners in academic research and university teaching: my fellow faculty members at LUISS Guido Carli and the other universities and business schools where I teach—Irene Finocchi, Davide D’Emiliano, Alessio Di Leo, Enzo Peruffo, Paolo Peverini, Mauro Sozio, Giuseppe (Pino) Italiano, Simone Malacaria, Mario Miozza, Antonio Gatto, Adham Kahlawi, Valentina Poggioni, Mohamed Almgerbi, Andrea Sestino, Paola Demartini, Cristiano Ciappei, Luca Petruzzellis, Pasquale Del Vecchio, Gaetano Cascini, Nikos Tsourakis, Domenico Vistocco, Dogan Duven, Marco Greco, and Michele Grimaldi. A deeply heartfelt, sepa- rate thank you goes to my dear students, whose questions, curiosity, hard research work, acknowledgments Licensed to malky vidal <malkyvidal@gmail.com>
Page 17
xvi acknowledgments and thoughtful challenges in the classroom have taught me far more than I could ever teach them. The team at Manning has proven to be a well-oiled “machine” of quality knowledge cre- ation. As an author, I felt greatly supported throughout the entire process. The number and the quality of people involved have exceeded all of my expectations. Starting with Michael (Mike) Stephens, my acquisitions editor: he managed to make the idea behind this book grow and pivot dramatically to be always aligned with what matters to the readers, keeping them at the core of everything we put in the book. Rebecca Johnson, my development editor, has guided me through the process and shown a great deal of patience with me and my writing. I also want to thank the author of the foreword, Rodrigo Nader, one of the true visionaries of modern GenAI, whose contribution to this book has been genuinely enriching. I am equally indebted to the technical editor, Rohit Agarwal, whose precise, complete, and remarkably thorough work made the book far more robust. He could hardly have been a better fit for the role: as Chief AI Officer at Bizom, where he leads a team of data scientists and software engi- neers focused on transforming retail analytics through advanced GenAI and deep learning techniques, Rohit sees every day how AI applications make a real difference. My gratitude extends to Julie McNamee, Kathy Rossland, Aleksandar Dragosavljevic, Aira Dučić, Christina Rudloff, and the many reviewers who have improved the text: Ade- mílson F. Tonato, Adetunji Onafuwa, Afshaan Mazagonwalla, Aidas Liaudanskas, Aishwarya Ray, Alex McLintock, Alexander Blinov, Alfons Muñoz, Andrew Freed, Ankush Rastogi, Avinash Tiwari, Banani Mohapatra, Brandon Abshire, Christopher Brousseau, Dana Robinson, Denis Chiriac, Diganta Sen Gupta, Erico Lendzian, Eugen Istschuk, Felipe Provezano Coutinho, Fernando Kobayashi, Govind Tatachari, Hanusha Durisety, Heather Ward, Hongming Zheng, Jay Mehta, Jerry Kuch, Jose Joaquin Morales Aragon, Joseph Godfrey Nixon Homer, Julien Pohie, Karl-Gustav Kallasmaa, Karsten Strøbaek, Lin Zhang, Meetu Malhotra, Michael Scarborough, Michele Santoro, Najam Uddin, Naveen Krishnan, Nicolas Bievre, Oluwatoyin Rebecca Aromokeye, Pankaj Verma, Peter Bishop, Rajeev Kumar, Roberto Infante, Rodney Weis, Rolando Madonna, Sai Chaitanya, Sanjay Devnani, Sanjeev Jaiswal, Sarayut Nonsiri, Srinath Chandramohan, Stefan Papp, Sumeer Basha Peta, Thomas Tellner, Tom Calhoon, Wei-Meng Lee, Yanqi Luo, and Zorodzayi Mukuya. A very special thanks goes to Ines Schweigert, the artist of the brilliant illustrations for the book: a software developer and automation expert with the rare gift of holding clarity, humor, and technical depth all at once. Ines has been the closest creative partner this book could have ever wished for, and I’m sure that, without her art, these pages would have been infinitely less fun and effective. Finally, my deepest thanks go to my family and—above all—Sławka, for her patience and for being the great, inspirational writer she is. Without her support, this book would simply not have been possible. Licensed to malky vidal <malkyvidal@gmail.com>
Page 18
xvii This book is a hands-on, design-first guide to understanding AI and building real AI applications. From chapter 2 onward, each chapter includes a full, step-by-step tutorial that takes you from a blank canvas to a working app: a virtual customer service assistant, a marketing advisor, a travel planner, a CRM-powered personalization engine, and more. The goal is for you to learn by doing—experiencing firsthand what it means to design, build, and deploy end-to-end AI solutions that solve problems. The focus is on the durable parts of AI development. Prompt engineering, retrieval- augmented generation (RAG), agentic structures, tool design, and orchestration are the “primitives” of any AI application, and they will outlast any specific library or framework. By mastering them, you give yourself a foundation that stays relevant as the technology around you keeps changing. To keep the journey enjoyable, fast, and accessible, the tutorials are built using two low-code environments: Langflow and KNIME. The concepts and patterns you’ll learn translate naturally to any tool or codebase you choose to work in later. By the last page, you’ll have a portfolio of working apps you can adapt to your own needs and a clear men- tal model for designing many more. Who should read this book The book is written for two primary categories of readers: • The first group includes individuals with computer literacy and a keen interest in AI, but without specialized AI coding skills. They may be web programmers, data enthusiasts, or Python coders without experience in developing AI applications. Typical roles include web developers, AI hobbyists, aspiring data scientists, and tech professionals looking to expand their skill set into AI development quickly. about this book Licensed to malky vidal <malkyvidal@gmail.com>
Page 19
xviii about this book • The second group includes nontechnical readers who want to understand how LLM chain design and orchestration work, so they can apply AI in their jobs. They aren’t looking to switch careers; instead, they want to partner more effectively with AI in their existing professions. They also want firsthand experience with the potential of AI so they can guide their technical colleagues on what they need. This group includes managers and other non-IT staff in various industries who view AI as a strategic asset in their work and seek hands-on experience partnering with machine intelligence. For the Python developers among you, every chapter from chapter 2 onward includes a “What if we coded it?” section that translates the chapter’s tutorial into a fully commented Python script, so you can immediately reapply the concepts in your own code and pick up the rele- vant libraries along the way. How this book is organized: A road map Your journey in building AI applications is organized in eight chapters, designed to take you by the hand through a gradually steeper path. • In chapter 1, you get a first peek inside Large Language Models, the “engines” of AI applications that generate text. Instead of going through the complex math behind these models, you build an intuition of how they are built so that you’re aware of both their potential and inherent limitations, which stem from their probabilistic nature. • Chapter 2 gets you straight into the game: it introduces system messages, which let you customize your app’s behavior and gives you a head start with Langflow, the environment we’ll use throughout the book. By the end of the chapter, you’ll have built your first virtual assistant with a customized personality. • In chapter 3, you’ll learn the “art and science” of prompt engineering, going through a proven methodology to write effective prompts and a series of enhancement techniques to boost their performance. You’ll build a more complex assistant that uses two adversarial roles to refine the AI’s output until it meets your precise needs. • Chapter 4 introduces retrieval-augmented generation (RAG), a fundamental technique that grounds AI answers in real documents. The chapter takes you through the full process of ingesting documents of any type into a vector database; by the end, you’ll have built a customer assistant that answers questions related to a specific business. • In chapter 5, you enter the world of agentic AI to extend your app’s capabilities. You’ll learn how agents behave, what tools are, and how to equip agents with multiple Licensed to malky vidal <malkyvidal@gmail.com>
Page 20
about this book xix tools; you’ll build a virtual travel operator that autonomously builds travel itineraries, surfing the web and consulting Wikipedia. • Chapter 6 takes agents to the next level, showing you how to build agentic structures— groups of agents that interact with each other to solve complex problems. Like an HR director, you’ll assemble agentic teams, and you’ll put this into practice by building a full virtual copywriting team that generates coherent social media marketing posts. • In chapter 7, you’ll explore how to integrate GenAI flows into complex data sources and systems. By using both Langflow and KNIME, you’ll build an application that systematically pulls data from an external database and uses a large language model (LLM) to do something useful with it—specifically, a machine that taps a customer relationship management (CRM) database to generate hyper-personalized messages for each individual customer. • Finally, chapter 8 shows you how to deploy your applications in the real world so that everyone can use them, how to monitor their behavior continuously (with the help of observability tools), and how to use agent protocols to connect your applications to existing environments and reuse capabilities. The final tutorial pulls together some of the assistants you’ve built throughout the book into a more complex service that emails travel itineraries along with matching recipes. The chapters are organized in order of increasing complexity and build on each other, so I recommend you follow their order and complete all of the tutorials included. Even if you might not see immediate value in a particular tutorial—for example, an agent that writes recipes—all the tutorials serve as templates you can reuse and adapt to build custom applica- tions tailored to your specific needs. I strongly suggest you do them all. About the code This book contains many examples of source code both in numbered listings and in line with normal text. In both cases, source code is formatted in a fixed-width font like this to sep- arate it from ordinary text. Sometimes code is also in bold to highlight code that has changed from previous steps in the chapter, such as when a new feature adds to an existing line of code. In many cases, the original source code has been reformatted; we’ve added line breaks and reworked indentation to accommodate the available page space in the book. In rare cases, even this wasn’t enough, and listings include line-continuation markers (➥). Additionally, comments in the source code have often been removed from the listings when the code is described in the text. Code annotations accompany many of the listings, highlighting import- ant concepts. Licensed to malky vidal <malkyvidal@gmail.com>
The above is a preview of the first 20 pages. Register to read the complete e-book.

Recommended for You

Loading recommended books...
Failed to load, please try again later

Tip the Site

Scan the WeChat Pay or Alipay code to tip. No login required.

WeChat Pay
Alipay
← Back to List