AI Agents The Illustrated Guidebook (Avi Chawla, Akshay Pachaar)(Z-Library)
,
AI
A book about AI agents, with figurative illustrations to guide you through the basics and depths of knowledge of AI agent mechanics, design, and implementation.
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
FREE AI AGENTS 2025 EDITION THE ILLUSTRATED GUIDEBOOK Avi Chawla & Akshay Pachaar D a i l y D o s e o f D S . c o m Daily Dose of Data Science
Page
2
DailyDoseofDS.com How to make the most out of this book and your time? The reading time of this book is about 8 hours. But not all chapters will be of relevance to you. This 2-minute assessment will test your current expertise and recommend chapters that will be most useful to you. Scan the QR code below or open this link to start the assessment. It will only take 2 minutes to complete. https://bit.ly/agents-assessment 1
Page
3
DailyDoseofDS.com Table of contents AI Agents....................................................................................................... 4 What is an AI Agent?...................................................................................5 Agent vs LLM vs RAG...................................................................................8 LLM (Large Language Model)..............................................................................8 RAG (Retrieval-Augmented Generation).........................................................9 Agent.............................................................................................................................. 9 Building blocks of AI Agents.....................................................................10 1) Role-playing...........................................................................................................10 2) Focus/Tasks............................................................................................................ 11 3) Tools.......................................................................................................................... 11 #3.1) Custom tools.................................................................................................. 12 #3.2) Custom tools via MCP...............................................................................17 4) Cooperation...........................................................................................................21 5) Guardrails.............................................................................................................22 6) Memory................................................................................................................. 22 5 Agentic AI Design Patterns...................................................................24 #1) Reüection pattern..........................................................................................25 #2) Tool use pattern.............................................................................................25 #3) ReAct (Reason and Act) pattern........................................................... 26 #4) Planning pattern........................................................................................... 28 #5) Multi-Agent pattern.....................................................................................29 5 Levels of Agentic AI Systems................................................................30 #1) Basic responder................................................................................................31 #2) Router pattern.................................................................................................31 #3) Tool calling.......................................................................................................32 #4) Multi-agent pattern.....................................................................................32 #5) Autonomous pattern....................................................................................33 2
Page
4
DailyDoseofDS.com AI Agents Projects.....................................................................................34 #1) Agentic RAG...........................................................................................................35 #2) Voice RAG Agent..................................................................................................41 #3) Multi-agent Flight ûnder................................................................................ 46 #4) Financial Analyst.................................................................................................54 #5) Brand Monitoring System................................................................................ 59 #6) Multi-agent Hotel Finder.................................................................................67 #7) Multi-agent Deep Researcher........................................................................75 #8) Human-like Memory for Agents...................................................................82 #9) Multi-agent Book Writer................................................................................. 89 #10) Multi-agent Content Creation System.....................................................98 #11) Documentation Writer Flow.........................................................................106 #12) News Generator................................................................................................ 112 3
Page
5
DailyDoseofDS.com AI Agents 4
Page
6
DailyDoseofDS.com What is an AI Agent? Imagine you want to generate a report on the latest trends in AI research. If you use a standard LLM, you might: 1. Ask for a summary of recent AI research papers. 2. Review the response and realize you need sources. 3. Obtain a list of papers along with citations. 4. Find that some sources are outdated, so you reûne your query. 5. Finally, a܀昀er multiple iterations, you get a useful output. This iterative process takes time and eûort, requiring you to act as the decision-maker at every step. Now, let9s see how AI agents handle this diûerently: A Research Agent autonomously searches and retrieves relevant AI research papers from arXiv, Semantic Scholar, or Google Scholar. 5
Page
7
DailyDoseofDS.com ï A Filtering Agent scans the retrieved papers, identifying the most relevant ones based on citation count, publication date, and keywords. ï A Summarization Agent extracts key insights and condenses them into an easy-to-read report. ï A Formatting Agent structures the ûnal report, ensuring it follows a clear, professional layout. 6
Page
8
DailyDoseofDS.com Here, the AI agents not only execute the research process end-to-end but also self-reûne their outputs, ensuring the ûnal report is comprehensive, up-to-date, and well-structured - all without requiring human intervention at every step. To formalize AI Agents are autonomous systems that can reason, think, plan, ûgure out the relevant sources and extract information from them when needed, take actions, and even correct themselves if something goes wrong. 7
Page
9
DailyDoseofDS.com Agent vs LLM vs RAG Let9s break it down with a simple analogy: ï LLM is the brain. ï RAG is feeding that brain with fresh information. ï An agent is the decision-maker that plans and acts using the brain and the tools. LLM (Large Language Model) An LLM like GPT-4 is trained on massive text data. It can reason, generate, summarize but only using what it already knows (i.e., its training data). 8
Page
10
DailyDoseofDS.com It9s smart, but static. It can9t access the web, call APIs, or fetch new facts on its own. RAG (Retrieval-Augmented Generation) RAG enhances an LLM by retrieving external documents (from a vector DB, search engine, etc.) and feeding them into the LLM as context before generating a response. RAG makes the LLM aware of updated, relevant info without retraining. Agent An Agent adds autonomy to the mix. It doesn9t just answer a question4it decides what steps to take: Should it call a tool? Search the web? Summarize? Store info? An Agent uses an LLM, calls tools, makes decisions, and orchestrates workûows just like a real assistant. 9
Page
11
DailyDoseofDS.com Building blocks of AI Agents AI agents are designed to reason, plan, and take action autonomously. However, to be eûective, they must be built with certain key principles in mind. There are six essential building blocks that make AI agents more reliable, intelligent, and useful in real-world applications: 1. Role-playing 2. Focus 3. Tools 4. Cooperation 5. Guardrails 6. Memory Let9s explore each of these concepts and understand why they are fundamental to building great AI agents. 1) Role-playing One of the simplest ways to boost an agent9s performance is by giving it a clear, speciûc role. A generic AI assistant may give vague answers. But deûne it as a <Senior contract lawyer,= and it responds with legal precision and context. Why? Because role assignment shapes the agent9s reasoning and retrieval process. The 10
Page
12
DailyDoseofDS.com more speciûc the role, the sharper and more relevant the output. 2) Focus/Tasks Focus is key to reducing hallucinations and improving accuracy. Giving an agent too many tasks or too much data doesn9t help - it hurts. Overloading leads to confusion, inconsistency, and poor results. For example, a marketing agent should stick to messaging, tone, and audience not pricing or market analysis. Instead of trying to make one agent do everything, a better approach is to use multiple agents, each with a speciûc and narrow focus. Specialized agents perform better - every time. 3) Tools Agents get smarter when they can use the right tools. But more tools b better results. 11
Page
13
DailyDoseofDS.com For example, an AI research agent could beneût from: ï A web search tool for retrieving recent publications. ï A summarization model for condensing long research papers. ï A citation manager to properly format references. But if you add unnecessary tools4like a speech-to-text module or a code execution environment4it could confuse the agent and reduce eûciency. #3.1) Custom tools While LLM-powered agents are great at reasoning and generating responses, they lack direct access to real-time information, external systems, and specialized computations. Tools allow the Agent to: ï Search the web for real-time data. ï Retrieve structured information from APIs and databases. ï Execute code to perform calculations or data transformations. ï Analyze images, PDFs, and documents beyond just text inputs. 12
Page
14
DailyDoseofDS.com CrewAI supports several tools that you can integrate with Agents, as depicted below: However, you may need to build custom tools at times. In this example, we're building a real-time currency conversion tool inside CrewAI. Instead of making an LLM guess exchange rates, we integrate a custom tool that fetches live exchange rates from an external API and provides some insights. Below, let's look at how you can build one for your custom needs in the CrewAI framework. Firstly, make sure the tools package is installed: 13
Page
15
DailyDoseofDS.com You would also need an API key from here: https://www.exchangerate-api.com/ (it's free). Specify it in the .env ûle as shown below: Once that's done, we start with some standard import statements: Next, we deûne the input ûelds the tool expects using Pydantic. 14
Page
16
DailyDoseofDS.com Now, we deûne the CurrencyConverterTool by inheriting from BaseTool: Every tool class should have the _run method which we will execute whenever the Agents wants to make use of it. For our use case, we implement it as follows: In the above code, we fetch live exchange rates using an API request. We also handle errors if the request fails or the currency code is invalid. Now, we deûne an agent that uses the tool for real-time currency analysis and attach our CurrencyConverterTool, allowing the agent to call it directly if needed: 15
Page
17
DailyDoseofDS.com We assign a task to the currency_analyst agent. Finally, we create a Crew, assign the agent to the task, and execute it. Printing the response, we get the following output: Works as expected! 16
Page
18
DailyDoseofDS.com #3.2) Custom tools via MCP Now, let9s take it a step further. Instead of embedding the tool directly in every Crew, we9ll expose it as a reusable MCP tool4making it accessible across multiple agents and ûows via a simple server. First, install the required packages: We9ll continue using ExchangeRate-API in our .env ûle: We9ll now write a lightweight server.py script that exposes the currency converter tool. We start with the standard imports: Now, we load environment variables and initialize the server: 17
Page
19
DailyDoseofDS.com Next, we deûne the tool logic with @mcp.tool(): This function takes three inputs4amount, source currency, and target currency4and returns the converted result using the real-time exchange rate API. To make the tool accessible, we need to run the MCP server. Add this at the end of your script: 18
Page
20
DailyDoseofDS.com This starts the server and exposes your convert_currency tool at: http://localhost:8081/sse. Now any CrewAI agent can connect to it using MCPServerAdapter. Let9s now consume this tool from within a CrewAI agent. First, we import the required CrewAI classes. We9ll use Agent, Task, and Crew from CrewAI, and MCPServerAdapter to connect to our tool server. Next, we connect to the MCP tool server. Deûne the server parameters to connect to your running tool (from server.py). Now, we use the discovered MCP tool in an agent: This agent is assigned the convert_currency tool from the remote server. It can now call the tool just like a locally deûned one. 19
The above is a preview of the first 20 pages. Register to read the complete e-book.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
AI guide
【One-Line Pitch】
A visual, hands-on field guide that takes you from "what is an AI agent?" to shipping multi-agent apps with CrewAI, MCP, and local LLMs—ideal for developers and technical readers who learn best by building.
【Book Arc】
- **Opening (~0%–8%)**: Frames the vocabulary—what an agent is, and how it differs from a bare LLM and from RAG—then lays out the six building blocks (role-playing, focus, tools, cooperation, guardrails, memory) and previews the design patterns and maturity levels to come.
- **Early (~8%–33%)**: Deepens the building blocks, especially tools (custom tools and tools exposed via MCP) and guardrails, while introducing the five agentic design patterns (Reflection, Tool Use, ReAct, Planning, Multi-Agent) and the five levels of agentic systems from basic responder to autonomous.
- **Middle (~33%–58%)**: Shifts from concepts to construction, walking through worked projects such as an agentic RAG pipeline and a real-time voice RAG agent, with concrete tech stacks (CrewAI, Firecrawl, LitServe, LlamaIndex, LiveKit) and step-by-step setup.
- **Late (~58%–83%)**: Scales up to multi-agent workflows—flight and hotel finders, a brand-monitoring system, a local "deep researcher" alternative, and a memory-equipped agent using Zep—each built end to end with local models served through Ollama.
- **Ending (~83%–100%)**: Caps off with orchestration-heavy builds like a book-generation Flow (outline crew plus parallel writer crews) and packaging agents as MCP tools, closing the loop from single agent to reusable, connected system.
【Book Arc note】 The excerpts do not cover the final pages in detail; the ending is inferred from the last projects shown.
【Key Takeaways】
- **Agent ≠ LLM ≠ RAG** (Early): the LLM is the "brain," RAG feeds it fresh information, and the agent is the decision-maker that plans and acts with tools—this distinction anchors everything else.
- **Six building blocks make agents reliable** (Early): role-playing, focus/tasks, tools, cooperation, guardrails, and memory are presented as the design checklist for real-world agents, not optional extras.
- **Tools are where agents touch the world** (Early): custom tools and MCP-exposed tools let agents search, call APIs, run code, and read documents—but adding unnecessary tools confuses the agent and hurts efficiency.
- **Guardrails are non-negotiable** (Early): limiting tool use, validation checkpoints, and fallback/human review prevent hallucination, endless loops, and bad calls.
- **Five design patterns form the mental toolkit** (Early–Middle): Reflection, Tool Use, ReAct (Thought→Action→Observation loops), Planning, and Multi-Agent—ReAct in particular underlies how frameworks like CrewAI operate.
- **Agentic systems mature along five levels** (Middle): from basic responder and router through tool calling and multi-agent to fully autonomous code-generating agents—useful for scoping ambition.
- **The book is build-first** (Middle–Late): nearly every concept lands in a runnable project with a named stack, from agentic RAG and voice agents to travel finders and a local deep researcher.
- **Local and open tooling is a running theme** (Late): DeepSeek-R1 and Qwen served via Ollama, plus MCP servers connected to hosts like Cursor, show how to build capable agents without closed APIs.
【Reading Tips】
- **Skim the concept chapters, deep-read the builds**: the opening building-blocks and design-pattern sections are quick orientation; slow down on the project walkthroughs where the real learning is.
- **Type along with at least two projects**: pick one mid-book build (agentic RAG or voice agent) and one late-book multi-agent build; the code is the point.
- **Treat the tech stacks as templates, not mandates**: CrewAI, Firecrawl, LitServe, and Ollama recur, but the patterns transfer to other frameworks—extract the workflow, not just the API calls.
- **Watch for hard spots**: MCP server setup, voice activity detection, and multi-crew orchestration are the densest sections; expect to debug environment and API-key issues.
- **Keep the six building blocks and five patterns as a checklist** you return to when designing your own agent.
【Coverage Limits】
This guide is based on stratified excerpts covering the table of contents, conceptual chapters, and most project walkthroughs; the final pages and some code details are not fully represented, so specifics of the closing projects are summarized rather than verified line by line.
Passage locations
Excerpt 1
书名: AI Agents The Illustrated Guidebook (Avi Chawla, Akshay Pachaar) (z-library.sk, 1lib.sk, z-lib.sk) 作者: Avi Chawla, Akshay Pachaar A book about AI agents,...
View in text
Page 7
ights and condenses them into an easy-to-read report. ï A Formatting Agent structures the ûnal report, ensuring it follows a clear, professional layout. 6 Da...
View in text
Excerpt 3
s meet predeûned criteria before moving to the next step. ï Establishing fallback mechanisms: If an agent fails to complete a task, another agent or human re...
View in text
Excerpt 4
r query and pass it to the Crew deûned earlier to generate a response from the model. Check the highlighted code below: #7) Encode response Here, we can post...
View in text
Recommended for You
{{#thumbnailUrl}}
{{/thumbnailUrl}}
{{^thumbnailUrl}}
{{/thumbnailUrl}}
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