diff --git a/s16_workflow_runtime/README.ja.md b/s16_workflow_runtime/README.ja.md index 892216b4..b24fd48b 100644 --- a/s16_workflow_runtime/README.ja.md +++ b/s16_workflow_runtime/README.ja.md @@ -56,9 +56,9 @@ Claude Code は入口について率直です。 外にはいとこもあります。Agent SDK や `claude -p` で先に書く **static** harness です。あらゆるエッジケースに耐える必要があるので、どうしても汎用になります。dynamic はこの布のための裁断です。形が合ったら保存します。 -![Static harness vs dynamic workflow](images/dynamic-vs-static.svg) +![Static harness vs dynamic workflow](images/dynamic-vs-static.png) -*同じ問い。左: いつも汎用レポートに終わる汎用パイプライン。右: 自分のコードを読み、自分の取引量で値段を見、devil's advocate を呼ぶ特注レシピ。* +*Claude Code の設計エッセイより。同じ問い、ふたつの harness。左 — 固定の検索→検証→要約で、汎用レポートに終わる。右 — billing コードを読み、分岐し、devil's advocate を呼んでから具体的な推奨を出す特注レシピ。* **この章は Python の teaching runtime です。** 同じアイデアを、1 行ずつ読める形で示します。デモは名前で一つの saved workflow を登録します。概念は Claude Code の script 世界と一一対応です。「モデルは実行可能コードを渡せない」などと言いません——それは Claude Code については初めから正しくありませんでした。ここでは、完全な JavaScript インタプリタを埋め込まないだけです。 @@ -84,9 +84,11 @@ WORKFLOW_TOOL = { 学校のバザーでケーキをたくさん焼くとします。どのテーブルも 混ぜる → 焼く → 箱詰め。助手が味見をし、レシピが順番を決めます。 -![Workflow primitives](images/workflow-primitives.svg) +![Workflow primitives: agent, parallel, pipeline](images/workflow-primitives.png) -`agent(prompt, {schema, label, phase})` は、助手ひとりに一つの仕事を頼むことです。`schema` を付ければ、答えは検証済み JSON になり——次の段が受け取れるソケットになり——最初が雑なら一回だけやり直せます。 +*公式のプリミティブ・カード。ひとつの `agent` と、多くを走らせる二つのやり方 — `parallel`(barrier)と `pipeline`(各 item が自分の stage を流れる)。* + +`agent(prompt, opts?)` は、助手ひとりに一つの仕事を頼むことです。`schema` を付ければ、答えは検証済み JSON になり——次の段が受け取れるソケットになり——最初が雑なら一回だけやり直せます。本物の Claude Code では `model`、`isolation`(worktree / remote)、`agentType` も選べます。この teaching runtime は表面を小さく保ち、1 行ずつ読めるようにしています。 `pipeline(items, *stages)` は多段仕事の既定です。各ケーキが自分で段階を歩き、一方が箱詰めのあいだに、もう一方はまだ混ぜていてもよい。stage 間に barrier はありません。 @@ -113,9 +115,9 @@ resume: A hit → B hit → C 変更 → D は live 動詞は小麦粉と火加減です。人が何度も発明し直すのは、少数の*形*です。道具箱だと思ってください。必点メニューではありません。 -![Six Workflow Patterns](images/six-workflow-patterns.svg) +![Six Workflow Patterns](images/six-workflow-patterns.png) -*人が何度も発明する六つの形。トポロジーは script が持ち、このレッスンでは `agent` / `parallel` / `pipeline` / `phase` / journal で話します。* +*公式の六パターン格子 — 道具箱であり、必点メニューではない。トポロジーは script が持ち、このレッスンでは `agent` / `parallel` / `pipeline` / `phase` / journal で各形を話します。* **Classify-And-Act。** 痛み: 万能の助手は何でもそこそこ。形: classifier が見て、専門家 A / B / C へ振り分ける。ここ: `agent({schema})` がラベルを返し、script が続く `agent`(または入れ子の `workflow`)へ分岐。全部が本当に同じ扱いでよいなら使わない。 @@ -140,7 +142,17 @@ resume: A hit → B hit → C 変更 → D は live | Tournament | pairwise 審判 `agent` | 順位/味に鋭い物差しがない | | Loop Until Done | `while` + 停止 + `budget` | どれだけ埋まっているか不明 | -組み合わせはふつうです。深い調査はしばしば fanout → filter → verify → synthesize と重ねます。トリアージでは **quarantine** を足すこともあります。信頼できない内容を読む agent は read-only のまま、trusted な actor だけが PR を開きます。私たちのサンプルは、二つの音の小さな和音です。 +組み合わせはふつうです。深い調査はしばしば fanout → filter → verify → synthesize と重ねます。私たちのサンプルは、二つの音の小さな和音です。 + +### 信頼できない入力に workflow が出会うとき + +道具箱のそばにもう一つ残しておきたい形があります。**quarantine triage** です。サポートチケット、bug 報告、ユーザーフィードバックは信頼できません。それらを*読む* agent に、PR を開ける鍵まで持たせたくはありません。 + +![Quarantine triage](images/quarantine-triage.png) + +*Reader は read-only の quarantine に留まり、分類と dedupe をし、構造化 summary だけを渡します。高権限ツールは trusted 側に住み — summary にだけ作用し、生本文には触れません。バックログが眠らないなら `/loop` と組んでもよいです。* + +このレッスンのプリミティブでは、それも script と agent です。低権限 reader `agent` の `pipeline` や `parallel`、変数に入った構造化 summary、それから書く側の別 actor `agent`(または入れ子の `workflow`)。面白いのはエアロック — 誰が生テキストを見てよいか、です。 ## `review-changes` を歩く — ひとつの composition @@ -211,4 +223,4 @@ Review が Verify に道を譲るのを見てください。完全な resume で s16 はバッチの回し方です。[s17 Goal Loop](../s17_goal_loop/) は戸口で別の問いをします。止めるべきか、もう一ターンか。繰り返せるレシピに硬い「完了」も要るときは、そちらと組んでください。 - + diff --git a/s16_workflow_runtime/README.md b/s16_workflow_runtime/README.md index 52289351..329fcf6b 100644 --- a/s16_workflow_runtime/README.md +++ b/s16_workflow_runtime/README.md @@ -56,9 +56,9 @@ Sometimes a good script has already been saved under something like `.claude/wor There is also a cousin: **static** harnesses you write ahead of time with the Agent SDK or `claude -p`. Those must survive every edge case, so they stay generic. Dynamic ones are cut for *this* cloth; save them when the fit is right. -![Static harness vs dynamic workflow](images/dynamic-vs-static.svg) +![Static harness vs dynamic workflow](images/dynamic-vs-static.png) -*Same question. Left: a generic pipeline that always ends in a generic report. Right: a tailor-made workflow that reads your code, prices your volume, and invites a devil’s advocate.* +*From Claude Code’s design essay: same question, two harnesses. Left — a fixed search→verify→summarize pipeline that ends in a generic report. Right — a tailor-made workflow that reads your billing code, branches, and invites a devil’s advocate before recommending.* **This chapter is a Python teaching runtime.** Same ideas, every line readable. Our demo registers one saved workflow by name; the concepts map one-to-one onto Claude Code’s script world. We will not pretend “the model cannot submit executable code” — that was never true of Claude Code. We simply do not embed a full JavaScript interpreter here. @@ -84,9 +84,11 @@ WORKFLOW_TOOL = { Imagine a school bake sale. Every table needs mix → bake → box. Helpers taste; the recipe decides order. -![Workflow primitives](images/workflow-primitives.svg) +![Workflow primitives: agent, parallel, pipeline](images/workflow-primitives.png) -`agent(prompt, {schema, label, phase})` asks one helper to do one job. With a `schema`, the answer comes back as validated JSON — a socket the next stage can hold — with one retry if the first reply is messy. +*Official primitive card: one `agent`, then the two ways to run many — `parallel` (barrier) vs `pipeline` (each item streams its stages).* + +`agent(prompt, opts?)` asks one helper to do one job. With a `schema`, the answer comes back as validated JSON — a socket the next stage can hold — with one retry if the first reply is messy. Real Claude Code also lets you pick `model`, `isolation` (worktree / remote), and `agentType`; this teaching runtime keeps the surface smaller so every line stays readable. `pipeline(items, *stages)` is the default for multi-stage work. Each cake walks its stages alone, so one can be boxing while another is still mixing. No barrier between stages. @@ -113,9 +115,9 @@ resume: A hit → B hit → C changed → D runs live The verbs are flour and heat. What people keep reinventing are a handful of *shapes*. Think of them as a toolbox, not a mandatory menu. -![Six Workflow Patterns](images/six-workflow-patterns.svg) +![Six Workflow Patterns](images/six-workflow-patterns.png) -*Six shapes people keep reinventing. The script owns the topology; this lesson speaks them with `agent` / `parallel` / `pipeline` / `phase` / journal.* +*The official six-pattern grid — a toolbox, not a mandatory menu. The script owns the topology; this lesson speaks each shape with `agent` / `parallel` / `pipeline` / `phase` / journal.* **Classify-And-Act.** Pain: one generic helper is mediocre at everything. Shape: a classifier looks, then routes to specialist A, B, or C. Here: one `agent({schema})` returns a label; the script branches to the right follow-up `agent` (or a nested `workflow`). Skip it when every item truly needs the same treatment. @@ -140,7 +142,17 @@ After a few have faces, the toolbox fits in one glance: | Tournament | pairwise judge `agent`s | Ranking / taste without a sharp scale | | Loop Until Done | `while` + stop + `budget` | Unknown amount of buried work | -Compositions are normal. Deep research often stacks fanout → filter → verify → synthesize. Triage sometimes adds a **quarantine**: readers of untrusted content stay read-only; only a trusted actor opens PRs. Our sample is a smaller chord of two notes. +Compositions are normal. Deep research often stacks fanout → filter → verify → synthesize. Our sample is a smaller chord of two notes. + +### When workflows meet untrusted input + +One more shape is worth keeping near the toolbox: **quarantine triage**. Support tickets, bug reports, and user feedback are untrusted. You do not want the agent that *reads* them to also hold the keys that open a PR. + +![Quarantine triage](images/quarantine-triage.png) + +*Readers stay in a read-only quarantine, classify and dedupe, and pass only a structured summary across. High-privilege tools live on the trusted side — they act on summaries, never on raw content. Pair with `/loop` if the backlog never sleeps.* + +In this lesson’s primitives that is still just scripts and agents: a `pipeline` or `parallel` of low-privilege reader `agent`s, a structured summary in a variable, then a separate actor `agent` (or nested `workflow`) that may write. The interesting part is the airlock — who is allowed to see the raw text. ## Walking `review-changes` — a composition @@ -211,4 +223,4 @@ Watch Review give way to Verify. Watch agents flip from `done` to `cached` on a s16 is how a batch runs. [s17 Goal Loop](../s17_goal_loop/) asks a different question at the door: should we stop, or take another turn? Pair them when a repeatable recipe also needs a hard “done.” - + diff --git a/s16_workflow_runtime/README.zh.md b/s16_workflow_runtime/README.zh.md index 38c7f391..ac704b20 100644 --- a/s16_workflow_runtime/README.zh.md +++ b/s16_workflow_runtime/README.zh.md @@ -56,9 +56,9 @@ Claude Code 对入口说得很直白。 门外还有表亲:**静态** harness,用 Agent SDK 或 `claude -p` 事先写好。它们得扛住所有边角,所以往往更泛。动态的是为这块布现裁的;合身了再存。 -![静态 harness 与动态 workflow](images/dynamic-vs-static.svg) +![静态 harness 与动态 workflow](images/dynamic-vs-static.png) -*同一个问题。左边:永远通向一份泛泛研究报告的通用流水线。右边:读你的代码、按你的量计价、再请来魔鬼代言人的特制菜谱。* +*来自 Claude Code 设计文:同一个问题,两套 harness。左边——固定的搜索→验证→摘要,终点是一份泛泛的研究报告。右边——读你的 billing 代码、分叉、再请来魔鬼代言人,最后给出具体建议。* **这一章是 Python 教学运行时。** 同样的想法,每行都能读。演示按名字挂了一个已保存的 workflow;概念和 Claude Code 的脚本世界一一对应。我们不会再说“模型不能提交可执行代码”——那从来不是 Claude Code 的真相。这里只是不嵌入完整的 JS 解释器。 @@ -84,9 +84,11 @@ WORKFLOW_TOOL = { 想象学校义卖要烤许多蛋糕。每张桌子都是搅拌 → 烘烤 → 装箱。帮手负责尝;菜谱决定先后。 -![Workflow 原语](images/workflow-primitives.svg) +![Workflow 原语:agent、parallel、pipeline](images/workflow-primitives.png) -`agent(prompt, {schema, label, phase})` 是请一个帮手做一件事。带上 `schema`,答案会变成校验过的 JSON——下一阶段接得住的接口——第一次不对还给一次重试。 +*官方原语卡片:一个 `agent`,以及两种“跑很多”的方式——`parallel`(等齐屏障)与 `pipeline`(每个 item 自己流过各阶段)。* + +`agent(prompt, opts?)` 是请一个帮手做一件事。带上 `schema`,答案会变成校验过的 JSON——下一阶段接得住的接口——第一次不对还给一次重试。真正的 Claude Code 还可以选 `model`、`isolation`(worktree / remote)和 `agentType`;本课教学运行时把表面收小一点,好让每一行都读得完。 `pipeline(items, *stages)` 是多阶段工作的默认:每块蛋糕自己走完各阶段,一块在装箱时,另一块可能还在搅拌。阶段之间没有等齐屏障。 @@ -113,9 +115,9 @@ journal: [A 好] [B 好] [C 好] [D 好] 动词是面粉和火候。人们反复发明的,是少数几种*形状*。把它们想成工具箱,不是必点菜单。 -![六种 Workflow 模式](images/six-workflow-patterns.svg) +![六种 Workflow 模式](images/six-workflow-patterns.png) -*人们反复发明的六种形状。脚本掌管拓扑;本课用 `agent` / `parallel` / `pipeline` / `phase` / journal 把它们说出来。* +*官方六模式网格——工具箱,不是必点菜单。脚本掌管拓扑;本课用 `agent` / `parallel` / `pipeline` / `phase` / journal 把每种形状说出来。* **Classify-And-Act(分类再行动)。** 痛点:一个万金油帮手样样稀松。形状:分类器看一眼,再路由到专家 A、B 或 C。本课:一次带 `schema` 的 `agent` 返回标签,脚本分支到对的后续 `agent`(或嵌一层 `workflow`)。每件东西其实都该同样处理时,就别用。 @@ -140,7 +142,17 @@ journal: [A 好] [B 好] [C 好] [D 好] | Tournament | 两两裁判 `agent` | 排序/品味却没有锋利刻度 | | Loop Until Done | `while` + 停止 + `budget` | 埋着不知多少活 | -组合是常态。深度调研常常叠成:分发 → 过滤 → 验证 → 汇总。分流有时会加一层 **quarantine(隔离区)**:读不可信内容的 agent 只读;只有受信任的 actor 才开 PR。我们的示例,是两个音符的一小段和弦。 +组合是常态。深度调研常常叠成:分发 → 过滤 → 验证 → 汇总。我们的示例,是两个音符的一小段和弦。 + +### 当 workflow 碰上不可信输入 + +工具箱旁边还值得留一个形状:**quarantine triage(隔离分流)**。工单、bug 报告、用户反馈都是不可信的。你不会希望*读*它们的 agent,同时也握着能开 PR 的钥匙。 + +![隔离分流](images/quarantine-triage.png) + +*读者留在只读的隔离区里,分类、去重,只把结构化摘要递过去。高权限工具住在受信任一侧——它们只根据摘要行动,从不碰原始正文。积压永远睡不着时,可以和 `/loop` 配对。* + +落到本课原语,仍是脚本和 agent:一串低权限 reader `agent` 的 `pipeline` 或 `parallel`,摘要进变量,再交给另一个 actor `agent`(或嵌一层 `workflow`)去写。真正值钱的是气闸——谁被允许看见原始文本。 ## 跟着 `review-changes` 走一圈——一种组合 @@ -211,4 +223,4 @@ python s16_workflow_runtime/code.py resume # 同一 runId;期待缓存命中 s16 讲一批活怎么跑。[s17 Goal Loop](../s17_goal_loop/) 在门口问另一个问题:该停,还是再来一轮?可重复的菜谱若还需要硬性的“做完”,可以和它一起用。 - + diff --git a/s16_workflow_runtime/images/dynamic-vs-static.png b/s16_workflow_runtime/images/dynamic-vs-static.png new file mode 100644 index 00000000..e85f8bb7 Binary files /dev/null and b/s16_workflow_runtime/images/dynamic-vs-static.png differ diff --git a/s16_workflow_runtime/images/dynamic-vs-static.svg b/s16_workflow_runtime/images/dynamic-vs-static.svg deleted file mode 100644 index d22996a4..00000000 --- a/s16_workflow_runtime/images/dynamic-vs-static.svg +++ /dev/null @@ -1,63 +0,0 @@ - - Static harness vs dynamic workflow - Same question, two harnesses: a generic static pipeline versus a tailor-made dynamic workflow that reads local code and runs an adversarial check. - - - - - - Same question, two harnesses - - Should we migrate our checkout service to a new provider? - - - - - - Static harness - written ahead - must work for every edge case - - turn into 5 web searches - - - fetch top results - - - verify - - - summarize - - - a generic research report - - - - Dynamic workflow - written for THIS task - then optionally saved - - read our billing code - - billing/ - - webhooks/ - - taxes/ - - - - check features vs - new provider docs - - price at our - transaction volume - - - - devil's advocate: strongest case against - - - a specific recommendation - - Static aims to fit every case. Dynamic cuts cloth for this one - then save if the fit is good. - diff --git a/s16_workflow_runtime/images/quarantine-triage.png b/s16_workflow_runtime/images/quarantine-triage.png new file mode 100644 index 00000000..3055f7ea Binary files /dev/null and b/s16_workflow_runtime/images/quarantine-triage.png differ diff --git a/s16_workflow_runtime/images/six-workflow-patterns.png b/s16_workflow_runtime/images/six-workflow-patterns.png new file mode 100644 index 00000000..34ccdec6 Binary files /dev/null and b/s16_workflow_runtime/images/six-workflow-patterns.png differ diff --git a/s16_workflow_runtime/images/six-workflow-patterns.svg b/s16_workflow_runtime/images/six-workflow-patterns.svg deleted file mode 100644 index 335a28e5..00000000 --- a/s16_workflow_runtime/images/six-workflow-patterns.svg +++ /dev/null @@ -1,108 +0,0 @@ - - Six Workflow Patterns - Toolbox of six common dynamic workflow shapes. - - - - - - Six Workflow Patterns - a toolbox - not a mandatory menu. Compose with agent / parallel / pipeline - - - - - - - - 1. Classify-And-Act - task - - classifier - - - - A - B - C - route to the right specialist - agent -> branch -> agent - - 2. Fanout-And-Synthesize - task - - - - - - - - - - - - - - barrier - - synthesize - parallel / pipeline -> merge - - 3. Adversarial Verification - worker - - - - verify - verify - verify - independents stress-test the work - agent -> parallel(verifiers) - - 4. Generate-And-Filter - gen - gen - gen - - - - filterrubric+dedupe - - - best - drop - keep what survives the test - parallel(gens) -> filter - - 5. Tournament - a - b - c - d - - - - - judge - judge - - - final - - winner - pairwise agent judges - - 6. Loop Until Done - agent - - new?findings - - done - - yes - - spawn - stop when dry rounds appear - while + agent + budget - - Script owns the topology; agents judge inside each step. - diff --git a/s16_workflow_runtime/images/workflow-primitives.png b/s16_workflow_runtime/images/workflow-primitives.png new file mode 100644 index 00000000..52dac27e Binary files /dev/null and b/s16_workflow_runtime/images/workflow-primitives.png differ diff --git a/s16_workflow_runtime/images/workflow-primitives.svg b/s16_workflow_runtime/images/workflow-primitives.svg deleted file mode 100644 index 6b7ccb43..00000000 --- a/s16_workflow_runtime/images/workflow-primitives.svg +++ /dev/null @@ -1,68 +0,0 @@ - - Workflow primitives: agent, parallel, pipeline - Three kitchen verbs of a workflow script: one helper, a barrier of many helpers, and per-item stages without a barrier. - - - - - - Three verbs the script speaks - agent asks a helper; parallel waits for every tray; pipeline lets each cake finish its own stages - - - - agent(prompt, opts?) - One helper. One job. Optional schema makes the answer machine-readable. - - const bugs = await agent("audit auth.ts", { - schema: BugList, label: "audit:auth", phase: "Review" - }) - - returns text, or validated JSON - journal records each call in order - resume replays unchanged prefix - - - - parallel(thunks) - Fan out. Barrier - wait for all. - - - - - - - - - - barrier - failing thunk -> null slot - use when next step needs EVERY result - - - - pipeline(items, *stages) - Each item streams its own stages. No barrier. - - A - - audit - - - verify - - - done - - B - - audit - - - verify - failing stage -> null item - DEFAULT for multi-stage work - A can finish while B is still mixing - - Script owns topology. Agents judge inside each call. Intermediate bowls stay in variables + journal. - diff --git a/web/public/course-assets/s16_workflow_runtime/dynamic-vs-static.png b/web/public/course-assets/s16_workflow_runtime/dynamic-vs-static.png new file mode 100644 index 00000000..e85f8bb7 Binary files /dev/null and b/web/public/course-assets/s16_workflow_runtime/dynamic-vs-static.png differ diff --git a/web/public/course-assets/s16_workflow_runtime/dynamic-vs-static.svg b/web/public/course-assets/s16_workflow_runtime/dynamic-vs-static.svg deleted file mode 100644 index d22996a4..00000000 --- a/web/public/course-assets/s16_workflow_runtime/dynamic-vs-static.svg +++ /dev/null @@ -1,63 +0,0 @@ - - Static harness vs dynamic workflow - Same question, two harnesses: a generic static pipeline versus a tailor-made dynamic workflow that reads local code and runs an adversarial check. - - - - - - Same question, two harnesses - - Should we migrate our checkout service to a new provider? - - - - - - Static harness - written ahead - must work for every edge case - - turn into 5 web searches - - - fetch top results - - - verify - - - summarize - - - a generic research report - - - - Dynamic workflow - written for THIS task - then optionally saved - - read our billing code - - billing/ - - webhooks/ - - taxes/ - - - - check features vs - new provider docs - - price at our - transaction volume - - - - devil's advocate: strongest case against - - - a specific recommendation - - Static aims to fit every case. Dynamic cuts cloth for this one - then save if the fit is good. - diff --git a/web/public/course-assets/s16_workflow_runtime/quarantine-triage.png b/web/public/course-assets/s16_workflow_runtime/quarantine-triage.png new file mode 100644 index 00000000..3055f7ea Binary files /dev/null and b/web/public/course-assets/s16_workflow_runtime/quarantine-triage.png differ diff --git a/web/public/course-assets/s16_workflow_runtime/six-workflow-patterns.png b/web/public/course-assets/s16_workflow_runtime/six-workflow-patterns.png new file mode 100644 index 00000000..34ccdec6 Binary files /dev/null and b/web/public/course-assets/s16_workflow_runtime/six-workflow-patterns.png differ diff --git a/web/public/course-assets/s16_workflow_runtime/six-workflow-patterns.svg b/web/public/course-assets/s16_workflow_runtime/six-workflow-patterns.svg deleted file mode 100644 index 335a28e5..00000000 --- a/web/public/course-assets/s16_workflow_runtime/six-workflow-patterns.svg +++ /dev/null @@ -1,108 +0,0 @@ - - Six Workflow Patterns - Toolbox of six common dynamic workflow shapes. - - - - - - Six Workflow Patterns - a toolbox - not a mandatory menu. Compose with agent / parallel / pipeline - - - - - - - - 1. Classify-And-Act - task - - classifier - - - - A - B - C - route to the right specialist - agent -> branch -> agent - - 2. Fanout-And-Synthesize - task - - - - - - - - - - - - - - barrier - - synthesize - parallel / pipeline -> merge - - 3. Adversarial Verification - worker - - - - verify - verify - verify - independents stress-test the work - agent -> parallel(verifiers) - - 4. Generate-And-Filter - gen - gen - gen - - - - filterrubric+dedupe - - - best - drop - keep what survives the test - parallel(gens) -> filter - - 5. Tournament - a - b - c - d - - - - - judge - judge - - - final - - winner - pairwise agent judges - - 6. Loop Until Done - agent - - new?findings - - done - - yes - - spawn - stop when dry rounds appear - while + agent + budget - - Script owns the topology; agents judge inside each step. - diff --git a/web/public/course-assets/s16_workflow_runtime/workflow-primitives.png b/web/public/course-assets/s16_workflow_runtime/workflow-primitives.png new file mode 100644 index 00000000..52dac27e Binary files /dev/null and b/web/public/course-assets/s16_workflow_runtime/workflow-primitives.png differ diff --git a/web/public/course-assets/s16_workflow_runtime/workflow-primitives.svg b/web/public/course-assets/s16_workflow_runtime/workflow-primitives.svg deleted file mode 100644 index 6b7ccb43..00000000 --- a/web/public/course-assets/s16_workflow_runtime/workflow-primitives.svg +++ /dev/null @@ -1,68 +0,0 @@ - - Workflow primitives: agent, parallel, pipeline - Three kitchen verbs of a workflow script: one helper, a barrier of many helpers, and per-item stages without a barrier. - - - - - - Three verbs the script speaks - agent asks a helper; parallel waits for every tray; pipeline lets each cake finish its own stages - - - - agent(prompt, opts?) - One helper. One job. Optional schema makes the answer machine-readable. - - const bugs = await agent("audit auth.ts", { - schema: BugList, label: "audit:auth", phase: "Review" - }) - - returns text, or validated JSON - journal records each call in order - resume replays unchanged prefix - - - - parallel(thunks) - Fan out. Barrier - wait for all. - - - - - - - - - - barrier - failing thunk -> null slot - use when next step needs EVERY result - - - - pipeline(items, *stages) - Each item streams its own stages. No barrier. - - A - - audit - - - verify - - - done - - B - - audit - - - verify - failing stage -> null item - DEFAULT for multi-stage work - A can finish while B is still mixing - - Script owns topology. Agents judge inside each call. Intermediate bowls stay in variables + journal. -