Build multi-agent systems with ADK
1. Build multi-agent systems with ADK
Next, let's find out how to build multi-agent systems with Google's Agent Development Kit. The key idea here is that there is a structure of parent and sub-agents constructed in a tree. Agents can only transfer the conversation to sub-agents, back to a parent, or to a peer (another agent that shares the same parent). You can disable transferring to peers on an agent-by-agent basis. This tree structure makes conversations more predictable and reliable. As an alternative, if you could transfer to any agent, and two agents in different parts of your system were each responsible for certain lookup activities, it might be very easy to call the wrong agent. With this approach, only the lookup agent related to your part of the conversation will be invoked. LLM-based Agents are the "brains" of your application, bringing intelligence and adaptability to your system. They leverage the capabilities of Large Language Models to understand and respond to natural language, make decisions, and utilize tools effectively. They typically alternate turns of conversation with users. When you want multiple agents to be able to act without waiting on user turns in between each agent, workflow agents create flows directly from agent to agent. They are not powered by LLMs directly for their core function but act as directors, ensuring tasks are performed in the desired sequence and under specific conditions. Workflow agents control the flow of the context between their sub agents. They don't have a large language model associated, as they don't reason themselves. Workflow agents typically result in deterministic workflow execution. This means that for a given input and configuration, the sequence of agents executed will always be the same. This predictability is valuable for structured processes where consistent and reliable execution is crucial. The ADK provides a few types of workflow agents: Sequential-Agent, Loop-Agent and Parallel-Agent. You can also build a custom workflow agent. Let's explore these workflow agents in a bit more detail. Sequential Agents execute a predefined list of agents one-after-another in a specific order. For example, a workflow to "Process a new order" might sequentially execute: "Order Validation Agent", "Inventory Check Agent", "Payment Processing Agent", and "Order Confirmation Agent." Loop Agents repeatedly execute a set of agents until a certain condition is met. Use the Loop Agent when your workflow involves tasks requiring iterative refinement, continuous monitoring, cyclical processes, or simulated negotiation. For example, a "Research Agent" might loop through a series of agents to find new data, analyze it, and ask if it has answered a specific question sufficiently or needs to pull more data (repeating the loop). Parallel Agents can run multiple agents simultaneously. This can significantly speed up tasks that can be broken down into independent sub-tasks. This approach is particularly beneficial for operations like multi-source data retrieval or heavy computations, where parallelization yields substantial performance gains. Importantly, this strategy assumes no inherent need for shared state, or direct information exchange between the concurrently executing agents. For example, a Parallel Agent could execute several "Report Generation Agents" in parallel, each responsible for a different region. Custom workflow agents in the Agent Development Kit allow you to define arbitrary orchestration logic, going beyond the predefined patterns of Sequential, Loop, and Parallel Agents. This provides maximum flexibility for complex workflows, stateful interactions, and integrating custom business rules.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.