Graph Engineering Explained — What It Is, When to Use, When Not To
- URL: https://x.com/anatolikopadze/status/2080668775796314331
- Date Saved: 2026-09-05
- Source: X (@AnatoliKopadze / Anatoli Kopadze) — Twitter Article
- Tags: ai-engineering
Summary
3.6K likes, 498 RT 的完整 Graph Engineering 教學文(13 章節)。與 Hanako 的 Loops & Graphs 文互補 — 本篇更偏入門教學和實操模板。
核心概念
- Node(節點)= 一個 job,定義好 input/output schema
- Edge(邊)= 真正的資料依賴,一個 node 的 output 餵另一個 node 的 input
- 你目前的「do A then B then C」已經是 graph — 只是最差的那種(單鏈)
Fake Edge Test(最值錢的一招)
- 檢查每條邊:下一步真的需要上一步的結果嗎?
- 如果不需要 → fake edge → 可以並行
- 幾乎任何 workflow 都有 2-3 條 fake edge = 免費的加速
The Diamond Pattern(唯一需要的模式)
- Fan out → Reduce → Synthesize
- Fan out:並行 workers 各自獨立 context 研究不同角度
- Reduce:用 code(不是 model)做 dedup/merge/rank
- Verify:fresh context 的 skeptic 驗證每個 finding
- Synthesize:一個 agent 寫最終報告
- Claude Research 功能就是在跑這個 pattern
Node Contract 設計
- 定義好 input schema 和 output schema
- free text output = 只有人能讀 = 無法串接
- fixed schema = 下一個 node 不用猜
Verifier Node
- 三個 skeptic 並行,各問不同問題:正確嗎?最新嗎?來源真實嗎?
- 多數通過才保留 finding
- 必須用 fresh context(不能看到 worker 的 chat)
常見陷阱
- 共享 workspace → workers 互相影響(用 git worktree 隔離)
- 1000 個結果直接灌進一個 step → 要分 batch 做 layered fan-in
- Silent failure:node 靜默失敗沒人發現 → fan-in guard 檢查返回數量
- 不是所有工作都適合 graph — 創意寫作/高度相依的推理鏈不需要
實操模板(附在文章中)
- Research graph:5 角度並行研究 → verify → merge → report
- Code audit:per-file 並行 → verify → dedup → report
- Content draft:並行 SERP 分析 + 問題收集 + gap 分析 → outline → draft
- Security hunt:並行 finders → dedup → verify → loop until nothing new
- Launch kit:並行 research → human gate → 並行 writing → verify
何時不用 Graph
- 工作本身是線性依賴的(每步真的需要上一步結果)
- 規模太小(3 步以內直接線性跑)
- 創意任務需要統一 voice