Graph Engineering:从循环工程到图编排,让多 Agent 协作像流水线一样丝滑

Graph Engineering:从循环工程到图编排,让多 Agent 协作像流水线一样丝滑

摘要:Graph Engineering(图工程)是 2026 年 AI Agent 编排领域最重要的新范式。本文将系统介绍其核心概念、解决的痛点、核心组成(节点、边、共享状态)以及五种常见图模式,并配有完整的拓扑图解。


📐 一、核心概念

Graph Engineering = 把多个 Agent、工具、函数和人工审核点,组织成一张可执行、可恢复、可观察的工作图。

它解决的不是"怎样让单个 Agent 更聪明",而是:

  • 谁先做?
  • 结果交给谁?
  • 失败退回哪里?
  • 什么时候必须停下来等人?

🔥 二、解决的痛点:从 Loop 到 Graph

在 Graph Engineering 出现之前,主流做法是 Loop Engineering(循环工程)------一个 Agent 在一个大循环里反复思考、行动、验证,直到任务完成。

但当任务变复杂时(调研、写作、审核、并行搜索、条件判断),一个循环就不够用了。

2.1 直观对比

复制代码
Loop Engineering(一维线性闭环)
┌─────────────────────────────────────┐
│                                     │
│    ┌─────────┐                      │
│    │  Agent  │ ← 思考·行动·验证     │
│    └────┬────┘                      │
│         │                           │
│         └───────────────────────────┘
│              循环往复直到完成

Graph Engineering(二维拓扑网络)
    ┌─────────┐        ┌─────────┐
    │ 调研Agent│───────→│ 审核Agent│
    └────┬────┘        └────┬────┘
         │                  │
         │            ┌─────┘ 不通过
         │            ↓
    ┌────┴────┐   ┌─────────┐
    │ 写作Agent│←──│ 回退重写 │
    └─────────┘   └─────────┘

2.2 详细对比表

维度 Loop Engineering Graph Engineering
结构 一维线性闭环 二维拓扑网络
分工 一个 Agent 干所有事 多个 Agent 各司其职
并行 ❌ 不支持 ✅ 支持多分支并行
容错 失败要全部重来 可局部重试 / 回退
可视化 黑盒 每一步有迹可循

🧩 三、核心组成

3.1 节点(Node)

每个节点负责一件事,是图中最小的执行单元:

复制代码
┌─────────────┐   ┌─────────────┐   ┌─────────────┐
│  🔍 调研Agent │   │  ✍️ 写作Agent │   │  ✓ 审核Agent  │
│   查询资料    │   │   生成内容    │   │   检查质量    │
└─────────────┘   └─────────────┘   └─────────────┘

3.2 边(Edge)

定义"这个节点做完后,下一步去哪",是图的"交通规则":

① 直通边
复制代码
┌─────┐      ┌─────┐
│  A  │─────→│  B  │
└─────┘      └─────┘
做完 A 自动执行 B
② 条件边
复制代码
        ┌─────┐
        │ 判断 │
        └──┬──┘
     成立 / \ 不成立
         /   \
    ┌───┐     ┌───┐
    │分支A│     │分支B│
    └───┘     └───┘
③ 并行边
复制代码
        ┌─────┐
        │触发 │
        └──┬──┘
      ┌────┴────┐
      ↓         ↓
   ┌─────┐   ┌─────┐
   │任务1│   │任务2│
   └──┬──┘   └──┬──┘
      └────┬────┘
           ↓
        ┌─────┐
        │ 汇合 │
        └─────┘
④ 回退边
复制代码
┌─────┐      ┌─────┐
│ 写作 │─────→│ 审核 │
└──▲──┘      └──┬──┘
   │            │ 不通过
   └────────────┘
      退回重写
边类型 作用 图示特征
直通边 做完 A 自动做 B 实线单向箭头
条件边 根据结果选分支 分叉箭头
并行边 同时触发多任务 多路发散
回退边 失败退回上游 虚线回环箭头

3.3 共享状态(Shared State)

沿边流动的**"公共笔记本"**,记录任务描述、草稿、研究笔记、审核意见。没有它,每个节点都像失忆症患者,从零开始。

复制代码
         ┌─────────────────────────────┐
         │      📓 共享状态池           │
         │  任务描述 | 草稿 | 研究笔记   │
         │  审核意见 | 中间结果         │
         └───────────┬─────────────────┘
                     │
      ┌──────────────┼──────────────┐
      ↓              ↓              ↓
┌──────────┐  ┌──────────┐  ┌──────────┐
│ 调研Agent │  │ 写作Agent │  │ 审核Agent │
│ 写入笔记  │  │ 读取+写入 │  │ 写入意见  │
└──────────┘  └──────────┘  └──────────┘

💡 关键洞察:共享状态让图具备"记忆"------节点 A 的输出自动成为节点 B 的输入,无需手动传参,整个工作流像一条有生命的数据河流。


🗺️ 四、五种常见的图模式

模式 1:顺序管道(Sequential Pipeline)

特点:A → B → C,数据单向流动,无分支无回环
#mermaid-svg-AeAqcE6ytJLBK4JV{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-AeAqcE6ytJLBK4JV .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-AeAqcE6ytJLBK4JV .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-AeAqcE6ytJLBK4JV .error-icon{fill:#552222;}#mermaid-svg-AeAqcE6ytJLBK4JV .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-AeAqcE6ytJLBK4JV .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-AeAqcE6ytJLBK4JV .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-AeAqcE6ytJLBK4JV .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-AeAqcE6ytJLBK4JV .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-AeAqcE6ytJLBK4JV .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-AeAqcE6ytJLBK4JV .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-AeAqcE6ytJLBK4JV .marker{fill:#333333;stroke:#333333;}#mermaid-svg-AeAqcE6ytJLBK4JV .marker.cross{stroke:#333333;}#mermaid-svg-AeAqcE6ytJLBK4JV svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-AeAqcE6ytJLBK4JV p{margin:0;}#mermaid-svg-AeAqcE6ytJLBK4JV .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-AeAqcE6ytJLBK4JV .cluster-label text{fill:#333;}#mermaid-svg-AeAqcE6ytJLBK4JV .cluster-label span{color:#333;}#mermaid-svg-AeAqcE6ytJLBK4JV .cluster-label span p{background-color:transparent;}#mermaid-svg-AeAqcE6ytJLBK4JV .label text,#mermaid-svg-AeAqcE6ytJLBK4JV span{fill:#333;color:#333;}#mermaid-svg-AeAqcE6ytJLBK4JV .node rect,#mermaid-svg-AeAqcE6ytJLBK4JV .node circle,#mermaid-svg-AeAqcE6ytJLBK4JV .node ellipse,#mermaid-svg-AeAqcE6ytJLBK4JV .node polygon,#mermaid-svg-AeAqcE6ytJLBK4JV .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-AeAqcE6ytJLBK4JV .rough-node .label text,#mermaid-svg-AeAqcE6ytJLBK4JV .node .label text,#mermaid-svg-AeAqcE6ytJLBK4JV .image-shape .label,#mermaid-svg-AeAqcE6ytJLBK4JV .icon-shape .label{text-anchor:middle;}#mermaid-svg-AeAqcE6ytJLBK4JV .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-AeAqcE6ytJLBK4JV .rough-node .label,#mermaid-svg-AeAqcE6ytJLBK4JV .node .label,#mermaid-svg-AeAqcE6ytJLBK4JV .image-shape .label,#mermaid-svg-AeAqcE6ytJLBK4JV .icon-shape .label{text-align:center;}#mermaid-svg-AeAqcE6ytJLBK4JV .node.clickable{cursor:pointer;}#mermaid-svg-AeAqcE6ytJLBK4JV .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-AeAqcE6ytJLBK4JV .arrowheadPath{fill:#333333;}#mermaid-svg-AeAqcE6ytJLBK4JV .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-AeAqcE6ytJLBK4JV .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-AeAqcE6ytJLBK4JV .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-AeAqcE6ytJLBK4JV .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-AeAqcE6ytJLBK4JV .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-AeAqcE6ytJLBK4JV .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-AeAqcE6ytJLBK4JV .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-AeAqcE6ytJLBK4JV .cluster text{fill:#333;}#mermaid-svg-AeAqcE6ytJLBK4JV .cluster span{color:#333;}#mermaid-svg-AeAqcE6ytJLBK4JV div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-AeAqcE6ytJLBK4JV .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-AeAqcE6ytJLBK4JV rect.text{fill:none;stroke-width:0;}#mermaid-svg-AeAqcE6ytJLBK4JV .icon-shape,#mermaid-svg-AeAqcE6ytJLBK4JV .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-AeAqcE6ytJLBK4JV .icon-shape p,#mermaid-svg-AeAqcE6ytJLBK4JV .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-AeAqcE6ytJLBK4JV .icon-shape .label rect,#mermaid-svg-AeAqcE6ytJLBK4JV .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-AeAqcE6ytJLBK4JV .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-AeAqcE6ytJLBK4JV .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-AeAqcE6ytJLBK4JV :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 节点 A
节点 B
节点 C

适用场景:数据清洗 → 特征提取 → 模型推理


模式 2:条件路由(Conditional Routing)

特点:根据中间结果动态选择路径
#mermaid-svg-zvxdKViT6LOMYQVD{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-zvxdKViT6LOMYQVD .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-zvxdKViT6LOMYQVD .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-zvxdKViT6LOMYQVD .error-icon{fill:#552222;}#mermaid-svg-zvxdKViT6LOMYQVD .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-zvxdKViT6LOMYQVD .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-zvxdKViT6LOMYQVD .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-zvxdKViT6LOMYQVD .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-zvxdKViT6LOMYQVD .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-zvxdKViT6LOMYQVD .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-zvxdKViT6LOMYQVD .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-zvxdKViT6LOMYQVD .marker{fill:#333333;stroke:#333333;}#mermaid-svg-zvxdKViT6LOMYQVD .marker.cross{stroke:#333333;}#mermaid-svg-zvxdKViT6LOMYQVD svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-zvxdKViT6LOMYQVD p{margin:0;}#mermaid-svg-zvxdKViT6LOMYQVD .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-zvxdKViT6LOMYQVD .cluster-label text{fill:#333;}#mermaid-svg-zvxdKViT6LOMYQVD .cluster-label span{color:#333;}#mermaid-svg-zvxdKViT6LOMYQVD .cluster-label span p{background-color:transparent;}#mermaid-svg-zvxdKViT6LOMYQVD .label text,#mermaid-svg-zvxdKViT6LOMYQVD span{fill:#333;color:#333;}#mermaid-svg-zvxdKViT6LOMYQVD .node rect,#mermaid-svg-zvxdKViT6LOMYQVD .node circle,#mermaid-svg-zvxdKViT6LOMYQVD .node ellipse,#mermaid-svg-zvxdKViT6LOMYQVD .node polygon,#mermaid-svg-zvxdKViT6LOMYQVD .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-zvxdKViT6LOMYQVD .rough-node .label text,#mermaid-svg-zvxdKViT6LOMYQVD .node .label text,#mermaid-svg-zvxdKViT6LOMYQVD .image-shape .label,#mermaid-svg-zvxdKViT6LOMYQVD .icon-shape .label{text-anchor:middle;}#mermaid-svg-zvxdKViT6LOMYQVD .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-zvxdKViT6LOMYQVD .rough-node .label,#mermaid-svg-zvxdKViT6LOMYQVD .node .label,#mermaid-svg-zvxdKViT6LOMYQVD .image-shape .label,#mermaid-svg-zvxdKViT6LOMYQVD .icon-shape .label{text-align:center;}#mermaid-svg-zvxdKViT6LOMYQVD .node.clickable{cursor:pointer;}#mermaid-svg-zvxdKViT6LOMYQVD .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-zvxdKViT6LOMYQVD .arrowheadPath{fill:#333333;}#mermaid-svg-zvxdKViT6LOMYQVD .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-zvxdKViT6LOMYQVD .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-zvxdKViT6LOMYQVD .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-zvxdKViT6LOMYQVD .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-zvxdKViT6LOMYQVD .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-zvxdKViT6LOMYQVD .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-zvxdKViT6LOMYQVD .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-zvxdKViT6LOMYQVD .cluster text{fill:#333;}#mermaid-svg-zvxdKViT6LOMYQVD .cluster span{color:#333;}#mermaid-svg-zvxdKViT6LOMYQVD div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-zvxdKViT6LOMYQVD .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-zvxdKViT6LOMYQVD rect.text{fill:none;stroke-width:0;}#mermaid-svg-zvxdKViT6LOMYQVD .icon-shape,#mermaid-svg-zvxdKViT6LOMYQVD .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-zvxdKViT6LOMYQVD .icon-shape p,#mermaid-svg-zvxdKViT6LOMYQVD .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-zvxdKViT6LOMYQVD .icon-shape .label rect,#mermaid-svg-zvxdKViT6LOMYQVD .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-zvxdKViT6LOMYQVD .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-zvxdKViT6LOMYQVD .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-zvxdKViT6LOMYQVD :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 条件成立
条件不成立
输入
判断条件
分支 A
分支 B

适用场景:技术问题走技术分支,业务问题走业务分支


模式 3:并行分支(Parallel Branching)

特点:多个子任务同时执行,完成后汇合,大幅缩短总耗时
#mermaid-svg-Z4Wfxpd4e9YR0ZDx{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .error-icon{fill:#552222;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .marker{fill:#333333;stroke:#333333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .marker.cross{stroke:#333333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx p{margin:0;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .cluster-label text{fill:#333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .cluster-label span{color:#333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .cluster-label span p{background-color:transparent;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .label text,#mermaid-svg-Z4Wfxpd4e9YR0ZDx span{fill:#333;color:#333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .node rect,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .node circle,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .node ellipse,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .node polygon,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .rough-node .label text,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .node .label text,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .image-shape .label,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .icon-shape .label{text-anchor:middle;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .rough-node .label,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .node .label,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .image-shape .label,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .icon-shape .label{text-align:center;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .node.clickable{cursor:pointer;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .arrowheadPath{fill:#333333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .cluster text{fill:#333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .cluster span{color:#333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx rect.text{fill:none;stroke-width:0;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .icon-shape,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .icon-shape p,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .icon-shape .label rect,#mermaid-svg-Z4Wfxpd4e9YR0ZDx .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-Z4Wfxpd4e9YR0ZDx :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 开始
任务 1
任务 2
汇合
结束

适用场景:同时调用多个搜索引擎、并行处理多个数据源


模式 4:循环迭代(Loop Iteration)

特点:审核不通过就退回重写,直到满足质量标准
#mermaid-svg-3b6Z7Xhu0lCuKfA8{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .error-icon{fill:#552222;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .marker.cross{stroke:#333333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 p{margin:0;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .cluster-label text{fill:#333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .cluster-label span{color:#333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .cluster-label span p{background-color:transparent;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .label text,#mermaid-svg-3b6Z7Xhu0lCuKfA8 span{fill:#333;color:#333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .node rect,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .node circle,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .node ellipse,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .node polygon,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .rough-node .label text,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .node .label text,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .image-shape .label,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .icon-shape .label{text-anchor:middle;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .rough-node .label,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .node .label,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .image-shape .label,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .icon-shape .label{text-align:center;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .node.clickable{cursor:pointer;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .arrowheadPath{fill:#333333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .cluster text{fill:#333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .cluster span{color:#333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 rect.text{fill:none;stroke-width:0;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .icon-shape,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .icon-shape p,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .icon-shape .label rect,#mermaid-svg-3b6Z7Xhu0lCuKfA8 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-3b6Z7Xhu0lCuKfA8 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} ❌ 不通过
✅ 通过
写作
审核
发布

适用场景:内容生成后的质量审核、代码审查后的修复


模式 5:子图嵌套(Subgraph Nesting)

特点:复杂模块封装成子图复用,像搭积木一样组合工作流
#mermaid-svg-be1nptl3C92WIpYb{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-be1nptl3C92WIpYb .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-be1nptl3C92WIpYb .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-be1nptl3C92WIpYb .error-icon{fill:#552222;}#mermaid-svg-be1nptl3C92WIpYb .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-be1nptl3C92WIpYb .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-be1nptl3C92WIpYb .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-be1nptl3C92WIpYb .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-be1nptl3C92WIpYb .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-be1nptl3C92WIpYb .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-be1nptl3C92WIpYb .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-be1nptl3C92WIpYb .marker{fill:#333333;stroke:#333333;}#mermaid-svg-be1nptl3C92WIpYb .marker.cross{stroke:#333333;}#mermaid-svg-be1nptl3C92WIpYb svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-be1nptl3C92WIpYb p{margin:0;}#mermaid-svg-be1nptl3C92WIpYb .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-be1nptl3C92WIpYb .cluster-label text{fill:#333;}#mermaid-svg-be1nptl3C92WIpYb .cluster-label span{color:#333;}#mermaid-svg-be1nptl3C92WIpYb .cluster-label span p{background-color:transparent;}#mermaid-svg-be1nptl3C92WIpYb .label text,#mermaid-svg-be1nptl3C92WIpYb span{fill:#333;color:#333;}#mermaid-svg-be1nptl3C92WIpYb .node rect,#mermaid-svg-be1nptl3C92WIpYb .node circle,#mermaid-svg-be1nptl3C92WIpYb .node ellipse,#mermaid-svg-be1nptl3C92WIpYb .node polygon,#mermaid-svg-be1nptl3C92WIpYb .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-be1nptl3C92WIpYb .rough-node .label text,#mermaid-svg-be1nptl3C92WIpYb .node .label text,#mermaid-svg-be1nptl3C92WIpYb .image-shape .label,#mermaid-svg-be1nptl3C92WIpYb .icon-shape .label{text-anchor:middle;}#mermaid-svg-be1nptl3C92WIpYb .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-be1nptl3C92WIpYb .rough-node .label,#mermaid-svg-be1nptl3C92WIpYb .node .label,#mermaid-svg-be1nptl3C92WIpYb .image-shape .label,#mermaid-svg-be1nptl3C92WIpYb .icon-shape .label{text-align:center;}#mermaid-svg-be1nptl3C92WIpYb .node.clickable{cursor:pointer;}#mermaid-svg-be1nptl3C92WIpYb .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-be1nptl3C92WIpYb .arrowheadPath{fill:#333333;}#mermaid-svg-be1nptl3C92WIpYb .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-be1nptl3C92WIpYb .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-be1nptl3C92WIpYb .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-be1nptl3C92WIpYb .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-be1nptl3C92WIpYb .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-be1nptl3C92WIpYb .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-be1nptl3C92WIpYb .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-be1nptl3C92WIpYb .cluster text{fill:#333;}#mermaid-svg-be1nptl3C92WIpYb .cluster span{color:#333;}#mermaid-svg-be1nptl3C92WIpYb div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-be1nptl3C92WIpYb .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-be1nptl3C92WIpYb rect.text{fill:none;stroke-width:0;}#mermaid-svg-be1nptl3C92WIpYb .icon-shape,#mermaid-svg-be1nptl3C92WIpYb .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-be1nptl3C92WIpYb .icon-shape p,#mermaid-svg-be1nptl3C92WIpYb .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-be1nptl3C92WIpYb .icon-shape .label rect,#mermaid-svg-be1nptl3C92WIpYb .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-be1nptl3C92WIpYb .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-be1nptl3C92WIpYb .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-be1nptl3C92WIpYb :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 📦 子图:内容生产模块
调研
写作
输入
输出

适用场景:将"调研→写作→审核"封装为可复用的内容生产子图


🎯 五、总结

Graph Engineering 不是让单个 Agent 更聪明,而是让多个 Agent 协作得像一支训练有素的乐队------每个人知道自己该什么时候上场、该把接力棒传给谁、出错时怎么优雅地重来。

特性 说明
可执行 每个节点都能被引擎调度
可恢复 断点续传,局部重试
可观察 每一步都有迹可循

📚 相关框架推荐

  • LangGraph:LangChain 生态的图编排框架
  • Google ADK:Google 的 Agent 开发套件,原生支持图结构
  • CrewAI:多 Agent 协作框架

如果本文对你有帮助,欢迎 点赞 👍、收藏 ⭐、关注 🔖,一起在 Graph Engineering 的道路上探索前行!

相关推荐
rongcj2 小时前
开源之争,撕裂硅谷
ai
咖啡星人k3 小时前
【无标题】
前端·ai·github
GISer_Jing4 小时前
前端转全栈须知后端知识
前端·后端·ai·前端框架
JaydenAI5 小时前
[A2A协议与实现-08]基于MAF的A2A Server设计与实现
ai·agent·a2a·maf
wu8587734576 小时前
从 Prompt 到 Loop:拆解 AI 工程化四范式的演进逻辑与落地边界
人工智能·ai·prompt·aigc·ai编程
老猿AI洞察7 小时前
三万Token的底牌:Claude Opus 5提示词泄露,揭开AI“灵魂“的每一道锁
人工智能·ai
俊哥V7 小时前
每日 AI 研究简报 · 2026-07-26
人工智能·ai