图工程入门:为 AI 工作流建模,该并行时就并行
作者把多 Agent 工作流设计归纳为“图工程”:节点承担单一任务并约定输入输出,边传递真实数据,再用“假边测试”筛掉无意义的顺序等待。核心模式是菱形:fan out 并行调研、reduce 用纯代码压缩、synthesize 由单个 agent 汇总,且验证器必须用全新 context 独立质疑工人的产出。文章给出 Claude Code 用 “workflow” 触发词构建动态工作流的方法,以及市场扫描、SEO 草稿、代码审计等可粘贴模板;同时承认三种失效模式——上下文坍缩、伪独立、静默节点失败。成本部分引用了 Bun 重写案例:约 50 个工作流、64 个并发 agent、11 天花费约 16.5 万美元。适合想从线性提示转向并行编排的 AI 工程师,是一份偏入门的实操指南。

Most people are using AI at 5 to 10% of what it can actually do. There is a faster way, and it is bigger than it looks. Learn it, and you can optimize enormous processes, not just personal tasks.
This is the skill behind real roles at large companies. The difference between doing one job, and designing how a hundred of them get done.
I got lucky with it early. When I studied at one of the best universities in Denmark, we had a whole course on one thing: how to lay a process out as a diagram and make it as efficient as possible.
Back then it felt abstract. Now it is the exact thing the top AI engineers are arguing about on your timeline.
By the end of this article you will understand Graph Engineering better than almost anyone you follow: what a graph actually is, the one test that instantly makes your AI faster, the single pattern that pays for itself, where these things quietly break, when a graph is the wrong tool, and how to build a real one yourself in a couple of minutes.
Before we get into it, follow me on X and join my Telegram channel I just created where I post more AI content every day. Both are free.
X - https://x.com/AnatoliKopadze
Telegram - https://t.me/kopadzemp

大多数人只用到了 AI 实际能力的 5% 到 10%。还有一条更快的路,而且它看起来比实际更大。学会它,你就能优化庞大的流程,而不仅仅是个人任务。
这才是大公司里真实岗位背后的技能。区别在于:是亲自做完一件事,还是设计一百件事如何被完成。
我很早就接触到了它。在丹麦一所顶尖大学读书时,我们有一整门课只讲一件事:如何把一个流程画成图,并让它尽可能高效。
当时感觉很抽象。如今,这恰恰是你信息流里顶级 AI 工程师们正在争论的东西。
读完这篇文章,你会比大多数关注对象更懂图工程:图到底是什么、一个立刻让 AI 变快的测试、一个能回本的模式、这些东西会在哪里悄悄失效、什么时候图是错误工具,以及如何在几分钟内亲手构建一个真正的图。
在进入正题之前,先到 X 上关注我,并加入我刚刚创建的 Telegram 频道,我每天都会发布更多 AI 内容。两者都免费。
X - https://x.com/AnatoliKopadze
Telegram - https://t.me/kopadzemp
A month ago the whole field was talking about loops. Then Peter Steinberger posted the line above, and a corner of the internet that had just finished learning loops declared them old news overnight.
The joke landed because it was half true. If you have read my Loops article, you already have the foundation. A loop is one agent improving one thing on repeat: try, check, adjust, go again. That was the skill of last month.
What everyone moved to is not a better loop. It is a graph of loops, a network where cycles watch and correct each other instead of one agent chasing one number alone.
And engineers pushed back on the hype within hours, pointing out this is a decades-old idea wearing a new name. They are right, and that is the good news. A pattern that has run critical systems for thirty years is exactly what you want to trust with your work.
一个月前,整个领域还在谈论循环。随后 Peter Steinberger 贴出了上面那句话,刚刚学完循环的那一小块互联网一夜之间就宣布循环过时了。
这个玩笑能成立,是因为它有一半是真的。如果你读过我的 Loops 文章,你已经有基础了。循环是一个智能体反复改进同一件事:尝试、检查、调整、再来一次。那是上个月的技能。
大家转向的并不是更好的循环,而是循环的图:一个网络,让各个周期互相观察、互相纠正,而不是一个智能体孤零零地追一个数字。
几个小时内,工程师们就对这股热潮提出反驳,指出这只是个换了个新名的几十年前的老想法。他们说得对,而这正是好消息。一个已经让关键系统稳定运行三十年的模式,正是你愿意把工作托付给它的东西。
A graph is just a plan for your AI work, drawn out so you can see it. It answers two questions: which jobs need to happen, and which job has to wait for which.
There are only two parts, and getting them straight fixes most of the confusion.
A box is called a node. It's one job: one agent doing one task, with one thing going in and one thing coming out. Researching a competitor. Writing a draft. Checking a claim.
An arrow is called an edge. It just means one job needs what another job produced, so it has to wait for it. And the arrow only counts when something real actually passes along it.

Nodes do the thinking. Edges carry the results. That is the entire vocabulary. Once you have it, you never need a definition again.
图只是你为 AI 工作画出来的一份计划,让你能看清全局。它回答两个问题:哪些任务需要发生,哪个任务必须等哪个任务先完成。
图只有两个组成部分,把它们理清,大部分困惑就消失了。
方框叫节点。它代表一项任务:一个智能体做一件事,有输入、有输出。调研竞争对手、写初稿、核实一个说法,都是节点。
箭头叫边。它只表示一个任务需要另一个任务产出的东西,所以必须等待。而且只有当真正有实际内容沿箭头传递时,这条边才算数。

节点负责思考,边负责传递结果。这就是全部词汇。一旦掌握,你就不再需要任何定义。
The thing that makes a node actually usable in a graph is a contract: one bounded job, a defined input, a defined output. A node whose output is a wall of free text is a node only a human can read. A node with a fixed output shape is one the next node can consume without guessing, which is the whole point.
▸ NODE CONTRACT
JOB: research one competitor's pricing (one job, nothing else)
IN: { competitor: "name", url: "https://..." } ← passed in, never assumed
OUT: { price: number, plan: string, source: url, date: "YYYY-MM-DD" }
SCHEMA: enforced. if the agent returns free text, it's rejected and retried
WHY: a defined output is what lets the next node read this one
without a human in the middle. that is what makes it wire-able.
让节点在图中真正可用的,是契约:一个有边界的任务、明确的输入、明确的输出。如果节点输出的是一大段自由文本,那这个节点只有人能读懂;而固定输出形状的节点,下一个节点无需猜测就能消费——这正是意义所在。
▸ NODE CONTRACT
JOB: research one competitor's pricing (one job, nothing else)
IN: { competitor: "name", url: "https://..." } ← passed in, never assumed
OUT: { price: number, plan: string, source: url, date: "YYYY-MM-DD" }
SCHEMA: enforced. if the agent returns free text, it's rejected and retried
WHY: a defined output is what lets the next node read this one
without a human in the middle. that is what makes it wire-able.
Look at the AI workflow you run today and walk it step by step. At each step, ask one thing: does this step actually need the result of the one before it?
If yes, the edge is real. Keep the order. If no, there is no edge, and the wait is wasted. Those two jobs can run at the same time.
Take a simple one: "review file A for bugs, then review file B for bugs." It reads like a sequence, but the check on file B never looks at what file A returned. They only run one after another because that is the order you typed them in. Run them side by side and the whole thing finishes in the time of the slower single file, not the two added together.
You will find two or three of these fake edges in almost any workflow you draw. Every one of them is time you are throwing away for free.

把你今天跑的 AI 工作流拿出来,一步步走一遍。每一步只问一件事:这一步真的需要上一步的结果吗?
如果需要,这条边就是真的,保持顺序。如果不需要,那就不存在边,等待就是浪费。这两个任务可以同时运行。
举个简单的例子:“先审查文件 A 的 bug,再审查文件 B 的 bug。”读起来像是一个顺序,但对文件 B 的检查永远不会看文件 A 返回了什么。它们之所以先后执行,只是因为你输入的先后顺序。让它们并排跑,整个任务会在更慢的那个文件的耗时内完成,而不是两者相加。
几乎在你画出的任何工作流中,都能找到两三条这样的伪边。每一条都是你在白白扔掉的时间。

When you write an agent as "do A, then B, then C, then D," you have technically already drawn a graph. It is just the saddest possible one: a single straight chain where every node has one arrow in and one arrow out.
It runs correctly. It also runs slowly and breaks easily, because a chain has no redundancy. If C stalls, D never happens, and A's work is trapped upstream with nowhere to go.
The first real skill of graph engineering is redrawing that chain. Take your linear workflow, and for each arrow, ask the fake-edge question. Cut the arrows that carry no data, and the line collapses into something wider: a few independent jobs that can all run at once, feeding one job that needs them all.
The reason this matters is not cosmetic. A linear workflow with 40 steps has 40 points of sequential failure and the latency of all 40 added together. The same 40 jobs drawn as a graph have only as many real dependencies as actually exist, usually three to five, and finish at the speed of your slowest layer, not the sum of everything. That is the difference between a job that takes five minutes and one that takes fifteen seconds, running the exact same work.
The model was never the bottleneck. The line you drew was.
当你把一个智能体写成“做 A,然后 B,然后 C,然后 D”时,技术上你已经画了一张图。它只是最可悲的那种:一条直线链,每个节点一条入边、一条出边。
它能正确运行,但也慢、容易断,因为链没有冗余。如果 C 卡住,D 就不会发生,A 的工作被困在上游无处可去。
图工程的第一个真正技能就是重画这条链。把你的线性流程拿过来,对每条边问那个伪边问题。剪掉不携带数据的箭头,这条线就会塌缩成更宽的形态:几个可以同时运行的独立任务,最终汇入一个需要它们全部结果的任务。
这事关紧要,不是因为好看。一个有 40 步的线性流程有 40 个串联故障点,延迟是 40 步相加。同样的 40 个任务画成图,只保留实际存在的依赖(通常三到五个),完成速度取决于你最慢的那一层,而不是所有步骤之和。这就是同样的工作,一个要 5 分钟、另一个只要 15 秒的区别。
模型从来不是瓶颈。你画的那条线才是。
You do not need a hundred shapes. Watch any serious agent system work and the same picture keeps appearing. The work splits, several workers dig side by side, something checks what they found, and everything merges back into one answer.
That picture is called the diamond, and it is close to the only pattern you need this year. Its formal name is worth memorizing: fan out, reduce, synthesize.
Fan out to gather breadth, reduce with plain code to compress it, synthesize with a final agent to write the answer.

The research feature inside Claude runs exactly this in production. One lead plans the angles, workers gather in parallel, findings get checked, and only then does one report reach you. Once you can see the diamond, you stop asking "how do I make my agent do more steps" and start asking "where is the split, where is the merge." That second question is the one that scales.
Here is what the diamond actually looks like under the hood. When you say "workflow," Claude writes a short script like this itself and runs the coordination as code, which is why passing results between agents costs zero extra context.
// a market-scan graph — the diamond, written by Claude when you say "workflow"
const angles = [
"pricing vs the top 3 competitors",
"what buyers complain about in reviews",
"the feature gaps in the category",
"where the market moves in the next 12 months",
];
// FAN OUT — one researcher per angle, all at the same time
const raw = await parallel(
angles.map(a => () => agent({
task: `research: ${a}. every claim needs a source url + date.`,
schema: Finding, // validated output, not free text
model: "cheap", // boring node → cheap model
}))
);
// REDUCE — plain code, no model, no tokens
const findings = dedupeBySource(raw.flat().filter(Boolean));
// VERIFY — a FRESH skeptic per finding, tries to kill it
const survivors = await parallel(
findings.map(f => () => agent({
task: "try to disprove this. return keep | drop + why.",
input: f,
freshContext: true, // never reuse the researcher's chat
model: "strong", // judgment node → strong model
}))
).then(v => findings.filter((_, i) => v[i].verdict === "keep"));
// SYNTHESIZE — one agent writes the answer from what survived
return agent({ task: "one report, ranked by confidence, sources attached.",
input: survivors, model: "strong" });
Read it once and the whole craft is visible: the fan-out where work is independent, the reduce done in free code, the verify on a fresh context, cheap models on the boring nodes and the strong one where judgment lives and a single synthesize at the end. Same skeleton behind a market scan, a code review, or a research report. Swap the angles and the prompts.
你不需要一百种形状。观察任何一个严肃的智能体系统,你会发现同样的画面反复出现:工作被拆分,几个工人并排挖掘,某个东西检查他们找到的结果,然后所有结果合并成一个答案。
这个画面叫菱形,它几乎是你今年唯一需要的模式。它的正式名称值得记住:扇出、归约、综合。
扇出获得广度,用普通代码归约压缩,再用一个最终智能体综合写出答案。

Claude 里的研究功能在生产环境正是这样运行的。一个主导者规划角度,多个工人并行收集,发现被检查,最后才有一份报告送到你手里。一旦你能看见菱形,你就不会再问“怎么让我的智能体多跑几步”,而是开始问“拆分在哪里,合并在哪里”。第二个问题才是能扩展的问题。
下面是菱形在引擎盖下的真实样子。当你说“workflow”时,Claude 自己会写出像下面这样的短脚本,并以代码的形式运行协调,这就是为什么智能体之间传递结果不消耗额外上下文。
// a market-scan graph — the diamond, written by Claude when you say "workflow"
const angles = [
"pricing vs the top 3 competitors",
"what buyers complain about in reviews",
"the feature gaps in the category",
"where the market moves in the next 12 months",
];
// FAN OUT — one researcher per angle, all at the same time
const raw = await parallel(
angles.map(a => () => agent({
task: `research: ${a}. every claim needs a source url + date.`,
schema: Finding, // validated output, not free text
model: "cheap", // boring node → cheap model
}))
);
// REDUCE — plain code, no model, no tokens
const findings = dedupeBySource(raw.flat().filter(Boolean));
// VERIFY — a FRESH skeptic per finding, tries to kill it
const survivors = await parallel(
findings.map(f => () => agent({
task: "try to disprove this. return keep | drop + why.",
input: f,
freshContext: true, // never reuse the researcher's chat
model: "strong", // judgment node → strong model
}))
).then(v => findings.filter((_, i) => v[i].verdict === "keep"));
// SYNTHESIZE — one agent writes the answer from what survived
return agent({ task: "one report, ranked by confidence, sources attached.",
input: survivors, model: "strong" });
读一遍,整个手艺就清楚了:在独立之处扇出,用免费代码完成归约,在新上下文上验证,无聊节点用便宜模型、需要判断的地方用强模型,最后再单独做一次综合。市场扫描、代码审查或研究报告,背后都是同一副骨架。换一下角度和提示词即可。
Now the part almost everyone skips, and it is what separates a real graph from an expensive toy.
Every serious test of AI self-review says the same thing: models miss most of their own mistakes. A model grading its own work is far too easy on itself.
So you never let the agent that did the work check the work.
You put a separate node on the edge. Its only job is to try to kill the finding before it moves on. If it survives, it passes. If not, it dies right there.
Here is the catch nobody names: that checker needs a clean context.
Give it the same chat the worker had and it is not checking anything, it is nodding along to itself in a different font. A graph of agents sharing one context is just a single loop in a costume, and it breaks the same way, only later and pricier.
So make the verifier fresh. Own context. Checking a real signal, not "did the agent say it is done" but "does the test actually pass."
Then split the checking three ways. Is it correct? Is it current? Is the source even real? Three different lenses catch what ten identical ones miss.
▸ VERIFIER NODE
INPUT: one finding from a worker (the finding only, never the worker's chat)
CONTEXT: fresh and empty. it has not seen the work it is judging
CHECKS: three skeptics run in parallel, each with a different question
1. is it correct? → does the claim actually hold up
2. is it current? → is the source recent, not something stale
3. is the source real? → does the link resolve to the claim it's cited for
PASS: keep the finding only if a majority of skeptics let it live
FAIL: drop it before it ever reaches the final answer
The rule to remember: a worker and its verifier must never share a context. The moment they do, you are back to one loop grading its own homework, just with a bigger bill.
接下来是几乎所有人都会跳过、也正因如此才把真正的图与昂贵的玩具区分开的部分。
每一项认真的 AI 自我审查测试都给出同样的结论:模型会漏掉自己大部分错误。让模型给自己的作业打分,它对自己太宽容了。
所以你永远不要让干活的智能体检查自己的活。
你要在边上放一个独立节点。它的唯一任务,是在发现继续往前传之前设法杀死它。如果它活下来,就通过;如果没活下来,就地淘汰。
这里有个没人点破的陷阱:检查器需要干净的上下文。
如果你把工人用过的同一个对话给它,它什么也没在检查,只是在用另一种字体跟着自己点头。一群共享上下文的智能体,不过是一条穿了戏服的循环,而且它以同样的方式崩溃,只是更晚、更贵。
所以让验证者保持全新:自己的上下文。检查真实的信号,不是“智能体说它完成了”,而是“测试真的通过了吗”。
然后把检查拆成三路:它正确吗?它是最新的吗?来源是真的吗?三种不同的镜头能捕捉到十个相同镜头错过的东西。
▸ VERIFIER NODE
INPUT: one finding from a worker (the finding only, never the worker's chat)
CONTEXT: fresh and empty. it has not seen the work it is judging
CHECKS: three skeptics run in parallel, each with a different question
1. is it correct? → does the claim actually hold up
2. is it current? → is the source recent, not something stale
3. is the source real? → does the link resolve to the claim it's cited for
PASS: keep the finding only if a majority of skeptics let it live
FAIL: drop it before it ever reaches the final answer
要记住的规则:工人和它的验证者绝不能共享上下文。一旦共享,你就又回到一个循环给自己的作业打分,只不过账单更大。
- Context collapse.
Fan out a thousand nodes, then try to feed all thousand outputs into one final step, and you blow past the context window before synthesis even starts.
The fix: layer your fan-in. Batch the results, summarize each batch, then combine the summaries, never the raw pile.
// layered fan-in — never pour 1,000 raw outputs into one step
const batches = chunk(results, 40); // groups of 40
const summaries = await parallel(
batches.map(b => () => agent({ task: "summarize this batch", input: b }))
);
return agent({ task: "write the answer from the summaries", input: summaries });
// the final step reads ~25 summaries, not 1,000 raw outputs
- 上下文坍缩。
扇出一千个节点,再试图把这一千个输出一次性喂给最后一步,你会在综合开始之前就撑爆上下文窗口。
解法:分层收拢。把结果分批,先总结每一批,再合并这些总结,永远不要把原始堆一次倒入。
// layered fan-in — never pour 1,000 raw outputs into one step
const batches = chunk(results, 40); // groups of 40
const summaries = await parallel(
batches.map(b => () => agent({ task: "summarize this batch", input: b }))
);
return agent({ task: "write the answer from the summaries", input: summaries });
// the final step reads ~25 summaries, not 1,000 raw outputs
- False independence.
Two nodes look independent because their prompts never mention each other, but they both write to the same file or hit the same rate-limited API. That is a hidden edge.
When Bun's team first fanned a big job across many agents, they shared one workspace and overwrote each other.
The fix: give every worker its own isolated space, and audit for shared resources, not just shared data.
// isolate the workers — no shared file, no shared workspace
await parallel(files.map(f => () => agent({
task: `refactor ${f}`,
worktree: true, // each agent works in its own git worktree
})));
// they can't overwrite each other, then the results merge cleanly
// rule: any two nodes writing the same file need an edge, not parallelism
- 假性独立。
两个节点看起来互不依赖,因为它们的提示词从未提到对方,但它们都写同一个文件,或都命中同一个限流 API。那就是一条隐藏的边。
Bun 团队第一次把一个大任务扇出到多个智能体时,他们共享一个工作区,结果互相覆盖。
解法:给每个工人自己独立的空间,并且审计共享资源,而不只是共享数据。
// isolate the workers — no shared file, no shared workspace
await parallel(files.map(f => () => agent({
task: `refactor ${f}`,
worktree: true, // each agent works in its own git worktree
})));
// they can't overwrite each other, then the results merge cleanly
// rule: any two nodes writing the same file need an edge, not parallelism
- Silent node failure.
In a chain, one failure stops everything, annoying but obvious. In a graph, one dead node among two hundred can slip into a report that looks complete.
The fix: every merge step counts its inputs against the number it expected, and flags the gap instead of quietly running on half the data.
// fan-in guard — catch the node that quietly died
const results = (await parallel(jobs)).filter(Boolean); // dropped nodes = null
if (results.length < jobs.length) {
flag(`WARNING: ${jobs.length - results.length} of ${jobs.length} nodes returned nothing`);
}
// never synthesize on a partial set and call the report complete
- 静默节点失败。
在链里,一个失败会让一切停止,烦人但显而易见。在图中,两百个节点里死掉一个,可能悄悄溜进一份看似完整的报告。
解法:每个合并步骤都要清点实际输入数量与预期数量,并在有缺口时发出标记,而不是安静地跑在半份数据上。
// fan-in guard — catch the node that quietly died
const results = (await parallel(jobs)).filter(Boolean); // dropped nodes = null
if (results.length < jobs.length) {
flag(`WARNING: ${jobs.length - results.length} of ${jobs.length} nodes returned nothing`);
}
// never synthesize on a partial set and call the report complete
As tradition goes for my articles, let's honestly figure out who this could even be useful for.
A graph buys breadth. It does not buy better judgment.
It is a tool for width, for independent work done at once. When the work is not wide, the line was never the problem.
Skip the graph when:
-
The task is small or isolated. Adding one function, fixing one bug. The coordination is pure overhead, and a single agent is faster and cheaper.
-
You want to approve every step. A graph's whole point is running wide without you, so a tight leash works against it.
-
You do not know yet what you are looking for. Exploratory work wants one agent you can steer, not a fleet locked into a plan.
-
The steps genuinely depend on each other. Forcing a graph onto truly sequential work just adds cost for zero speedup.
-
The tell is the fake-edge test. If you cannot find two jobs with no edge between them, there is no graph to build. It is a loop, and a loop is fine.
按照我文章的老传统,我们诚实地看看这到底对谁有用。
图买来的是广度,不是更好的判断力。
它是为宽度而生的工具,为同时进行的独立工作而生。当工作不宽时,那条线从来就不是问题。
在这些情况下跳过图:
-
任务小而孤立。加一个函数、修一个 bug。协调纯粹是开销,单个智能体更快也更便宜。
-
你想审批每一步。图的意义恰恰是在没有你的情况下大规模并行,所以一条紧缰绳反而与它相悖。
-
你还不知道自己要找什么。探索性工作需要你可引导的一个智能体,而不是一群锁死在计划里的智能体。
-
步骤之间确实互相依赖。把图强加到真正的串行工作上,只会增加成本而没有加速。
-
判据就是伪边测试。如果你找不到两个之间没有边的任务,那就没有图可建。它是循环,而循环也没问题。
There is a deeper trap here, and it is the real lesson of this whole shift.
Imagine you build the full graph. Paired checkers, audit nodes, meta-nodes tuning the other nodes. Every node watches another node, and every one of them reads a report.
The audit checks the numbers against the finance numbers, which came from the same system in the first place.
Everything is consistent. Nothing is verified.
This graph fails exactly like the single loop did, just later, more expensively, and with far more green lights on the way down.

Topology alone does not buy truth. The graph needs anchors: nodes that cannot be argued with.
Tests that actually ran, not "should pass," did pass. Revenue that landed in the bank. Customers who actually stayed.
And some rules must be frozen, the ones an optimizer would be tempted to weaken, kept off-limits precisely because they are the ones it would bend to win.
The graph is only as honest as the things inside it that refuse to move.
Judge it on numbers that cannot argue back and it stays grounded. Let it grade its own reports and it will be confidently wrong.
这里有一个更深的陷阱,也是这整场转变真正的教训。
想象你构建了完整的图:成对的检查器、审计节点、调节其他节点的元节点。每个节点盯着另一个节点,而它们每一个都在读一份报告。
审计用财务数字核对数字,而这些财务数字最初就来自同一个系统。
一切都是一致的。但没有任何东西被真正验证。
这张图的失败方式与单循环一模一样,只是更晚、更贵,而且在坠落过程中有更多绿灯。

单靠拓扑结构买不来真相。图需要锚点:那些不容争辩的节点。
真正跑过的测试,而不是“应该能过”,确实通过了。到账的收入。真实留下来的客户。
还有一些规则必须冻结,那些优化器会忍不住削弱的规则,恰恰因为它们是它为了赢而会去弯曲的规则,所以要设置禁区。
图的诚实程度,取决于其中那些拒绝移动的东西。
用无法回嘴的数字来评判它,它就会保持脚踏实地。让它给自己的报告打分,它就会自信地犯错。
Enough theory. If you have decided this is for you, or you just want to try it, let's build one. You can build a real graph in a couple of minutes, because Claude Code shipped the tooling to do it directly, called dynamic workflows.
It comes down to one word: "workflow."
Put it in your prompt and Claude stops working through a single line of steps. Instead it writes a short orchestration script, then spawns a coordinated fleet of sub-agents to run it.
The important part is that the coordination is code, not a conversation. Passing results between agents does not re-spend your context the way a chat handoff does, which is what lets one run scale to a whole fleet without drowning the session.
Open a real repository you know, and paste this:
▸ GRAPH SPEC
GOAL: audit every route file under src/routes/ for missing auth checks
FAN OUT: one agent per file, all running in parallel
VERIFY: an independent checker on each finding, with fresh context
CAP: 20 files on this first run
ON FAIL: flag any file that doesn't return, never skip it silently
REPORT: one merged list of the routes missing auth
(start the prompt with the word "workflow" so Claude builds the graph)
Run it, and here is what happens.
First, Claude signals that it is building a workflow instead of answering in a normal chat, and shows you the plan before doing anything. You read it and approve.
Then the fleet runs. One agent per file, all at the same time, while your own session stays free the whole way through.
And what lands at the end is not twenty separate chats to dig through. It is one report. The in-between results lived inside the script, never in your context, so the only thing you actually see is the final answer.
That is a graph. A dozen agents from a single sentence. When a run comes out good, save it, and it turns into one command you can re-run by name forever.

Notice the "20 files" cap in that prompt. It keeps your first run cheap, and it hints at the thing every demo leaves out: the bill.
理论说够了。如果你已经决定这对你有用,或者只是想试试,我们来亲手搭一个。你可以在几分钟内构建一个真正的图,因为 Claude Code 已经提供了直接支持它的工具,叫做动态工作流。
说到底就一个词:workflow。
把它放进提示词后,Claude 就不再沿着单一步骤线工作了。它会写一个简短的编排脚本,然后启动一群协调好的子智能体去运行它。
关键在于,协调是代码,不是对话。智能体之间传递结果不会像聊天交接那样再次消耗你的上下文,这正是让一次运行扩展到整个智能体群、却不淹没会话的原因。
打开一个你熟悉的真实仓库,粘贴这段内容:
▸ GRAPH SPEC
GOAL: audit every route file under src/routes/ for missing auth checks
FAN OUT: one agent per file, all running in parallel
VERIFY: an independent checker on each finding, with fresh context
CAP: 20 files on this first run
ON FAIL: flag any file that doesn't return, never skip it silently
REPORT: one merged list of the routes missing auth
(start the prompt with the word "workflow" so Claude builds the graph)
运行它,接下来会发生这些。
首先,Claude 会显示它正在构建工作流,而不是在普通聊天中回答,在做任何事之前先向你展示计划。你阅读并批准。
然后智能体群开始运行。每个文件一个智能体,同时进行,而你的会话全程保持空闲。
最后得到的不是二十个需要翻看的独立聊天,而是一份报告。中间结果都活在脚本里,从不在你的上下文中,所以你实际看到的只有最终答案。
这就是图。一句话派出十几个智能体。一次跑得好,就把它保存下来,它就会变成一个你可以按名字反复重跑的命令。

注意提示词里“20 files”的上限。它让你的第一次运行很便宜,也暗示了每个演示都会略过的事情:账单。
Every one of these is the same diamond aimed at a different job. Open Claude Code in a real folder, swap the bracketed parts for your own, and paste. The word "workflow" is what tells Claude to build a coordinated fleet instead of a single line of steps. Keep yourself as the last yes before anything ships.
A decision-grade research desk. Replaces a week of googling or an expensive analyst invoice. Your question splits into angles, researchers dig at once, a skeptic attacks every finding, and only the survivors reach the report.
▸ GRAPH SPEC
GOAL: decision-grade research on [your question]
FAN OUT: split into 5 distinct angles, one researcher per angle, in parallel
RULE: every finding needs a source link and a date
VERIFY: a skeptic attacks each finding and tries to disprove it, drop what fails
MERGE: survivors into one report ranked by confidence
SAVE: research-report.md, then show me the top findings
HUMAN GATE: change nothing after that without asking me
(start the prompt with the word "workflow" so Claude builds the graph)
下面每一个都是同一个菱形,对准不同的任务。在一个真实文件夹里打开 Claude Code,把方括号里的内容换成你自己的,然后粘贴。workflow 这个词告诉 Claude 去构建一个协同智能体群,而不是单一步骤的序列。在一切上线之前,保留你自己作为最后的把关者。
一个达到决策级别的研究台。能取代一整周的谷歌搜索,或一张昂贵的分析师账单。你的问题拆成多个角度,研究者同时挖掘,一个怀疑者攻击每一条发现,只有幸存者进入最终报告。
▸ GRAPH SPEC
GOAL: decision-grade research on [your question]
FAN OUT: split into 5 distinct angles, one researcher per angle, in parallel
RULE: every finding needs a source link and a date
VERIFY: a skeptic attacks each finding and tries to disprove it, drop what fails
MERGE: survivors into one report ranked by confidence
SAVE: research-report.md, then show me the top findings
HUMAN GATE: change nothing after that without asking me
(start the prompt with the word "workflow" so Claude builds the graph)
An SEO content machine. Writes one ranking-ready draft per run, and never publishes without you.
▸ GRAPH SPEC
GOAL: one ranking-ready draft for [topic]
PARALLEL JOBS (run at once):
1. what the current top-ranking pages cover
2. the real questions people ask about this topic
3. what those top pages skip
MERGE: the three into an outline, then write a full draft
VERIFY: a fact-checker that flags every claim without a source
SAVE: drafts/ with the flagged claims listed at the top
HUMAN GATE: never publish anything
(start the prompt with the word "workflow" so Claude builds the graph)
一套 SEO 内容机器。每次运行写一篇有排名潜力的草稿,并且没有你点头绝不发布。
▸ GRAPH SPEC
GOAL: one ranking-ready draft for [topic]
PARALLEL JOBS (run at once):
1. what the current top-ranking pages cover
2. the real questions people ask about this topic
3. what those top pages skip
MERGE: the three into an outline, then write a full draft
VERIFY: a fact-checker that flags every claim without a source
SAVE: drafts/ with the flagged claims listed at the top
HUMAN GATE: never publish anything
(start the prompt with the word "workflow" so Claude builds the graph)
A go-to-market kit. The full launch pack in one run, with you approving every piece.
▸ GRAPH SPEC
GOAL: full launch kit for [product], aimed at [audience]
PARALLEL JOBS (research, run at once):
1. profile the buyer and the exact words they use
2. map where these buyers spend time online
3. collect how competitors pitch them
MERGE: a one-page positioning doc
HUMAN GATE: pause and show me the positioning doc before writing
PARALLEL JOBS (writing, from that doc):
1. landing page copy
2. a week of launch posts
3. a set of outreach messages
VERIFY: a checker compares every asset to the positioning doc, flags anything off
SAVE: launch-kit/, change nothing after that without asking me
(start the prompt with the word "workflow" so Claude builds the graph)
一套上市工具包。一次运行产出完整发布包,每个部分都需你审批。
▸ GRAPH SPEC
GOAL: full launch kit for [product], aimed at [audience]
PARALLEL JOBS (research, run at once):
1. profile the buyer and the exact words they use
2. map where these buyers spend time online
3. collect how competitors pitch them
MERGE: a one-page positioning doc
HUMAN GATE: pause and show me the positioning doc before writing
PARALLEL JOBS (writing, from that doc):
1. landing page copy
2. a week of launch posts
3. a set of outreach messages
VERIFY: a checker compares every asset to the positioning doc, flags anything off
SAVE: launch-kit/, change nothing after that without asking me
(start the prompt with the word "workflow" so Claude builds the graph)
A refactor sweep across a whole repo. Breadth no single context could hold.
▸ GRAPH SPEC
GOAL: find every function over 100 lines and propose a refactor for each
FAN OUT: one agent per file, in parallel
VERIFY: an independent checker on each proposed refactor, fresh context
DEDUPE: proposals against everything already seen
CAP: 50 files on this first run
REPORT: how many files came back, so nothing fails silently
(start the prompt with the word "workflow" so Claude builds the graph)
横跨整个仓库的重构扫描。广度之大,单个上下文根本装不下。
▸ GRAPH SPEC
GOAL: find every function over 100 lines and propose a refactor for each
FAN OUT: one agent per file, in parallel
VERIFY: an independent checker on each proposed refactor, fresh context
DEDUPE: proposals against everything already seen
CAP: 50 files on this first run
REPORT: how many files came back, so nothing fails silently
(start the prompt with the word "workflow" so Claude builds the graph)
A discovery loop of unknown size. For jobs where you do not know how big the work is until you are in it, like a bug sweep where finding one bug reveals three more.
▸ GRAPH SPEC
GOAL: hunt this repo for [security issues / broken error handling / dead code]
FAN OUT: run finders in parallel
DEDUPE: check each new find against everything already seen
VERIFY: an independent checker on the survivors
LOOP: keep going until two rounds in a row find nothing new, then stop
CAP: a hard limit on total agents so it can't run away
REPORT: final list ranked by severity
(start the prompt with the word "workflow" so Claude builds the graph)
Run one scoped, watch what it costs, then widen. When a run is good, save it, and every one of these becomes a single command you launch by name.
一个规模未知的发现循环。适合那些不到开始就不知道工作量多大的任务,比如修 bug 时发现一个 bug 又带出三个。
▸ GRAPH SPEC
GOAL: hunt this repo for [security issues / broken error handling / dead code]
FAN OUT: run finders in parallel
DEDUPE: check each new find against everything already seen
VERIFY: an independent checker on the survivors
LOOP: keep going until two rounds in a row find nothing new, then stop
CAP: a hard limit on total agents so it can't run away
REPORT: final list ranked by severity
(start the prompt with the word "workflow" so Claude builds the graph)
Run one scoped, watch what it costs, then widen. When a run is good, save it, and every one of these becomes a single command you launch by name.
A graph costs more than a normal chat. A lot more. The coordination is what gets cheaper, not the work itself. The agents still burn tokens, and a fleet of them burns a pile.
The clearest example is public. An engineer used this exact setup to rewrite the Bun runtime, translating around 535,000 lines of one language into over a million lines of another in about eleven days. By hand that is close to a year of work.
It ran about 50 workflows, with up to 64 agents going at once.
It also cost roughly $165,000 in usage, needed a human designing and watching the whole thing, and got real criticism over whether that much AI-written code can even be reviewed safely.
That is the honest shape of it. A graph can fan out to a thousand agents and chew through a job no single context could hold. It can also quietly spend your money in the background if you point it at the wrong task or skip the anchors.
So the heavy version is for teams with the budget, the caps, and the monitoring to run it. If that is not you yet, you are not missing anything. Start small, watch what a run costs, and go wider only once one has earned it.
图比普通聊天更贵,贵得多。变便宜的是协调,不是工作本身。智能体仍然在烧 token,一群智能体烧得更猛。
最清楚的例子是公开的。一位工程师用这套设置重写了 Bun 运行时,在约十一天内把大约 53.5 万行一种语言翻译成超过一百万行另一种语言。靠手写,这接近一年的工作量。
它大约运行了 50 个工作流,最多同时 64 个智能体在跑。
它还耗费了大约 16.5 万美元的使用费,需要一个人设计并全程盯着,并且因为“这么多 AI 写的代码是否还能安全审查”而受到真实的批评。
这就是它诚实的样貌。图可以扇出一千个智能体,啃下一个任何单一上下文都装不下的任务;如果你把它指向错误的任务,或者跳过锚点,它也能在后台悄悄花光你的钱。
所以重型版本适合有预算、有上限、有监控的团队来跑。如果你还没到那一步,你并没有错过什么。从小处开始,观察一次运行的成本,只有当某次运行证明了自己的价值后,再扩大规模。
That is the whole picture. You now know what a graph is, where it shines, where it breaks, and who it is actually for.
You know the strength: breadth, independent work done at once. And the weakness: it buys width, not judgment, and it will spend your money if you point it at the wrong job.
So the move is not to graph everything. It is to know when the work is wide enough to need one, and when a simple loop was the answer all along.
My take: learn the fake-edge test tonight. Draw your current workflow, find the edges that carry no data, and delete them. That one move makes you faster than most people before you touch a single new tool.
Most will keep queueing steps in a line. The few who learn to draw the graph will run a fleet.
If you want to stay up to date with everything happening in AI, follow me on X and Telegram:
X - https://x.com/AnatoliKopadze
Telegram - https://t.me/kopadzemp
以上就是全貌。你现在知道了图是什么、它擅长什么、在哪里崩溃、到底为谁而作。
你知道它的优势:广度,同时进行的独立工作。也知道它的短板:买来的是宽度,不是判断力;如果你把它指向错误的任务,它会花掉你的钱。
所以做法不是把一切都图化,而是知道什么时候工作足够宽、需要图,什么时候简单循环从一开始就是答案。
我的建议:今晚就学会伪边测试。画出你当前的工作流,找出那些不携带数据的边,删掉它们。这一招就能让你在接触任何新工具之前,比大多数人更快。
大多数人会继续把步骤排成一条线。少数学会画图的人,会运行一个智能体舰队。
如果你想跟上 AI 世界的一切动态,请在 X 和 Telegram 上关注我:
X - https://x.com/AnatoliKopadze
Telegram - https://t.me/kopadzemp