智能体框架的演进:从链到图再到代码
原题The Evolution of Agentic Harnesses: From Chains to Graph to Code
读前速览
本文追溯了智能体 AI 框架历经链、图、代码三种范式的演进,展示了每种范式如何应对将概率性 LLM 输出转化为可靠、生产级系统的核心挑战,并为在给定可靠性、延迟和成本权衡下选择合适的抽象提供了指导。
智能体框架已历经链、图、代码三种范式的演进,每种范式都致力于解决一个根本挑战:让概率性的 LLM 输出足够可靠,以用于生产环境。
链是线性的、构建快速的工作流,将 LLM 视为黑盒函数,但单个上游故障会级联影响整个流程。图引入了显式的节点和边,用于条件分支、重试和状态管理,从而支持多智能体编排。代码框架在沙箱环境中生成、执行和优化代码,通过紧密的通过/失败反馈循环提供确定性、可验证的输出。每种范式都代表了对如何将非确定性智能约束为可靠软件这一问题的更深理解。
基于图的框架催生了带有顶层编排器的多智能体系统,这需要一等公民的智能体间通信协议。
随着工作流复杂度的增长,单一单体智能体变得难以为继。图系统引入了 A2A 和 ACP 等协议,用于异步的智能体间通信,使智能体能够处理被分解为消息序列的长期任务,并保证 FIFO 交付。这促成了 LinkedIn 的招聘助手,其中顶层编排器将候选人寻找和申请人审核等任务委托给专业智能体,并在关键决策点提供人工介入支持。
基于代码的框架通过将执行视为具有确定性、可验证输出的一等原语,消除了工作流定义系统的脆弱性。
代码框架不是要求开发者定义复杂的工作流,而是允许智能体通过生成具有可验证输出的代码来「找到」解决方案。该架构依赖于四个核心组件:执行沙箱、插桩与日志记录、带有单元测试和断言的验证框架,以及迭代优化循环。在 LinkedIn,这种方法将自然语言查询转换为 SQL 和 Python,针对样本数据执行,根据隐私和治理约束验证输出,并迭代直到满足正确性标准——从而产生一个比定制提示词工程工作流更可审计、更可复现的系统。
在所有范式中,基本原则——将 LLM 输出视为不可信输入、将规划与执行解耦、投资于可观测性——对于工程可靠性至关重要。
LLM 输出是概率性的,在影响下游逻辑之前必须经过严格验证。将模型的规划与受控的软件执行分离,可以提高透明度和控制力。稳健的可观测性必须捕获每一步的状态、执行轨迹和验证结果。无论系统使用链、图还是代码框架,这些原则都适用,它们构成了从「尽力而为」心态到工程化可靠性的桥梁。
选择合适的抽象——使用满足可靠性、速度和成本要求的最简系统——是稳健智能体架构的基本原则。
对于摘要或内容审核等狭窄的线性任务,链已足够,并提供最低的延迟和计算成本。当工作流需要条件分支、重试或显式状态转换时,图变得合适。代码框架最适合精度、验证和可恢复性至关重要的领域,例如软件工程智能体或金融分析。用复杂抽象进行过度工程化,会增加计算支出、延迟和运营复杂性,其速度超过了对业务成果的改善。强大的工程组织通过优化每美元的能力来取胜,而不是通过最大化架构复杂性。
完整摘要
文章描述了 LinkedIn 及更广泛行业中智能体 AI 框架的三阶段演进。链代表了基于提示词的线性工作流的初始时代,构建快速但脆弱——单个上游故障会级联影响整个流程。图通过节点和边引入显式结构,支持条件分支、并行、重试和状态管理,从而催生了多智能体架构,并出现了 A2A 等用于智能体间通信的协议。代码框架将执行视为一等原语,在沙箱环境中生成和优化代码,以实现确定性、可验证的输出,并形成紧密的反馈循环。文章强调了所有范式下的基本原则:将 LLM 输出视为不可信输入、将规划与执行解耦、投资于可观测性,以及为持续改进而构建。文章最后指出,开发者的角色正从「提示词设计师」转变为「系统架构师」,而纪律严明的抽象选择——使用满足可靠性、速度和成本要求的最简系统——是成功的关键。
目录 · 7 节
关键要点Key Takeaways
- 智能体运行框架的发展经历了三个截然不同的范式:链式、图式和代码式,标志着其从临时拼凑、“尽力而为”的实验,转向弹性可靠、达到生产级的软件架构。The progression of agentic harnesses has unfolded across three distinct paradigms: Chains, Graphs, and Code, marking a transition from ad hoc, "best-effort" experiments to resilient, production-grade software architectures.
- 链代表了线性工作流的早期阶段,在摘要等范围有限的任务中延迟最低、计算成本也最低,但其本质上仍然脆弱:上游任何一个环节发生故障,都可能波及整个执行流程。Chains represent the initial era of linear workflows, offering the lowest latency and compute costs for narrow tasks such as summarization, though they remain inherently fragile: a single upstream failure can cascade through the entire execution flow.
- 图通过节点和边引入显式结构与操作控制,使条件分支、并行处理和状态管理等高级功能成为可能,从而增强系统在复杂多步骤环境中的韧性。Graphs introduce explicit structure and operational control through nodes and edges, enabling sophisticated capabilities such as conditional branching, parallelism, and state management, thereby improving resilience in complex, multi-step environments.
- 代码工具框架将执行视为一等基本要素,利用沙箱环境和迭代优化循环,生成确定且可验证的输出,从而尽可能充分地保障系统可靠性。Code harnesses treat execution as a first-class primitive, utilizing sandboxed environments and iterative refinement loops to deliver deterministic, verifiable outputs that offer the strongest possible guarantees of system reliability.
- 为确保可靠性经过工程化保障,开发者必须将 LLM 的输出视为不可信输入,将规划与执行解耦,深入投入可观测性建设,并严谨地选择能够满足必要可靠性、速度和成本要求的最简单抽象。To ensure engineered reliability, developers must treat LLM outputs as untrusted input, decouple planning from execution, invest deeply in observability, and disciplinedly select the least complex abstraction that fulfills the necessary reliability, speed, and cost requirements.
| This article is part of the "Agentic AI Architecture" article series. In this series, we try to establish agentic AI architecture as a new type of software architecture that will likely dominate the industry for years to come. The articles, written by industry experts, cover various elements and aspects of agentic AI architecture. We aim to present the latest trends and developments shaping the new type of architecture as it enters the mainstream. |
在过去几年里,基于大型语言模型(LLM)构建智能体的方式发生了翻天覆地的变化。最初,人们只是用胶水代码将临时拼凑的提示串联起来;如今,这种做法正逐步发展为我们所说的智能体框架(也称为结构化执行框架):它们为概率模型提供必要的支撑,使其变得可靠、可观测,并达到生产级别。In the last few years, building agents atop large language models (LLMs) has undergone a tectonic shift. What began as ad-hoc prompts stitched together with glue code is steadily maturing into what we now recognize as agentic harnesses, also known as structured execution frameworks, that surround probabilistic models with the scaffolding needed to make them reliable, observable, and production-grade.
这一演进并非一蹴而就,而是在现实应用日益增长的需求推动下逐步展开的。在这一演变过程中,三种截然不同的范式相继出现,分别体现了人们对如何约束非确定性智能并将其转化为可靠软件系统的日益深入的理解。This evolution has not been abrupt, but incremental, shaped by the growing demands of real-world applications. Across this arc of change, three distinct paradigms have emerged over time, each reflecting a deeper understanding of how to constrain and operationalize non-deterministic intelligence into dependable software systems.
链:提示词编排Chains: Prompt Choreography
最初的智能体系统围绕简单、线性的工作流构建,我们称之为“链”。这种方法直观而快捷,能够迅速将产品推向市场。你只需串联一系列提示词,让第一步的输出成为第二步的输入,依此类推。整个运行框架不过是用于调用工具和管理对话记忆的胶水代码,最终把 LLM 当作一个黑盒函数来处理:输入文本,输出文本,外面再包上一些语法糖。Initial agentic systems were built around simple, linear workflows, which we call "chains". This approach was intuitive and fast, enabling a quick time-to-market. You strung together a sequence of prompts where the output of step one feeds into step two, and so on. The harness was little more than glue code for tool calls and conversational memory, and ended up treating the LLM like a black-box function: text in, text out, with some syntactic sugar around it.
例如,在 LinkedIn,我们早期的一个生成式 AI 智能体使用了基于 LangChain 框架构建的固定三步链:At LinkedIn, for example, one of our early Generative AI agents used a fixed 3-step chain built using the LangChain framework:

图 1:结合 RAG 的简单链式工作流(来源:作者绘制)Figure 1: Simple Chain Workflow with RAG (Source: created by author)
- 路由:用于判断查询是否属于处理范围,以及应由哪位专门的 AI“专家”来处理的分类步骤。Routing: The classification step to decide if the query was in scope and which specialized AI "expert" should handle it.
- 检索:以召回为导向的步骤,通过调用合适的工具(如 Bing 网页搜索或 LinkedIn 内部 API)收集特定信息,并创建一份资料档案,为检索增强生成(RAG)的响应提供“依据”。Retrieval: The recall-oriented step of calling the right tools (like Bing web search or internal LinkedIn APIs) to gather specific information, creating a dossier to "ground" the response for Retrieval Augmented Generation (RAG).
- 生成:以精确性为导向,将检索到的数据进行筛选和综合,形成连贯的最终答案。Generation: The precision-oriented step of filtering and synthesizing the retrieved data into a coherent final answer.
虽然构建和部署相对快速,但这种简单性也导致了脆弱性。例如,通过一系列工具调用来查询 LinkedIn Economic Graph 并回答用户问题的工作流,完全依赖于前一步骤文本内容的准确性。上游只要出现一个错误,就会层层传递并导致整个流程失败,因为系统没有内置机制来系统地检测或恢复错误。While relatively fast to build and deploy, this simplicity led to fragility. The workflow, such as answering a user's question via a series of tool calls over the LinkedIn Economic Graph, depended entirely on the textual fidelity of the preceding step. A single mistake upstream would cascade through and derail the entire flow because there was no built-in mechanism to systematically detect or recover from the error.
这种方法充分体现了早期智能体产品“尽力而为”的特性。构建体验的初始 80% 相对迅速,但要弥合最后的质量差距、达到生产级标准,则需要通过严格评估、优化提示词和持续投入工程资源来反复迭代。This approach epitomized the "best-effort" nature of these early agentic products. Building the initial 80% of the experience was relatively fast, but closing the final quality gap for production required extensive iteration through rigorous evaluations, prompt refinement, and sustained engineering investment.
图表:引入结构与控制Graphs: Introducing Structure and Control
随着智能体系统的应用场景日益复杂,线性链条固有的局限性和脆弱性已变得无法忽视。开发者因此转而采用图结构——这是在工作流中引入分支、条件逻辑、并行处理和重试机制的自然抽象。As use cases for agentic systems grew more complex, the inherent limitations and fragility of linear chains became impossible to ignore. Developers responded by adopting graphs, the natural abstraction for introducing branching, conditional logic, parallelism, and retries into the workflow.
在这种方法中,基于图的编排框架使用节点表示不同的任务(例如 LLM 调用、工具调用或验证),并通过边来控制流程。从线性结构转向图结构,反映了数据管道和传统分布式系统的发展趋势。In this approach, graph-based harnesses use nodes to represent distinct tasks (such as LLM calls, tool invocations, or validations) and edges to govern the control flow. This shift from a linear structure to a graph mirrored the evolution seen in both data pipelines and traditional distributed systems.
基于图的系统的关键创新,不仅仅是增加分支,而是让控制流变得明确且声明式。开发者不再将逻辑隐式地嵌入提示词或代码中,而是定义可轻松检查、修改和推理的执行计划。这由此形成了一种推理循环控制流,LLM 可以借助图结构来路由并执行复杂且耗时较长的任务,尤其是在动态环境中。The key innovation of graph-based systems was not merely adding branches but making control flow explicit and declarative. Rather than embedding logic implicitly in prompts or code, developers defined execution plans that could be easily inspected, modified, and reasoned about. This created a reasoning-loop control flow in which the LLM could leverage the graph structure to route and execute complex, long-running tasks, often in dynamic environments.
对于许多复杂任务而言,采用单体式智能体应用并不可行。图系统推动了多智能体系统的兴起,这类系统由顶层智能编排器负责管理任务流程和依赖关系。向多智能体的转变,要求提供一等协议来建立智能体之间的异步通信,例如 A2A 和 ACP(后者最终并入了 A2A)。For many complex tasks, a single monolithic agent application was not tenable. Graph systems led to the emergence of multi-agent systems with a top-level intelligent orchestrator to manage task flow and dependencies. This transition to multiple agents required first-class protocols for establishing asynchronous agent-to-agent communication, like A2A and ACP (which eventually merged into A2A).

图 2:多智能体架构示例(来源:作者绘制)Figure 2: Representative Multi-agent Architecture (Source: created by author)
鉴于这些智能体存在认知局限,“人在回路中”(HITL)支持至关重要。智能体并非完全自主;相反,它们会在关键决策点向人工操作员寻求澄清、接收反馈或请求批准,从而在自主性与控制之间取得平衡。Given the cognitive limitations of these agents, "human in the loop" (HITL) support was essential. Agents were not fully autonomous; instead, they sought clarification, received feedback, or requested approvals from human operators at key decision points, balancing autonomy with control.
在 LinkedIn,我们通过复用现有的 LinkedIn 消息系统来实现编排和智能体间通信,以处理拆分为一系列消息的长时运行任务,确保消息按“先进先出”(FIFO)顺序可靠送达,并可无缝查询消息历史记录。这一基础提供了:At LinkedIn, we implemented orchestration and inter-agent communication by reusing the existing LinkedIn messaging system to handle long-lived tasks, broken into message sequences, ensuring guaranteed "First In, First Out" (FIFO) delivery and seamless message history lookup. This foundation provided:
- 通过多个消息线程实现并行处理。Parallelism via multiple message threads.
- 通过现有机制实现弹性,支持持久化重试和最终送达。Resilience through existing constructs for persistent retries and eventual delivery.
- 灵活的执行模式,允许代理以单个数据块的形式响应、同步流式传输,或跨多条消息异步流式传输。Flexible execution modalities, allowing agents to respond in a single chunk, synchronously streaming, or asynchronously streaming across multiple messages.
基于图的工作流构建于 LangGraph 之上,实现了多项关键功能,提升了系统的稳健性并改善了复杂性管理:The graph-based workflow was implemented atop LangGraph and enabled several critical functions that improved system robustness and complexity management:
- 条件执行允许根据中间结果进行路由和重新路由。Conditional execution allowed routing and re-routing based on intermediate results.
- 通过启用重试和回退机制,系统能够在发生故障时平稳恢复。Retries and fallbacks enabled the system to gracefully recover from failures.
- 状态管理使系统能够超越文本处理,并在整个流程中维护结构化的中间数据。State management allowed the system to move beyond text and maintain structured intermediate data across the flow.
- 通过显式验证(包括架构检查、业务规则或辅助模型)来避免盲目相信 LLM 的输出。Explicit validation, including schema checks, business rules, or secondary models, was used to avoid blindly trusting LLM outputs.
这些代理还需要先进的记忆能力,以便从用户交互中学习,并随着时间推移提供日益个性化、适应性更强且更有用的体验。在分布式多代理架构的基础上,我们能够将认知记忆本身建模为另一个代理,供应用代理集成使用。These agents also required advanced memory to learn from user interactions and support an increasingly personalized, adaptive, and useful experience over time. Building atop the distributed multi-agent architecture allowed us to model Cognitive Memory itself as another agent that application agents could integrate with.
这些创新促成了 Hiring Assistant 的推出及后续迭代。它是 LinkedIn 首个专为招聘人员设计的 AI 智能体。招聘人员可以选择将寻找候选人、协助审核申请者等耗时任务委托给 Hiring Assistant,从而专注于工作中最具战略性、以人为本的部分。These innovations enabled the launch and subsequent iterations of Hiring Assistant, LinkedIn’s first AI agent designed for recruiters. Recruiters can choose to delegate time-consuming tasks to Hiring Assistant, including finding candidates and assisting in applicant review, so that they can focus on the most strategic, people-centric parts of their job.
随着时间推移,我们逐渐认识到,要打造真正出色的智能体体验,光有能力强大的模型还不够。我们的智能体需要具备强大的领域智能,以丰富的组织背景信息为依托,并能够不断改进。这就需要通过记忆从交互中学习,持续为招聘人员提供更加个性化、适应性更强且更有用的体验。Over time, we realized that delivering a truly great agentic experience required more than a capable model. Our agent needed strong domain intelligence, grounded in a rich organizational context, and the ability to improve over time. This required memory to learn from interactions and support an increasingly personalized, adaptive, and useful experience for recruiters.
与链相比,图显著拓展了智能体能够处理的任务复杂度,但它们本质上仍受限于围绕人工定义的工作流构建的自动化方案。随着这些工作流和状态空间变得更加复杂,开发者面临越来越大的压力,不得不明确编码恢复路径、验证逻辑和边缘情况处理机制。这导致流程定义和评估框架变得脆弱、过于复杂,而且往往难以维护。僵化性也使基于图的方法不适用于无法清晰表达为确定性工作流的任务。While graphs significantly expanded the complexity of tasks agents could handle compared to chains, they remained fundamentally bounded automations built around human-defined workflows. As these workflows and state spaces grew more complex, developers faced increasing pressure to explicitly encode recovery paths, validation logic, and edge-case handling. This resulted in brittle, overly intricate, and often difficult-to-maintain flow definitions and evaluation frameworks. Rigidity also made graph-based approaches ill-suited to tasks that could not be cleanly expressed as deterministic workflows.
代码:将执行作为一等原语Code: Execution as a First-Class Primitive
智能体系统最近的一次重大飞跃,源于将代码而非提示词视为推理的主要媒介。编码框架不再只是要求模型用自然语言“深入思考”复杂问题,而是在沙箱环境中生成、执行并改进代码。The most recent leap in agentic systems has come from treating code, rather than prompts, as the primary medium of reasoning. Instead of simply asking the model to "think through" a complex problem in natural language, coding harnesses generate, execute, and refine code in a sandbox environment.
这消除了要求开发者定义复杂工作流这一根本性限制,转而允许智能体通过生成具有可验证输出的代码来“找到”解决方案。这些运行框架通常内置了用于规划、任务委派、访问记忆以及管理/压缩 token 的工具。This eliminates the fundamental limitation of asking developers to define intricate workflows and instead allows agents to "find" solutions by generating code with verifiable outputs. These harnesses often come with built-in tools for planning, task delegation, memory access, and token management/compaction.
LLM 生成的自然语言输出具有概率性,在经过后续验证步骤之前,本质上并不可信。然而,代码是确定性的:它要么能够编译、运行并输出正确结果,要么就会失败。这种明确的成败判断能提供紧密的反馈循环,从而大幅提升系统的可靠性。A natural language output from an LLM is probabilistic and, prior to subsequent validation steps, inherently untrustworthy. A piece of code, however, is deterministic. It either compiles, runs, and delivers the correct output, or it fails. This pass/fail clarity provides the tight feedback loops necessary to dramatically improve system reliability.
为确保安全性和正确性,该架构依赖四个核心组件:To ensure safety and correctness, this architecture relies on four core components:
- 执行沙箱:一种受控的隔离环境,可让生成的代码安全运行。Execution Sandbox: A controlled, isolated environment where the generated code can run safely.
- 仪器化与日志记录:在代码执行期间捕获所有输出、错误和中间状态以供检查的机制。Instrumentation and Logging: Mechanisms to capture all outputs, errors, and intermediate states during the code's execution for inspection.
- 验证框架:自动将生成代码的输出与预期正确性标准进行比对的单元测试、断言或检查。Validation Harness: Unit tests, assertions, or checks that automatically verify the generated code's output against expected correctness criteria.
- 迭代优化循环:代理会观察失败情况,系统地修改生成的代码,并自动重试执行,直到满足正确性标准。Iterative Refinement Loop: The agent observes failures, systematically modifies its generated code, and automatically retries execution until the correctness criteria are met.
在 LinkedIn,我们运用这种方法构建了一款内部工具,让开发人员、产品经理、数据科学家,甚至业务运营人员都能向智能体提出自然语言分析问题,并获得基于平台聚合数据和洞察的答案。该智能体在我们现有的隐私、访问控制和安全框架内运行,执行基于角色和用途的数据访问控制,在输出结果上叠加自动化治理审查,并通过经批准且合规的基础设施路由模型交互。At LinkedIn, we have used this approach to build an internal tool that allows developers, product managers, data scientists, and even business operations personnel to ask natural language analytical questions of an agent and receive answers grounded in aggregated platform data and insights. The agent operates within our existing privacy, access control, and security frameworks, enforcing role and purpose-based data access, layering automated governance review over outputs, and routing model interactions through approved, compliant infrastructure.
该代理将用户查询转换为声明式 SQL 和命令式 Python 代码的组合,在样例数据上执行,并根据严格的约束(包括隐私、可见性和治理检查)验证输出,然后循环迭代,直至满足所有正确性标准。The agent translates the user query into a combination of declarative SQL and imperative Python code, executes it against sample data, validates the outputs against strict constraints (including privacy, visibility, and governance checks), and iterates on it in a loop until all correctness criteria are met.
采用基于代码的方法缩短了产品上市时间,因为我们无需耗费大量精力来创建定制提示词、工具和工作流图,也不必通过多轮评估来对其进行微调。最终系统不仅更加可靠,而且可审计性和可复现性也显著提高。Using a code-based approach has resulted in a quicker time-to-market, since we’ve avoided the laborious work of creating bespoke prompts, tools, and workflow graphs, and running evaluation cycles to fine-tune them. The final system is not only more reliable but also significantly more auditable and reproducible.
构建稳健智能体 AI 架构的最佳实践Best Practices for Robust Agentic AI Architectures
无论你的智能体系统处于哪个阶段,从简单的链式流程到复杂的编码运行框架,某些基础原则都能将稳健的系统与脆弱的系统区分开来。Regardless of what stage your agentic system is at, from simple chains to complex coding harnesses, certain foundational principles separate robust systems from fragile ones.
- 将大语言模型的输出视为不可信输入:由于大语言模型的输出具有概率性,在影响任何下游逻辑之前,必须对其进行严格验证。切勿未经验证就信任文本输出;应先执行架构检查、业务与合规规则校验,或使用辅助模型进行检查,然后再继续。Treat LLM Outputs as Untrusted Input: Since the Large Language Model’s output is probabilistic, it must be rigorously validated before it influences any downstream logic. Never trust the text output without validation; apply schema checks, business and compliance rules, or secondary models before proceeding.
- 将规划与执行解耦:允许模型提出计划,但须在严格受控的软件框架内执行该计划。这种分离至关重要,因为它能显著提升透明度和系统控制能力。Decouple Planning from Execution: Allow the model to propose a plan, but execute that plan within a strictly controlled software framework. This separation is vital as it significantly improves both transparency and system control.
- 投资于可观测性:如果看不到复杂且高度非确定性系统的运行情况,就无法对其进行调试。健全的可观测性必须捕获详细信息,包括智能体执行各个步骤时的状态、执行轨迹和验证结果,同时适当地屏蔽敏感信息。Invest in Observability: You cannot debug a complex and highly non-deterministic system if you can't see what it's doing. Robust observability must capture detailed information, including the state at each step of agent execution, execution traces, and validation results, while appropriately masking sensitive information.
- 为持续改进而构建:智能体系统本质上是迭代式的,而非静态的。应构建稳健的反馈闭环,以捕获并分析失败情况,推动提示、策略和程序性记忆不断演进;同时大力投入评估与仿真环境,系统性地提升系统随时间推移的性能。Build for Continuous Improvement: Agentic systems are inherently iterative rather than static. Build robust feedback loops that capture and analyze failures, enable prompt, policy, and procedural memory evolution, and invest deeply in evaluation and simulation environments to systematically improve system performance over time.
选择合适的抽象层次Choosing the Right Abstraction
并非每个问题都值得引入图结构或编码框架所带来的运维复杂性。选择合适的抽象,归根结底是在任务复杂度、可靠性要求、可解释性、延迟和成本之间权衡。基本原则很简单:使用能够可靠解决问题的最简单系统。Not every problem justifies the operational complexity of graphs or coding harnesses. Selecting the right abstraction is ultimately an engineering tradeoff across task complexity, reliability requirements, explainability, latency, and cost. The fundamental principle is simple: Use the least complex system that reliably solves the problem.
对于范围狭窄、流程线性的任务,链式流程通常已足够:只需单次调用或有限的提示序列,就能产出可接受的结果。例如,起草客户支持回复、总结文档、审核内容,或从可预测的输入中提取结构化数据。这类系统通常延迟最低、计算成本也最低,因为它们尽量减少了模型调用、编排开销和状态管理。对于许多生产工作负载而言,链式流程仍是经济效率最高的选择,尤其是在需要快速迭代或大规模部署时。Chains are often sufficient for narrow, linear tasks where a single pass or a limited sequence of prompts can produce acceptable outcomes. Examples include drafting customer support responses, summarizing documents, moderating content, or extracting structured data from predictable inputs. These systems typically offer the lowest latency and compute cost because they minimize model calls, orchestration overhead, and state management. For many production workloads, chains remain the most economically efficient option, especially when rapid iteration or large-scale deployment is required.
当工作流需要条件分支、重试、调用工具或显式状态转换时,图就成为合适的选择。实际应用示例包括多步骤客户服务问题解决、企业 IT 自动化、合规流程,或根据中间输出触发不同操作的入职系统。图可以提高系统的韧性和运维控制能力,但也会通过编排层增加延迟,而且通常需要多次调用 LLM,从而增加服务成本和系统复杂度。它们处于两者之间:比链更可靠,但设计和运维成本也更高。Graphs become appropriate when workflows require conditional branching, retries, tool invocation, or explicit state transitions. Real-world examples include multi-step customer service resolution, enterprise IT automation, compliance pipelines, or onboarding systems where different actions are triggered based on intermediate outputs. While graphs improve resilience and operational control, they introduce additional latency through orchestration layers and often require multiple LLM invocations, increasing both serving cost and system complexity. They represent a middle ground: more reliable than chains, but more expensive to design and operate.
编码工具框架最适用于精确性、可验证性和可恢复性至关重要的领域。例如,软件工程智能体、金融分析系统、法律文档验证、科学工作流和基础设施自动化等场景中,生成的输出可以经过测试、编译、模拟或形式化验证。这类系统通常会产生最高的计算和延迟成本,因为它们需要反复进行推理、调用外部工具并执行验证流程。不过,在正确性远比速度或成本重要的环境中,它们能够提供最强的保障。Coding harnesses are best suited for domains where precision, verification, and recoverability are critical. Examples include software engineering agents, financial analysis systems, legal document validation, scientific workflows, and infrastructure automation, in which generated outputs can be tested, compiled, simulated, or formally validated. These systems frequently incur the highest compute and latency costs due to iterative reasoning loops, execution of external tools, and validation cycles. However, they provide the strongest guarantees in environments where correctness materially outweighs speed or cost.
随着模型不断改进、成本持续下降,过度设计的倾向仍是常见的失败模式。更复杂的抽象往往会让计算开销、延迟和运维复杂度增加得更快,却未能相应提升业务成效。As models improve and costs decline, the instinct to over-engineer remains a common failure mode. More sophisticated abstractions often increase compute spend, latency, and operational complexity faster than they improve business outcomes.
真正的优势来自有纪律地选择抽象层:部署能够满足可靠性、速度和成本要求的最简单系统。优秀的工程组织并非靠追求架构上的复杂精巧取胜,而是通过优化单位成本所能实现的能力取胜。The real advantage comes from disciplined abstraction selection: deploying the simplest system that meets reliability, speed, and cost requirements. Strong engineering organizations do not win by maximizing architectural sophistication; they win by optimizing capability per dollar.
结论Conclusion
智能体系统的迅速演进,促使开发者的角色发生了根本性变化。我们正见证着一种职业转变:从“提示词设计师”转向“系统架构师”。在基于链的 LLM 发展初期,成功往往取决于精心打磨出完美提示词的手艺。然而,随着系统逐渐发展为复杂的图结构和代码执行框架,关注重点已转向严谨的软件工程:设计执行流程、管理状态与依赖关系,以及构建健壮的验证和恢复机制。The rapid evolution of agentic systems has triggered a fundamental change in the role of the developer. We are witnessing a professional transition from the 'Prompt Designer' to the 'System Architect'. In the early days of chain-based LLMs, success often hinged on the artisanal skill of crafting the perfect prompt. However, as systems mature into complex graph and code harnesses, the focus has shifted to rigorous software engineering: designing execution flows, managing state and dependencies, and building robust validation and recovery mechanisms.
这一变革源于一个更宏大的目标:从“尽力而为”的思维转向“工程化可靠性”。早期系统将不可预测性视为固有约束,并对此予以容忍。现代智能体框架则要求更高:它们经过专门设计,力求在可能的情况下实现确定性,仅在必要时采用受控的非确定性,并具备明确的故障模式和预设的恢复路径。This change is rooted in a broader goal: moving from a "best-effort" mindset to one of "engineered reliability". Early systems tolerated unpredictability as an inherent constraint. Modern agentic harnesses demand better; they are engineered to aim for determinism wherever possible, use controlled nondeterminism only where necessary, and feature clear failure modes with defined recovery paths.
这一发展历程标志着 AI 智能体从尖端的边缘实验,演进为一流的生产级系统。其新颖之处不在于组件本身,而在于如何将概率模型集成到确定性框架中。This progression marks the evolution of AI agents from bleeding-edge fringe experiments into first-class production-grade systems. The novelty is not in the components themselves, but in how they integrate probabilistic models into deterministic frameworks.
这里的挑战与机遇在于,不要把这些系统当作神奇的黑箱,而要将它们视为软件系统,以对待任何其他关键基础设施的同等严谨态度进行设计和工程实践。The challenge and the opportunity here are to treat these systems not as magical black boxes, but as software systems that demand the same rigor, design, and engineering excellence as any other critical infrastructure.
| This article is part of the "Agentic AI Architecture" article series. In this series, we try to establish agentic AI architecture as a new type of software architecture that will likely dominate the industry for years to come. The articles, written by industry experts, cover various elements and aspects of agentic AI architecture. We aim to present the latest trends and developments shaping the new type of architecture as it enters the mainstream. |