Architecting multi-agent systems

By Google Cloud Tech

Share:

Key Concepts

  • AI Agents: Autonomous entities capable of performing tasks, often leveraging Large Language Models (LLMs).
  • Monolithic AI Scripts: Single, large blocks of code containing AI logic, difficult to integrate into production systems.
  • Distributed AI System: A system composed of multiple, independent AI agents (microservices) working together.
  • Google Agent Development Kit (ADK): A framework for building AI agents, utilizing patterns like loop and sequential agents.
  • Agent-to-Agent (A2A) Protocol: A communication protocol enabling AI agents to interact using standard web protocols.
  • Pydantic: A data validation and settings management library used to enforce structured output from AI agents.
  • Loop Agent: An agent designed to iteratively refine a task until a specific condition is met (e.g., the Judge agent).
  • Sequential Agent: An agent that executes a series of tasks in a predefined order.

The Problem with Current AI Agent Architectures

The speaker highlights a common issue: many promising AI agents remain confined to development environments (Jupiter notebooks, local scripts) due to integration difficulties. The core problem isn’t the agent’s capability, but its architecture. Traditional, monolithic AI scripts are ill-suited for integration with existing production applications, frontends, and backends. These monolithic structures don’t “play nicely” with modern systems.

Building for Integration: A Distributed Team of Specialists

The proposed solution is to build an AI system designed from the outset for integration. This involves creating a “distributed team of specialists” – a collection of independent AI agents functioning as microservices. The example application used to demonstrate this is a “course creator,” an AI agent system designed to plug into a standard web frontend.

The Course Creator Agent Team & Workflow

The course creator system consists of three key agents:

  1. Researcher Agent: Responsible for finding and summarizing relevant information. It utilizes the Gemini 2.5 model and the Google Search tool. Its instruction is highly focused: “Find data. Summarize it.”
  2. Judge Agent: Critically evaluates the research provided by the Researcher Agent. This agent is described as “surprisingly picky” and operates in a loop, repeatedly assessing the data until it meets a defined standard.
  3. Content Builder Agent: Takes the validated information from the Judge Agent and generates the final course content, which is then streamed back to the user.

The workflow is sequential and iterative: Researcher -> Judge (loop) -> Content Builder -> User.

Leveraging Google ADK and A2A Protocol

The system is built using Google’s Agent Development Kit (ADK). The ADK facilitates the creation of specialized agents using patterns like the “loop agent” (Judge) and “sequential agent” (overall workflow). Crucially, the agents communicate using the Agent-to-Agent (A2A) protocol, allowing them to interact over standard web protocols. This architecture treats each agent as a microservice, simplifying integration with existing applications that already know how to communicate with microservices.

Ensuring Reliable Output with Pydantic

A key challenge in automated workflows is ensuring agents provide consistent and reliable output. The speaker emphasizes the importance of avoiding ambiguous responses like “maybe” or “it depends.” To address this, the ADK is used in conjunction with Pydantic. Pydantic allows developers to define a strict output schema (e.g., a “judge feedback model”) that must return a literal “pass” or “fail.” This enforces “type safety for your AI,” guaranteeing structured output.

Testing and Debugging with the ADK Playground

The ADK includes a built-in playground for testing individual agents. This allows developers to feed agents input (even deliberately flawed input) and verify that they produce the expected, structured output. For example, the Judge agent was tested with fabricated research to confirm it correctly returned a “fail” result in structured JSON format. This simplifies debugging compared to troubleshooting issues within a complex, integrated workflow.

Recap and Key Principles

The speaker summarizes the core principles employed:

  • Focused Agents: Each agent has a single, well-defined responsibility.
  • Structured Output: Pydantic schemas enforce reliable, structured output from agents, particularly the Judge.
  • Individual Verification: Agents are tested and verified independently before integration.

Transition & Future Steps

The segment concludes with the agents being “hired” and the need to establish a communication mechanism between them, setting the stage for further development and demonstration. The speaker then says "Bye for now. Heat." indicating a transition or continuation of the demo with another person named Heat.

Chat with this Video

AI-Powered

Load the transcript when you're ready to chat so the initial page stays lighter.

Ready to summarize another video?

Summarize YouTube Video