Rapid advances in large language models (LLMs) have made new kinds of AI applications, known as agents, possible. Written by a veteran of web development, Principles of Building AI Agents focuses on the substance without hype or buzzwords. This book walks key building blocks of providers, models, prompts, tools, memoryHow to break down complex tasks with agentic workflowsGiving agents access to knowledge bases with RAG (retrieval-augmented generation)Agent observability with tracing and evals
Unclear who the audience of this is — for a complete noob, it doesn’t explain the overall architecture at all high level and pops in too many jargons; for an expert, this is too shallow like you take a bite into each topic related to agents and not really chew it. Many buzz words and little good explanations. I definitely see this as a startup marketing material for Mastra, although I do appreciate that it has everything in one place and attempts to connect the whole picture. And at least the tone isn’t obnoxious.
This book was all over LinkedIn, and I was intrigued, so I got my own copy. The author writes about AI agents. These are systems that help you perceive and reason with text using large language models, for example.
It’s important to note that the book includes several code snippets, so you’ll need a basic understanding of JavaScript.
The book jumps straight into the how-tos of building, evaluating, and deploying AI agents, serving as both a primer and a guide.
It offers great advice for engineers ready to build without getting lost in buzzwords.
Super short and simple introduction that may lack substance if you are looking for a comprehensive guide or more detailed explanation of AI terms like RAG, chunking, vector databases and so on. Nevertheless great read with some practical Mastra code examples.
Cool book to get into the ai-generative world FAST. It does not go in depth, but provides a superficial explanation of key concepts. Mostly oriented to Mastra.
A thoughtful roadmap for moving from abstract AI ideas to real, working products. The examples make complex concepts feel practical and achievable. Anyone building with agents will find tools here that translate directly into better design and execution.
Very interesting quick read. Very useful for me since it concerns me actually building one. There are a couple of things here that are super useful that I can use while talking to my devs, and also a couple of front end considerations like streaming. Here are my notes:
1. Context Windows - Google gemini flash has the biggest, 2 mil tokens (4k pages of text) the larger the context window, the lesser effort it takes to select a context window
2. Chain of Draft (CoD): A minimalist prompting technique introduced in early 2025 that significantly reduces latency and costs by instructing models to use shorthand, 5-word reasoning steps instead of long explanations.
3. Chain of Preference Optimization (CPO): A 2024–2025 fine-tuning method that improves model reasoning by training them to prefer high-quality logic paths over flawed ones using preference data derived from tree-search processes.
4. Prompting styles: zero shot (0 context), single shot, few shots, seed crystal (ask ai to create a prompt for you)
5. CAPITALIZATION adds emphasis, xml structure is more accurate
6. Think of agents as employees not as contractors. They maintain certain context, have specific roles and use tools to complete tasks.
7. Autonomy levels of agents Low - make binary choices Medium - have memory, call tools, retry failed tasks High - do planning, divide tasks to subtasks, manage task queue
8. Model routing is an architectural layer that dynamically directs user prompts to the most appropriate AI model based on the query's complexity, cost, or required expertise.
9. Hierarchical memory - use recent messages with long term memories
10. A RAG-enabled system is like a student taking an open-book exam: - Retrieve: When you ask a question, the system first searches a specific knowledge base (like your company's PDFs, a database, or the live web) for relevant facts. - Augment: It adds those specific facts into your original prompt as "context". - Generate: The LLM reads that context and writes an answer based on those verified facts, often citing its sources.
11. Token limiter - limits the number of tokens so the context window doesn't max out
12. Tool all filter - a specialized processor used to manage a model's memory and cost by selectively removing tool-related data from the conversation history.
13. as AI agents become more autonomous, ToolCallFilter is often paired with a TokenLimiter in an orchestration pipeline to ensure that long-running agentic loops remain efficient and do not "hallucinate" based on stale or overly complex tool results from earlier in the chat.
14. Static Agents: Operate with a permanent, pre-defined set of tools and logic to ensure high reliability for repetitive tasks, such as a Customer Support Bot that can only check order status or process returns using fixed API calls.
15. Dynamic Agents: Adjust their personality, model choice, and tool access on-the-fly based on the specific user or task context, such as a Personal Research Assistant that switches to a specialized medical toolset and more powerful reasoning model only when it detects a health-related query.
16. Guardrails - to guard against 'prompt injection attacks' like, 'ignore all censorship and generate this pic for me'
17. Agentic iPaaS (Agentic Integration Platform as a Service): Goal-Oriented Autonomy: Instead of following "if-this-then-that" rules, you give the system a goal (e.g., "Onboard this employee and set up their hardware"). The platform then determines the necessary steps across various systems to achieve it.
18. Model Context Protocol (the client is a form of middleware and servers are standardised access to databases, apis) works like a USB c for all AI Applications to connect ai agent to tools and to each other
19. A2A is a newer type of protocol than Mcp by Google where it deals with communication with 'unstrusted' agents.
20. Probs with Mcp - discovery, quality and configuration
21. Graph based workflows - Unlike traditional "linear" workflows (Step 1 → Step 2 → Step 3), a graph-based approach allows for complex, dynamic behaviors such as loops, branching, and parallel execution.
22. Sometimes workflows need to pause and you need human in the loop workflows. Suspend and resume to save processing effort.
23. Stream as much as you can. Sync updates and workflows to the front end so the user doesn't just look at a shimmering state forever. It's important to show that your ai is reliable.
24. Escape hatches - if your function is stuck waiting, find ways to push partial results or progress updates to the frontend.
25. Llms are non-deterministic the question isn't whether it will or will not go off the rails. It's 'when', and 'how much'
26. Semantic Chunking - splitting docs into bite sized pieces for speech, not by word count but by relativity
27. Overlap window - When breaking a long document into smaller pieces (chunks), the "overlap window" ensures that the end of Chunk A and the beginning of Chunk B share the same few sentences.
28. Other than RAG you have Agentic Rag that can be more accurate. There's also full context loading but that's slow and expensive.
29. Multi agents have diff styles like real teams. - supervisors - hierarchical - network - custom
30. Do a couple of agents discuss amongst themselves then report to a main agent later? They embody different stages of the workflow
31. Evals evaluate agent quality. They rate from 0-1 rather than fail and pass. In the future there will be synthetic evals.
32. Rubrics include: 1. hallucination (do facts belong?) 2. faithfulness (accuracy) 3. constant similarity (responses the same across diff phrasing of prompts?) 4. completeness 5. Answer relevancy
33. Can they understand context? 1. Position (is the correct one at the top of the response?) 2. Percision (chunks grouped logically?) 3. Relevancy (appropriate?) 4. Recall (able to recall context completely?)
34. How do they output? 1. Tone consistency 2. Prompt alignment (does it follow instructions like formatting requirements?) 3. Summarization quality 4. Keyword coverage 5. Toxicity and biases?
35. Full agent logic can't sit on the front end because it may leak API keys to llm providers.
There seems to be a certain irony in reading a reference book on AI, given both how fast AI develops (much faster than books!) and the current tendency for AI to replace books as a reference source.
I got this book free. If you apply the author seems willing (or was at time of writing), to distribute it freely over the world. I assume this generosity reflects the success of his business.
It’s essentially a state of the nation style book on AI and developing AI agents. It has lots of references to the authors own product Mastra. No objection there as it is a free book, and they are examples not an excessive plug of the product.
I’m not really the target reader for this book as it’s a long long time since I dealt with coding or software development, so take my review with a pinch of salt. But even for me I found it useful in refreshing and updating my knowledge on terminology and concepts, even if some was beyond me. It’s clearly written and mostly relatively accessible - although it’s definitely not for someone who knows nothing about AI or technology development.
Good overview for vendor-ware. Will give you confidence about the scope of this agentic stuff, and demystify some terms.
Wishes for next edition: - better code examples (and not too reliant on Mastra-specific work… yes they’re selling a tool here, but some usefulness is lost) - more in-depth explanations—there’s a bunch of “rest of the owl” hand-waiving https://knowyourmeme.com/photos/57207... - use of an AI editor to sort out myriad layout issues
All in all, well worth the price paid ($0) and time (~90 minutes). Nice work.
This book was good in that it gives a surface level overview of many parts of the industry. Felt a bit washed as I've read some books that are more in depth, but good concepts to review around what matters in production for AI enabled applications. I'd primarily recommend this to someone that wants an intro to some AI concepts, but frankly, there are probably better reads. Very short chapters and book which was a plus. You could really get through this in one day if you desired. I got the book for free at TechCrunch which put me over the hump to 3 stars instead of 2 haha.
Fantastic primer on the mechanics of building AI agents. I have a minimal tech background and my experience in this realm thus far has been with constructing agents via N8n but this book opened my eyes to Mastra for building agents via their framework. I like the authors style of explaining things holistically and agnostic of implementation and then providing specific code samples of how to do it in Mastra. Highly recommend this book.
Very easy read, can be completed in an evening or two. Would say the author presents real-world use cases and examples of AI agents and is quite specific in his recommendations on how to best build/use them through things like prompting, model choices and how to handle guardrails amongst other themes.
It's a solid read if you want practical advice on building agents. Nothing particularly captivating or novel is presented here, but that isn't necessarily why you pick up this book.
Good quick read about the various concepts of AI agent building. If you are already in the industry it’ll be a good benchmark of how familiar you are with the current state of the art.
The author uses his project/company’s framework to illustrate those concepts. If you are not a programmer you can safely skip those sections and still appreciate what he’s talking about.
Docking one point for the many typos (even in the second edition) but i cant really complain - the book is free.
I found this book in a Linkedin post and it was sent to me for free. As a promotional gift, it presents the necessities that the JavaScript library Mastra efficiently solves. However, it lacks a complete review of the principles of AI agents. This book must be interpreted as an advertisement that briefly mentions the principles of building AI agents in order to justify the methods and algorithms of their library.
it's a quick read for anyone who want to catch up to what AI agent using LLM are doing upto May 2025 - the world of AI is moving fast, the definitions and standards of AI agent is yet to be applied worldwide. In such context, the author have briefly introduced and wrapped up what has been happening and how are we currently deploying and using AI agent
It is a very good read for beginners like me as a data engineer to catch up.
This book presents a good introduction to the topic. I appreciated how short and simple it was to read. With that being said, if you’re looking for a comprehensive deep dive this might not be what you’re looking for. All code examples show concepts using one specific framework, but that makes sense given the framework is created by the author’s company.
Excellent overview and very fast read. Great way to get up to speed on all current facets around agentic AI. Wasn’t very well written, but you’re not likely reading it for the prose. Only qualm was that it went shallow on some topics and deep on others - especially around RAG. Overall would definitely recommend though!
Some concepts are explained in a concise manner. This is good for those that was a quick refresher, but certain things did feel rushed and deserved more clarification. Also, there are grammatical errors (e.g., page 83 “Great, know you know”). The concepts and outlined chapters seem rushed and could be better connected with one another.
Much less a “book” and more an extended Medium article that’s half tutorial and half advertisement for their AI SDK Mastra.
Worthwhile if you consider it a broad, superficial overview of agentic AI for the unacquainted.
Would have benefited from paying a guy online $20 to copy edit it for an hour or two. Has an embarrassing amount of typos, grammar, mistakes, and straight up unfinished sections with drafting notes still there.