AI agent design patterns
Google Cloud Tech · 2026-02-27 · 8м 21с · 417 451 просмотров · YouTube ↗
Топики: ai-loop-engineering
🎧 Аудио
📝 Summary
model=deepseek-v4-flash · prompt=summary-v7 · 3 450→1 909 tokens · 2026-07-20 11:48:28
🎯 Главная суть
При проектировании AI-агентов нужно выбирать между тремя базовыми паттернами — одиночным, последовательным и параллельным — в зависимости от требуемого баланса между простотой реализации, контролем над логикой и скоростью выполнения. Каждый паттерн решает свою задачу и имеет чёткие компромиссы: одиночный агент гибок, но ненадёжен на сложных сценариях; последовательный даёт предсказуемость, но теряет гибкость; параллельный ускоряет независимые подзадачи, но усложняет систему и увеличивает затраты. Для демонстрации используется ADK (Agent Development Kit) и web-интерфейс ADK Web UI — инструменты Google Cloud для построения агентных систем.
Одиночный агент (single agent) — простота без гарантий
Одиночный агент получает одно системное описание (system prompt), в котором прописана вся логика, и набор инструментов (например, поиск в Google). Агент сам решает, в каком порядке и как применять инструменты, полагаясь на рассуждения модели. Для простого запроса «спланируй поездку в Сан-Франциско» этого достаточно: агент выполняет поиск за один проход, что видно в трейсинге ADK Web UI.
Проблема возникает при усложнении. Если запрос — «найди суши-ресторан в Сан-Франциско с поздним закрытием и самый быстрый способ туда добраться», то в одном system prompt приходится описывать многошаговую логику. Из-за недетерминированности AI агент не гарантирует, что выполнит все шаги в точности. Контроль над процессом теряется.
Компромиссы:
- Плюс: чрезвычайно простая реализация, подходит для прямолинейных многошаговых задач.
- Минус: ненадёжен для сложных рабочих процессов, падает по мере усложнения задачи.
Последовательный агент (sequential agent) — предсказуемость через жёсткую цепочку
Когда одни и те же операции нужно выполнять в строгом порядке снова и снова, применяется последовательный паттерн. Задача разбивается на несколько специализированных под-агентов, каждый из которых отвечает за один шаг. Выход первого агента становится прямым входом для второго. Это аналог конвейера: для того же запроса о суши сначала работает агент поиска еды (food‑finding agent), а затем — агент транспорта (transportation agent). Порядок жёстко зафиксирован, что даёт предсказуемое и надёжное выполнение.
Обмен данными между агентами происходит через shared session state — общее пространство, в каждом сеансе (session) хранятся промежуточные результаты. Первый агент записывает свои находки в session state, второй читает их через синтаксис {{ }} в своём system prompt. Это работает как краткосрочная память для всей системы агентов.
Компромиссы:
- Плюс: высокий контроль и надёжность, предсказуемость выполнения.
- Минус: жёсткая структура не адаптируется к динамическим ситуациям, система негибкая.
Параллельный агент (parallel agent) — скорость ценой сложности
Если подзадачи независимы друг от друга и не требуют последовательного выполнения, их можно запускать одновременно. Например, для планирования поездки нужно найти музей, концерт и ресторан — эти три поиска не зависят друг от друга. Параллельный паттерн запускает трёх агентов — museum finder, concert finder, restaurant finder — одновременно, что значительно сокращает общее время выполнения по сравнению с последовательным опросом.
После сбора всех результатов нужен шаг агрегации. Чаще всего параллельный паттерн комбинируют с последовательным: сначала независимые поиски запускаются параллельно, а затем финальный aggregator agent синтезирует все результаты в единый план поездки. В примере с ADK это реализовано так: три поисковых агента стартуют одновременно, записывают результаты в session state, после чего финальный агент читает session state и формирует итоговый план.
Компромиссы:
- Плюс: значительное снижение задержки для задач, разбиваемых на независимые подзадачи.
- Минус: более высокие начальные затраты из-за одновременной работы нескольких агентов; необходимость шага сборки/синтеза (aggregator), что добавляет сложности в дизайн.
Анонс следующих паттернов
Следующие видео серии будут посвящены продвинутым паттернам для более комплексных и динамичных проблем: паттерн с циклом и критикой (loop and critique) для самокоррекции агента, паттерн с координатором (coordinator / orchestrator) для динамической маршрутизации задач, а также концепция использования самого агента как инструмента (agent as a tool).
📜 Transcript
en · 1 263 слов · 18 сегментов · clean
Показать текст транскрипта
Hi everyone, welcome to this agentic pattern series. So if you're 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 were 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 work through a live demo. And by the end of this agentic pattern series, you will learn how to build agentic solution from single agent pattern to different multi-agent 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 going to 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 an instruction on how to use a tool. And we can have a set of tools 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 this 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 ADK Web. 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 problem, and the behavior can become very unreliable. Since AI is non-deterministic, you cannot always guarantee that you will follow your multi-step logic perfectly every time. So the single agent lack of control 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 fail as tasks becoming more complex. Now, let's get to our second part of this video, which is the sequential agent. So with the tasks we covered earlier, how do we add in more control? This brings us to our first multi-agent pattern, the sequential agent. And this pattern is for highly structured, repeatable tasks because the order of the operation is fixed. So the output of one sub-agent becomes the direct input for the next sub-agent. It's like an assembly line. And for our trip, we can break down to two specialized agents. 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 a 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. 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 happening 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'm doing them in sequential order, it will be slow. This is where the parallel agent pattern really shines. It allows multiple specialized agents to run independently at the same time. We can have three agents, 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 these 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 tasks that can be broken down into independent subtasks. So the benefit of this design is very obvious that it significantly reduced 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 covered the sequential agent. It adds a certain level of control and makes 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 tasks, but it can add cost and complexity to your system. With those patterns, you can already build some powerful workflow. And in our next video, we're going to level up with more advanced patterns for handling even more complex and dynamic problems. We will explore cases with different practical examples. And the pattern we're going to cover next episode, including the loop and critique pattern for self-correction, the coordinator pattern for dynamic routing, and also the powerful concept of using agent as a tool. All right, I will see you in the next video. Bye.
⚙️ Pipeline jobs
| Stage | Status | Att. | Updated | Error |
|---|---|---|---|---|
| download | done | 1/3 | 2026-07-20 11:47:59 | |
| transcribe | done | 1/3 | 2026-07-20 11:48:04 | |
| summarize | done | 1/3 | 2026-07-20 11:48:28 | |
| embed | done | 1/3 | 2026-07-20 11:48:30 |
📄 Описание YouTube
Показать
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