Design Multi-Agent AI Systems Using MCP and A2A, First Edition
This is the code repository for Design Multi-Agent AI Systems Using MCP and A2A, First Edition, published by Packt.
Engineer your own Python-based agentic AI framework with tool use, memory, and multi-agent workflows
Gigi Sayfan
About the book
Frustrated by opaque agent frameworks that hide how things work? This book gives you complete control by guiding you through building a fully functional, extensible agentic AI framework in Python without relying on external orchestration tools. You’ll begin by implementing a simple tool-using agent, and then gradually extend its capabilities with structured tool schemas, user interfaces, and memory via the Model Context Protocol (MCP). From there, you’ll build collaborative multi-agent systems powered by Agent-to-Agent (A2A) messaging and deploy them in realistic environments. Along the way, you’ll explore secure tool invocation, message routing, observability, and human-in-the-loop workflows. With annotated code, deep engineering insights, and practical deployment patterns, this hands-on guide equips you to build AI agents that reason, plan, act, and adapt, whether you’re shipping production systems or experimenting with cutting-edge LLM-based architectures. Written by Gigi Sayfan, who builds AI agent infrastructure at Perplexity and is a bestselling author with decades of experience in AI and distributed systems, this book gives you the tools and knowledge to engineer your own advanced agentic systems. *Email sign-up and proof of purchase required
Key Learnings
- Design and implement tool-using AI agents from the ground up
- Build modular components for extensible agent frameworks
- Create secure and observable tools with structured inputs
- Integrate agents with chat UIs such as Slack and Chainlit
- Leverage MCP for context handling and agent memory
- Orchestrate collaborative agent workflows using A2A
- Debug and deploy agents in production-like environments
- Explore future-ready agent capabilities and GenUX design
Chapters
| Chapters |
|---|
| Chapter 1: Introduction to Generative AI and AI agents |
| Chapter 2: Understanding How AI Agents Work |
| Chapter 3: A Hands on Walk-Through of a Simple AI Agent |
| Chapter 4: Building a Tool-Based Agentic AI Framework |
| Chapter 5: Implementing Custom Tools |
| Chapter 6: Creating Chat Interfaces Using Slack and Chainlit |
| Chapter 7: Integrating with the Model Context Protocol Ecosystem |
| Chapter 8: Designing Multi-Agent Systems |
| Chapter 9: Implementing Multi-Agent Systems with A2A |
| Chapter 10: Testing, Debugging, and Troubleshooting Multi-Agent Systems |
| Chapter 11: Deploying Multi- Agent Systems |
| Chapter 12: Advanced Topics and Future Directions |
Requirements for this book
Software and Hardware Requirements
Prerequisites
Before getting started, you should have:
- A basic understanding of Python programming
- Familiarity with machine learning concepts
- A basic understanding of large language models (LLMs)
Supported Operating Systems
The examples in this book can be run on:
- Windows
- macOS
- Linux
Required Software
| Software | Version / Requirement | Supported OS |
|---|---|---|
| Python | Python 3.x | Windows, macOS, Linux |
| OpenAI API Key | Required for examples | Windows, macOS, Linux |
You will need access to a Python development environment.
An OpenAI API key is required for many of the examples in the book.
Recommended Hardware
- A machine with at least 8 GB of RAM is recommended for running more complex examples.
Additional Notes
If you are using the digital version of this book, we recommend typing the code manually or accessing it directly from the book’s GitHub repository (link provided in the next section).
This helps avoid errors that may occur from copying and pasting code.
Get to know Author
Gigi Sayfan is a member of the AI agents infra team at Perplexity, focused on building large-scale environments and harnesses for AI agents. He brings over 30 years of software development experience across domains, including instant messaging, chip fabrication process control, embedded multimedia for game consoles, brain-inspired machine learning, custom browser development, web services for distributed 3D game platforms, IoT sensors, and virtual reality. He has written production code in Go, Python, Java, C#, C++, and TypeScript/JavaScript. His expertise includes AI agents, generative AI, cloud-native technologies, DevOps, databases, networking, and distributed systems. Gigi has authored books and articles on Kubernetes and microservices.
