Practical guidance on how to structure agent tasks using three common workflow patterns, with tradeoffs and benefits for each.

  • Category
  • Product
    Claude Platform
  • Date
    March 5, 2026
  • Reading time
    5
    min
  • Share
    Copy link
    https://claude.com/blog/common-workflow-patterns-for-ai-agents-and-when-to-use-them

AI agents make decisions autonomously, and workflows are how you bring structure to that autonomy. They establish execution patterns that channel agent capabilities toward complex problems requiring coordinated steps, predictable outcomes, and orchestrated timing.AI 智能体自主做出决策,而工作流则为这种自主性提供结构。它们建立执行模式,将智能体的能力引导至需要协调步骤、可预测结果和精心编排时机的复杂问题。

When you need multiple agents working together, the real decision is which pattern fits your problem.当需要多个智能体协同工作时,真正的决策在于哪种模式适合你的问题。

We've worked with dozens of teams building AI agents, and in production, three patterns cover the vast majority of use cases: sequential, parallel, and evaluator-optimizer.我们与数十个构建 AI 智能体的团队合作过,在生产环境中,三种模式覆盖了绝大多数用例:顺序、并行和评估器-优化器。

Each solves different problems, and picking the wrong one costs you in latency, tokens, or reliability. This piece breaks down all three, with guidance on when each fits and how to combine them.每种模式解决不同的问题,选错模式会在延迟、Token 消耗或可靠性上付出代价。本文详解这三种模式,并提供何时适用以及如何组合的指导。

How workflows and agents work together工作流与智能体如何协同工作

If you've managed a team, you already understand workflows.如果你管理过团队,你已经理解工作流。

Think of a manufacturing assembly line: each station has a skilled worker making decisions about their specific tasks, but the overall flow is designed ahead of time—even when individual steps involve dynamic decisions like routing or retries.想象一条制造装配线:每个工位都有一名熟练工人对其特定任务做出决策,但整体流程是预先设计好的——即使单个步骤涉及路由或重试等动态决策。

Agent workflows operate the same way.智能体工作流以同样的方式运作。

Understanding workflows vs. autonomous agents理解工作流与自主智能体

Workflows don't replace agent autonomy; they shape where and how agents apply it.工作流不会取代智能体的自主性;它们塑造智能体在何处以及如何应用自主性。

A fully autonomous agent decides everything: which tools to use, what order to execute tasks, and when to stop.完全自主的智能体决定一切:使用哪些工具、以什么顺序执行任务以及何时停止。

A workflow provides structure: it establishes the overall flow, defines checkpoints, and sets boundaries for how agents operate at each step, while still allowing dynamic behavior within those boundaries.工作流提供结构:它建立整体流程,定义检查点,并为智能体在每个步骤中的操作设定边界,同时仍允许在这些边界内进行动态行为。

Each step in a workflow can still leverage an agent's reasoning and tool use, but the overall orchestration follows a defined path. A workflow pattern gives you agent intelligence within each step, and a predictable process flows across the entire task.工作流中的每一步仍可利用智能体的推理和工具使用,但整体编排遵循一条既定路径。工作流模式在每个步骤中赋予你智能体的智能,并在整个任务中贯穿可预测的流程。

Agent workflow patterns智能体工作流模式

In production, we see three workflow patterns come up most often. Think of these as building blocks rather than rigid templates—you'll often combine or nest them as your requirements evolve:在生产环境中,我们看到三种工作流模式最为常见。将它们视为构建模块而非僵化模板——随着需求演变,你通常会组合或嵌套它们:

  1. Sequential workflows — for executing tasks in a fixed order顺序工作流——用于按固定顺序执行任务
  2. Parallel workflows — for running independent tasks across agents simultaneously并行工作流——用于跨智能体同时运行独立任务
  3. Evaluator-optimizer workflows — for outputs that need iterative refinement评估器-优化器工作流——用于需要迭代优化的输出

Each workflow type solves specific problems and comes with clear tradeoffs around complexity, cost, and performance.每种工作流类型解决特定问题,并在复杂性、成本和性能方面有明确的权衡。

Problem it solves When to use Tradeoff Benefit
Sequential Tasks have dependencies: step B needs step A's output Multi-stage processes, data pipelines, draft-review-polish cycles Adds latency (each step waits for the previous one) Can improve accuracy by letting each agent focus on one thing
Parallel Tasks are independent but doing them one at a time is slow Evaluations across multiple dimensions, code review, document analysis Costs more (multiple concurrent API calls) and requires an aggregation strategy Can lead to faster completion and separation of concerns across engineering teams
Evaluator-optimizer First-draft quality isn't good enough Technical documentation, customer communications, code generation against specific standards Multiplies token usage and adds iteration time Can generate better outputs through structured feedback loops


Start with the simplest pattern that solves your problem. Default to sequential. Move to parallel when latency is the bottleneck and tasks are independent and add evaluator-optimizer loops only when you can measure the quality improvement.
从解决你问题的最简单模式开始。默认选择顺序。当延迟成为瓶颈且任务独立时转向并行,并且仅当你能衡量质量改进时才添加评估器-优化器循环。

Sequential workflows顺序工作流

Sequential workflows execute tasks in a predetermined order.顺序工作流按预定顺序执行任务。

Agents at each stage process inputs, make decisions, make tool calls as needed, then pass results to the next stage. The result is a clear chain of operations where outputs flow linearly through the system.每个阶段的智能体处理输入、做出决策、根据需要调用工具,然后将结果传递给下一阶段。结果是清晰的运算链,输出线性地流经系统。

When to use: Sequential workflows excel when tasks naturally break down into distinct stages with clear dependencies. You're trading some latency for higher accuracy by focusing each agent on a specific subtask instead of trying to handle everything at once.何时使用:当任务自然分解为具有明确依赖关系的不同阶段时,顺序工作流表现出色。你通过让每个智能体专注于特定子任务而不是试图一次性处理所有事情,来用一些延迟换取更高的准确性。

Use sequential workflows when there are:在以下情况下使用顺序工作流:

  • Multi-stage processes where each step depends on the previous output每个步骤依赖于前一步输出的多阶段流程
  • Data transformation pipelines where each stage adds specific value每个阶段增加特定价值的数据转换管道
  • Tasks that can't be parallelized due to inherent dependencies由于固有依赖关系而无法并行化的任务
  • Iterative improvement cycles like draft-review-polish cycles迭代改进循环,如草稿-审查-润色循环

When to avoid: Skip sequential workflows when a single agent can handle the entire task effectively, or when agents need to collaborate rather than hand off work sequentially. If you're forcing a task into sequential steps when it doesn't naturally fit that structure, you're adding unnecessary complexity.何时避免:当单个智能体可以有效处理整个任务时,或者当智能体需要协作而不是顺序交接工作时,跳过顺序工作流。如果你强行将任务分解为不适合其自然结构的顺序步骤,你就是在增加不必要的复杂性。

Example: Sequential workflows work well when each step involves genuinely different work:示例:当每个步骤涉及真正不同的工作时,顺序工作流效果很好:

  • Generating marketing copy, then translating it into multiple languages—or extracting data from documents, validating it against a schema, and loading it into a database生成营销文案,然后将其翻译成多种语言——或者从文档中提取数据,根据模式进行验证,然后加载到数据库中
  • Content moderation pipelines also work well sequentially: extract content, classify it, apply moderation rules, then route appropriately内容审核管道也适合顺序处理:提取内容、分类、应用审核规则,然后适当路由

Pro tip: First try your pipeline as a single agent, where the steps are just part of the prompt. If that's good enough, you've solved the problem without additional complexity. Only split into a multi-step workflow when a single agent can't handle it reliably.专业提示:首先尝试将你的管道作为单个智能体,其中步骤只是提示的一部分。如果这已经足够好,你就无需额外复杂性就解决了问题。仅当单个智能体无法可靠处理时,才拆分为多步骤工作流。

Parallel workflows并行工作流

Parallel workflows distribute independent tasks across multiple agents that execute simultaneously. Instead of waiting for one agent to finish before starting the next, you run multiple agents at once and merge their results.并行工作流将独立任务分配给多个同时执行的智能体。不是等待一个智能体完成后再启动下一个,而是同时运行多个智能体并合并它们的结果。

This pattern can deliver speed improvements when tasks don't depend on each other.当任务互不依赖时,这种模式可以带来速度提升。

The approach resembles the fan-out/fan-in pattern from distributed systems. You send the same or related work to multiple agents, each processes independently, then you aggregate or synthesize their outputs.这种方法类似于分布式系统中的扇出/扇入模式。你将相同或相关的工作发送给多个智能体,每个智能体独立处理,然后聚合或综合它们的输出。

Agents don't hand off work to each other—they operate autonomously and produce results that contribute to the overall task.智能体之间不交接工作——它们自主运行并产生有助于整体任务的结果。

When to use: Parallelization makes sense when you can divide work into independent subtasks that benefit from simultaneous processing, or when you need multiple perspectives on the same problem. It also enables separation of concerns: different engineers can own and optimize individual agents independently without their work interfering with each other. For complex tasks, handling each consideration with a separate AI call often outperforms trying to juggle everything in one call.何时使用:当你可以将工作划分为受益于同时处理的独立子任务时,或者当你需要对同一问题有多个视角时,并行化是有意义的。它还实现了关注点分离:不同的工程师可以独立拥有和优化单个智能体,而不会相互干扰。对于复杂任务,用单独的 AI 调用处理每个考虑因素通常优于试图在一次调用中兼顾所有事情。

Consider parallel workflows for:考虑并行工作流用于:

  • Sectioning approaches where different agents handle different aspects (like one processing queries while another screens for safety issues)分区方法,其中不同的智能体处理不同的方面(例如一个处理查询,另一个筛查安全问题)
  • Evaluation scenarios where each agent assesses different quality dimensions评估场景,其中每个智能体评估不同的质量维度
  • Voting patterns where multiple agents analyze the same content and you aggregate their assessments投票模式,其中多个智能体分析相同内容,你聚合它们的评估

When to avoid: Don't use parallel workflows when agents need cumulative context or must build on each other's work. Skip this pattern when resource constraints like API quotas make concurrent processing inefficient, or when you lack clear strategies for handling contradictory results from different agents. If result aggregation becomes too complex or degrades output quality, parallelization isn't worth it.何时避免:当智能体需要累积上下文或必须建立在彼此的工作之上时,不要使用并行工作流。当 API 配额等资源限制使并发处理效率低下时,或者当你缺乏处理来自不同智能体的矛盾结果的明确策略时,跳过此模式。如果结果聚合变得过于复杂或降低输出质量,并行化就不值得。

Example: Parallel workflows work well for:示例:并行工作流适用于:

  • Automating evaluations (each agent checks different quality metrics) or code review (multiple agents examine different vulnerability categories)自动化评估(每个智能体检查不同的质量指标)或代码审查(多个智能体检查不同的漏洞类别)
  • Document analysis is another strong use case: parallelize extraction of key themes, sentiment analysis, and factual verification, then combine the insights文档分析是另一个强用例:并行提取关键主题、情感分析和事实核查,然后合并见解

Pro tip: Design your aggregation strategy before implementing parallel agents. Will you take the majority vote? Average confidence scores? Defer to the most specialized agent? Having a clear plan for synthesizing results prevents you from collecting conflicting outputs with no way to resolve them.专业提示:在实现并行智能体之前设计你的聚合策略。你会采用多数投票?平均置信度分数?还是交给最专业的智能体?有一个清晰的综合结果计划可以防止你收集到无法解决的冲突输出。

Evaluator-optimizer workflows评估器-优化器工作流

Evaluator-optimizer workflows pair two agents in an iterative cycle: one generates content, another evaluates it against specific criteria, and the generator refines based on that feedback. This continues until the output meets your quality threshold or hits a maximum iteration count.评估器-优化器工作流将两个智能体配对成一个迭代循环:一个生成内容,另一个根据特定标准评估它,生成器根据反馈进行优化。这持续进行,直到输出达到你的质量阈值或达到最大迭代次数。

The key insight is that generation and evaluation are different cognitive tasks. Separating them lets each agent specialize—the generator focuses on producing content, the evaluator focuses on applying consistent quality criteria.关键见解是生成和评估是不同的认知任务。将它们分开可以让每个智能体专业化——生成器专注于产生内容,评估器专注于应用一致的质量标准。

When to use: This pattern works when you have clear, measurable quality criteria that an AI evaluator can apply consistently, and when the gap between first-attempt and final quality is meaningful enough to justify the extra tokens and latency.何时使用:当你有清晰、可衡量的质量标准,AI 评估器可以一致地应用,并且首次尝试与最终质量之间的差距足够大,值得额外的 Token 和延迟时,这种模式有效。

Consider evaluator-optimizer workflows for:考虑评估器-优化器工作流用于:

  • Code generation with specific requirements (security standards, performance benchmarks, style guidelines)具有特定要求的代码生成(安全标准、性能基准、风格指南)
  • Professional communications where tone and precision matter语气和精确性很重要的专业沟通
  • Any scenario where first-draft quality consistently falls short of requirements任何首次草稿质量始终达不到要求的场景

When to avoid: Skip evaluator-optimizer workflows when first-attempt quality already meets your needs—you're burning tokens on unnecessary iterations. Don't use this pattern for real-time applications requiring immediate responses, simple routine tasks like basic classification, or when evaluation criteria are too subjective for an AI evaluator to apply consistently. If deterministic tools exist (like linters for code style), use those instead. Also avoid this pattern when resource constraints outweigh quality improvements.何时避免:当首次尝试的质量已经满足你的需求时,跳过评估器-优化器工作流——你是在不必要的迭代上浪费 Token。不要将此模式用于需要即时响应的实时应用、基本分类等简单例行任务,或者当评估标准过于主观以至于 AI 评估器无法一致应用时。如果存在确定性工具(如代码风格的 linter),请使用它们。当资源限制超过质量改进时,也要避免此模式。

Example: Evaluator-optimizer workflows work well for:示例:评估器-优化器工作流适用于:

  • Generating API documentation (generator writes docs, evaluator checks for completeness, clarity, and accuracy against the codebase)生成 API 文档(生成器编写文档,评估器根据代码库检查完整性、清晰度和准确性)
  • Creating customer communications (generator drafts email, evaluator assesses tone and policy compliance)创建客户沟通(生成器起草邮件,评估器评估语气和政策合规性)
  • Producing SQL queries (generator writes query, evaluator checks for efficiency and security issues)生成 SQL 查询(生成器编写查询,评估器检查效率和安全性问题)

Pro tip: Set clear stopping criteria before you start iterating. Define maximum iteration counts and specific quality thresholds. Without these guardrails, you can end up in expensive loops where the evaluator keeps finding minor issues and the generator keeps tweaking, but quality plateaus well before you stop iterating. Know when good enough is good enough.专业提示:在开始迭代之前设定明确的停止标准。定义最大迭代次数和具体的质量阈值。没有这些护栏,你可能会陷入昂贵的循环,评估器不断发现小问题,生成器不断调整,但质量在停止迭代之前很久就达到平台期。知道什么时候足够好就是足够好。

Choosing the right workflow pattern选择正确的工作流模式

The right workflow pattern depends on your task structure, quality requirements, and resource constraints.正确的工作流模式取决于你的任务结构、质量要求和资源限制。

Before choosing a pattern, try the task as a single agent call first. If that meets your quality bar, you're done. If not, identify where it falls short—that tells you which pattern to reach for.在选择模式之前,首先尝试将任务作为单个智能体调用。如果这满足你的质量要求,你就完成了。如果没有,找出它在哪里不足——这告诉你应该选择哪种模式。

Here are a few questions to help you decide:以下是一些帮助你决定的问题:

  • Can a single agent handle this task effectively? If yes, don't use workflows at all.单个智能体能否有效处理此任务?如果能,根本不要使用工作流。
  • Does the task have clear sequential dependencies? Use sequential workflows.任务是否有清晰的顺序依赖关系?使用顺序工作流。
  • Can subtasks be processed independently and simultaneously, and would faster completion help? Consider parallel workflows.子任务能否独立且同时处理,并且更快的完成是否有帮助?考虑并行工作流。
  • Does quality improve meaningfully with iterative refinement? Consider evaluator-optimizer patterns.质量是否通过迭代优化有显著改进?考虑评估器-优化器模式。

Once you've selected a pattern, consider:一旦你选择了模式,考虑:

  • Failure handling: Define fallback behavior and retry logic for each step.故障处理:为每个步骤定义回退行为和重试逻辑。
  • Latency and cost constraints: These determine how many agents you can run and how many iterations you can afford.延迟和成本限制:这些决定了你可以运行多少个智能体以及可以承担多少次迭代。
  • Measuring improvement: Set a baseline with a single agent so you can tell whether the workflow actually helps.衡量改进:用单个智能体设定基线,这样你就能判断工作流是否真的有帮助。

Combining patterns: These patterns aren't mutually exclusive. You can nest them as complexity demands.组合模式:这些模式并非互斥。你可以根据复杂性的需要嵌套它们。

  • An evaluator-optimizer workflow might use parallel evaluation where multiple evaluators assess different quality dimensions simultaneously.评估器-优化器工作流可能使用并行评估,其中多个评估器同时评估不同的质量维度。
  • A sequential workflow might include parallel processing at certain stages where multiple independent operations happen before moving to the next step.顺序工作流可能在某些阶段包含并行处理,在这些阶段中,多个独立操作在进入下一步之前同时进行。

The key is matching pattern complexity to actual requirements. Don't add parallel processing because you can—add it when concurrent execution provides clear benefits. Don't implement evaluator-optimizer loops unless they improve output quality in a way you can measure.关键是将模式复杂性与实际需求相匹配。不要因为你能添加并行处理就添加——只有在并发执行带来明显好处时才添加。不要实现评估器-优化器循环,除非它们以你可衡量的方式改进输出质量。

Evolve your workflows thoughtfully深思熟虑地演进你的工作流

Our best advice: start with the simplest pattern that works. If a sequential workflow handles your use case, don't add parallelization. If first-attempt quality is good enough, skip the evaluator-optimizer loop.我们最好的建议:从最简单且有效的模式开始。如果顺序工作流能处理你的用例,不要添加并行化。如果首次尝试的质量足够好,跳过评估器-优化器循环。

These three patterns give you clear upgrade paths as requirements change. A sequential workflow can incorporate parallel processing at bottleneck stages. An agentic approach can add evaluation when quality standards tighten, and because these patterns are modular, you won't need complete rewrites.这三种模式为你提供了随着需求变化而清晰的升级路径。顺序工作流可以在瓶颈阶段加入并行处理。当质量标准收紧时,智能体方法可以添加评估,并且由于这些模式是模块化的,你不需要完全重写。

For implementation guidance, detailed examples, and advanced patterns including hybrid approaches, check out our full white paper: Building effective AI agents: architecture patterns and implementation frameworks.有关实施指导、详细示例以及包括混合方法在内的高级模式,请查看我们的完整白皮书:构建有效的 AI 智能体:架构模式与实施框架。

Build on the Claude Developer Platform today.立即在 Claude 开发者平台上构建。

No items found.
Prev
0/5
Next
eBook

No items found.

Transform how your organization operates with Claude

See pricing
Contact sales

Get the developer newsletter

Product updates, how-tos, community spotlights, and more. Delivered monthly to your inbox.

Subscribe

Please provide your email address if you'd like to receive our monthly developer newsletter. You can unsubscribe at any time.

Thank you! You’re subscribed.
Sorry, there was a problem with your submission, please try again later.
Claude Platform