AI agent design patterns

Google Cloud Tech · Beginner ·🤖 AI Agents & Automation ·4mo ago

Key Takeaways

The video covers AI agent design patterns using the Agent Development Kit (ADK), including the Single Agent, Sequential Agent, and Parallel Agent architectures for building AI agentic systems.

Full Transcript

Hi everyone, welcome to this agentic pattern [music] series. So if you building with AI, you probably wonder how to really design the agentic system. Sometimes you need a single agent and other times you need a whole team of them working together. And today we will diving into AI agent design patterns. And each pattern we're going to provide you with practical example of code. And we're also going to walk through a live demo. And by the end of this agendic pattern series, you will learn how to build agentic solution from single agent pattern to different multi- aent pattern. And for today's episode, we will focus on practical examples of single agent, sequential agent, and parallel agent. For next episode, we're gonna cover orchestrator pattern, review and critique pattern with loop agent and agent as tool. All right, let's dive in. So let's begin with the most fundamental pattern, the single agent. Imagine you want to plan a trip. So with a single agent, you want to give it instruction on how to use a tool and we can have a set of tool like how to check the weather, check the traffic and schedule. But for our example today, we will simplify things with only Google search tool. So you will write a comprehensive prompt telling the agent how to plan the trip using the search tool. So the agent then relies on the model's reasoning capability to figure out the sequence of steps. As you can see from the screen, the code for this is very straightforward with ADK agent development kit. And let's test it with ADK web UI by typing ADKVAB. So if I type plan a trip to San Francisco, we can see in the tracing that agent is using the search tool to gather all the necessary information in just one go. We can see how it is using the tool from the tracing tab over here. However, this works for single task. But as you have more tools, all the tasks are getting more complex. For example, if I have a request finding a sushi in San Francisco that's open late and finding the fattest way getting there. So if I build this with single agent, we need to define the logic in system instruction with this massive prom and the behavior can become very unreliable. Since AI is nondeterministic, you cannot always guarantee that you will follow your multistep logic perfectly every time. So the single agent lack of control if is its main weakness with single agent pattern. The benefit is it is very simple to implement and is great for straightforward multi-step tasks. However, it is less reliable for complex workflow and is harder to control and can fill as tasks becoming more complex. Now, let's get to our second part of this video which is the sequential agent. So, with the task we covered earlier, how do we adding more control? This bring us to our first motion pattern. the sequential agent and this pattern is for highly structured repeatable task because the order of the operation is fixed. So the output of one sub aent become the direct input for the next sub aent. It's like an assembly line and for our trip we can break down to two specialized agent. So we have this first a foot finding agent and the second a transportation agent. This sequential agent ensures that we always run this food finding agent first and then this transportation agent next. So this gives us predictable reliable execution. And you can take a look at the screen for this code example of how to write it in sequential agent. All right, let's try it out in ADK web UI. And you can look at the tracing tab. You can see that it's executed the food agent first and then the transportation agent next. Perfect. Uh so how do they communicate with each other? So they share information through this shared session state which act like a shared scratch pad. You can check the session state value at this tab. And once the first agent writes its finding and then the second agent reads it from it by using this curly braces in its system prompt. So this is a form of short-term memory for your agent system. And the advantages of sequential agent is that it has high degree of control and reliability. It is more predictable than a single agent, but it can be very inflexible. This rigid predefined structure can adapt to dynamic situations. Now let's go to the third part of this video, the parallel agent. So what if some tasks don't need to be happen in order? Let's say if I want to plan a full trip need to find a good museum, find a good concert and then a good restaurant. If I doing them in sequential order, it will be slow. This is where the parallel agent pattern really shines. It allows multiple specialized agent to run independently at the same time. We can have three agent museum finder, concert finder, restaurant finder, all searching concurrently. As you can see, this will be a lot faster compared to doing them in sequential order. Of course, after they all find something, we need to bring this results together. So, a common approach is combine this with a sequential agent. So first we will run the search in parallel and then second we will run a final aggregator agent to synthesize all the results in a single trip plan. And here's the agent code on how to put together them. All right, let's test ADK web UI. After we type the question from this tracing tab, we can see three searching agents kick off all at the same time. So once they're done, the results are returned to the session state as you can see from this tab and then the final summarizing agent reset state and generate our plan and this logic is defined in the system prompt over here. As you can see this is a great way to reduce latency for task that can be broken down into independent subtask. So the benefit of this design is very obvious that it significantly reduce latency by running tasks at the same time. However, it can have higher initial cost because it is running multiple agents all at once and in a lot of use case it requires gather or synthesize step to combine the result which can add complexity to our design. All right, let's recap what we covered so far. So we covered the single agent. It is simple to implement. It can be very flexible but it lacks certain control over this whole system. We also cover the sequential agent. It add a certain level of control and make the system more reliable but it is not very flexible. And lastly we covered the parallel agent. It is fast, efficient and great for independent task but it can add cost and complexity to your system. With those pattern you can already build some powerful workflow. And in our next video we're going to level up with more advanced pattern for handling even more complex and dynamic problem. We will explore cases with different practical examples and the pattern we're going to cover next episode including uh the loop and critique pattern for selfcorrection, the coordinator pattern for dynamic routing [music] and also the powerful concept of using agent as a tool. All right, I will see you in [music] next video. Bye. >> [music]

Original Description

Agentic Pattern lab→ https://goo.gle/agenticpattern Multi-Agent Pattern blog → https://goo.gle/multiagentpattern Design agentic pattern → https://goo.gle/agenticpatterndesign Learn how to design and build AI agentic systems! In Part 1 of this series, we use the Agent Development Kit (ADK) to walk through code and live demos for the three foundational AI agent architectures. In this video, we cover: - The Single Agent: Great for simple tool-use, but struggles with complex multi-step logic. - The Sequential Agent: An "assembly line" approach for highly reliable, predictable workflows. - The Parallel Agent: Running multiple specialized agents concurrently to drastically reduce latency. Optimize your AI projects. Chapters: 0:00 - Intro 1:01 - Pattern 1: Single agent 3:05 - Pattern 2: Sequential agent 5:21 - Pattern 3: Parallel agent 7:08 - Recap More resources: ADK Doc → https://goo.gle/40ACYEw Foundations of multi-agent systems with ADK → https://goo.gle/4tXUkIU Workflow agents and communication in ADK → https://goo.gle/4rCONWJ Watch more AI agent crash course→ https://goo.gle/AIforBeginners 🔔 Subscribe to Google Cloud Tech → https://goo.gle/GoogleCloudTech #GoogleCloud #AIAgents #ADK Speakers: Annie Wang Products Mentioned: Agent Development Kit
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Google Cloud Tech · Google Cloud Tech · 0 of 60

← Previous Next →
1 I’m going for it #GoogleCloudCertified
I’m going for it #GoogleCloudCertified
Google Cloud Tech
2 I had to get #GoogleCloudCertified
I had to get #GoogleCloudCertified
Google Cloud Tech
3 Be better overall at what you do #GoogleCloudCertified
Be better overall at what you do #GoogleCloudCertified
Google Cloud Tech
4 Cloud Monitoring on our radar #Analysis #Uptime
Cloud Monitoring on our radar #Analysis #Uptime
Google Cloud Tech
5 Introduction to Generative AI Studio
Introduction to Generative AI Studio
Google Cloud Tech
6 How to use Github Actions with Google's Workload Identity Federation
How to use Github Actions with Google's Workload Identity Federation
Google Cloud Tech
7 Introduction to Responsible AI
Introduction to Responsible AI
Google Cloud Tech
8 Networking updates and CDMC-certified architecture
Networking updates and CDMC-certified architecture
Google Cloud Tech
9 Create and use a Cloud Storage bucket
Create and use a Cloud Storage bucket
Google Cloud Tech
10 How to digitize text from documents
How to digitize text from documents
Google Cloud Tech
11 Faster analytical queries with AlloyDB
Faster analytical queries with AlloyDB
Google Cloud Tech
12 Next ‘23 sessions and FaaS Wave
Next ‘23 sessions and FaaS Wave
Google Cloud Tech
13 Introduction to Assured Open Source Software
Introduction to Assured Open Source Software
Google Cloud Tech
14 BigQuery Cost Optimization: Storage
BigQuery Cost Optimization: Storage
Google Cloud Tech
15 BigQuery Cost Optimization: Compute
BigQuery Cost Optimization: Compute
Google Cloud Tech
16 BigQuery Cost Optimization: Select Queries
BigQuery Cost Optimization: Select Queries
Google Cloud Tech
17 Remote Field Equipment Management with Manufacturing Data Engine
Remote Field Equipment Management with Manufacturing Data Engine
Google Cloud Tech
18 Supercharging your applications with Cloud SQL Enterprise Plus
Supercharging your applications with Cloud SQL Enterprise Plus
Google Cloud Tech
19 Vector Support on our radar #GenAI
Vector Support on our radar #GenAI
Google Cloud Tech
20 Architecting a blockchain startup with Google Cloud
Architecting a blockchain startup with Google Cloud
Google Cloud Tech
21 Kubernetes and multitasking updates!
Kubernetes and multitasking updates!
Google Cloud Tech
22 GKE: Using Kubernetes Events
GKE: Using Kubernetes Events
Google Cloud Tech
23 How to configure firewall rules for Cloud Composer
How to configure firewall rules for Cloud Composer
Google Cloud Tech
24 Vertex AI Embeddings API + Matching Engine: Grounding LLMs made easy
Vertex AI Embeddings API + Matching Engine: Grounding LLMs made easy
Google Cloud Tech
25 Geospatial analytics on our radar #EarthEngine #BigQuery
Geospatial analytics on our radar #EarthEngine #BigQuery
Google Cloud Tech
26 Ensuring requests are set in Kubernetes
Ensuring requests are set in Kubernetes
Google Cloud Tech
27 Cloud Next 2023, Google research program, and more!
Cloud Next 2023, Google research program, and more!
Google Cloud Tech
28 How to migrate projects between organizations with Resource Manager
How to migrate projects between organizations with Resource Manager
Google Cloud Tech
29 How to run #MySQL in Google Cloud
How to run #MySQL in Google Cloud
Google Cloud Tech
30 #GenerativeAI for enterprises and #Next2023
#GenerativeAI for enterprises and #Next2023
Google Cloud Tech
31 How Google Photos scales to store 4 trillion photos and videos
How Google Photos scales to store 4 trillion photos and videos
Google Cloud Tech
32 Google Cross-Cloud Interconnect (Demo 2)
Google Cross-Cloud Interconnect (Demo 2)
Google Cloud Tech
33 GKE Cost Optimization Golden Signals: Introduction
GKE Cost Optimization Golden Signals: Introduction
Google Cloud Tech
34 GKE Cost Optimization Golden Signals: Workload Rightsizing
GKE Cost Optimization Golden Signals: Workload Rightsizing
Google Cloud Tech
35 GKE Load Balancing: Overview
GKE Load Balancing: Overview
Google Cloud Tech
36 GKE Load Balancing: Best Practices
GKE Load Balancing: Best Practices
Google Cloud Tech
37 Disaster Recovery in GKE
Disaster Recovery in GKE
Google Cloud Tech
38 How to configure IP masquerade agent in GKE Standard clusters
How to configure IP masquerade agent in GKE Standard clusters
Google Cloud Tech
39 Enable and use GKE Control plane logs
Enable and use GKE Control plane logs
Google Cloud Tech
40 Compliance in Australia with Assured Workloads
Compliance in Australia with Assured Workloads
Google Cloud Tech
41 Creating budgets and budget alerts in Google Cloud #FinOps
Creating budgets and budget alerts in Google Cloud #FinOps
Google Cloud Tech
42 Cloud SQL Enterprise Plus on our radar #mySQL
Cloud SQL Enterprise Plus on our radar #mySQL
Google Cloud Tech
43 What's Next for Google Cloud?
What's Next for Google Cloud?
Google Cloud Tech
44 How Loveholidays scaled with Contact Center AI
How Loveholidays scaled with Contact Center AI
Google Cloud Tech
45 What is fleet team management in GKE?
What is fleet team management in GKE?
Google Cloud Tech
46 Troubleshoot VPC Network Peering
Troubleshoot VPC Network Peering
Google Cloud Tech
47 Introduction to DocAI and Contact Center AI
Introduction to DocAI and Contact Center AI
Google Cloud Tech
48 Cloud Run Direct VPC egress explained
Cloud Run Direct VPC egress explained
Google Cloud Tech
49 Database deployment options in GKE
Database deployment options in GKE
Google Cloud Tech
50 Analyze cloud billing data with #BigQuery
Analyze cloud billing data with #BigQuery
Google Cloud Tech
51 Tips to becoming a world-class Prompt Engineer
Tips to becoming a world-class Prompt Engineer
Google Cloud Tech
52 Serverless is simple. Do I need CI/CD?
Serverless is simple. Do I need CI/CD?
Google Cloud Tech
53 Accelerating model deployment with MLOps
Accelerating model deployment with MLOps
Google Cloud Tech
54 How Hawaii's Department of Human Services scaled with CCAI
How Hawaii's Department of Human Services scaled with CCAI
Google Cloud Tech
55 Pricing API on our #Radar
Pricing API on our #Radar
Google Cloud Tech
56 How Recommendations AI for Media can boost customer retention
How Recommendations AI for Media can boost customer retention
Google Cloud Tech
57 Troubleshooting: Node Not Ready Status
Troubleshooting: Node Not Ready Status
Google Cloud Tech
58 One weekend until Cloud Next 2023!
One weekend until Cloud Next 2023!
Google Cloud Tech
59 #GoogleCloudNext starts tomorrow!
#GoogleCloudNext starts tomorrow!
Google Cloud Tech
60 #GoogleCloudNext will be demand!
#GoogleCloudNext will be demand!
Google Cloud Tech

The video covers AI agent design patterns using the Agent Development Kit (ADK), including the Single Agent, Sequential Agent, and Parallel Agent architectures for building AI agentic systems.

Related Reads

📰
The Agentic Shift: Why Google I/O 2026 Signals the End of the Standalone App Era
Learn why Google I/O 2026 marks the end of standalone apps and the beginning of the agentic shift, and how this change will impact the way we interact with technology
Medium · AI
📰
Detect Claude AI Code Marking: Why Chasing It Is a Distraction
Learn why directly detecting Claude AI code marking is a distraction and how to protect AI agent data integrity in Node.js
Dev.to · Umair Bilal
📰
Stop Overpaying for AI APIs
Learn to optimize AI API costs by identifying key drivers of expense and implementing cost-saving strategies
Dev.to AI
📰
I Managed AI Agents Like Junior Hires for a Month - Here Are the 4 Manager Moves That Don't Transfer
Managing AI agents like junior hires can lead to unexpected issues, and certain traditional management moves don't transfer to AI agents, highlighting the need for new strategies
Dev.to AI

Chapters (5)

Intro
1:01 Pattern 1: Single agent
3:05 Pattern 2: Sequential agent
5:21 Pattern 3: Parallel agent
7:08 Recap
Up next
Building Great Agent Skills: The Missing Manual
AI Engineer
Watch →