Workflow Agents¶
工作流智能体¶
This section introduces "workflow agents" - specialized agents that control the execution flow of their sub-agents.
本节介绍"工作流智能体"——控制其子智能体执行流程的专用智能体。
Workflow agents are specialized components in ADK designed purely for orchestrating the execution flow of sub-agents. Their primary role is to manage how and when other agents run, defining the control flow of a process.
工作流智能体是 ADK 中专为编排子智能体执行流程而设计的专用组件。它们的主要角色是管理其他智能体运行的方式和时间,定义流程的控制流。
Unlike LLM Agents, which use Large Language Models for dynamic reasoning and decision-making, Workflow Agents operate based on predefined logic. They determine the execution sequence according to their type (e.g., sequential, parallel, loop) without consulting an LLM for the orchestration itself. This results in deterministic and predictable execution patterns.
与使用大语言模型进行动态推理和决策的LLM 智能体不同,工作流智能体基于预定义逻辑运行。它们根据其类型(例如,顺序、并行、循环)确定执行顺序,而无需为编排本身咨询 LLM。这导致了确定性和可预测的执行模式。
ADK provides three core workflow agent types, each implementing a distinct execution pattern:
ADK 提供三种核心工作流智能体类型,每种类型实现不同的执行模式:
-
Sequential Agents
Executes sub-agents one after another, in sequence.
-
顺序智能体
按顺序一个接一个地执行子智能体。
-
Loop Agents
Repeatedly executes its sub-agents until a specific termination condition is met.
-
循环智能体
重复执行其子智能体,直到满足特定的终止条件。
-
Parallel Agents
Executes multiple sub-agents in parallel.
-
并行智能体
并行执行多个子智能体。
Why Use Workflow Agents?¶
Workflow agents are essential when you need explicit control over how a series of tasks or agents are executed. They provide:
- Predictability: The flow of execution is guaranteed based on the agent type and configuration.
- Reliability: Ensures tasks run in the required order or pattern consistently.
- Structure: Allows you to build complex processes by composing agents within clear control structures.
为什么要使用工作流智能体?¶
当您需要明确控制一系列任务或智能体如何执行时,工作流智能体至关重要。它们提供:
- 可预测性: 根据智能体类型和配置保证执行流程。
- 可靠性: 确保任务始终按所需的顺序或模式运行。
- 结构: 允许您通过在清晰的控制结构中组合智能体来构建复杂的过程。
While the workflow agent manages the control flow deterministically, the sub-agents it orchestrates can themselves be any type of agent, including intelligent LLM Agent instances. This allows you to combine structured process control with flexible, LLM-powered task execution.
虽然工作流智能体确定性地管理控制流程,但它编排的子智能体本身可以是任何类型的智能体,包括智能 LLM 智能体实例。这允许您将结构化的过程控制与灵活的、由 LLM 驱动的任务执行结合起来。