
本文以生成一个契合年度热点话题又现代科技化的 Mr.Bean 节目剧本为例,说明多 Agent Kanban 协作设计模式的应用。本文使用 hermes-agent ,但其它 agent 甚至你自己开发的也是可以应用的。
引
对于复杂的 AI 任务,问题已经不是要不要多 Agent 共同完成,而是怎么更好地多 Agent 协作了。 短期的 spawn agent 模式有明显的不可控,难观测,状态易失等问题。 而在各业界行之有效的项目协作手段 Kanban 同样可用于多 Agent 协作。
- Kanban 让任务状态可观测(Observability)
- Kanban 适合 Human-in-the-loop。 如发现任务 blocking 问题,手工解决 blocking,触发重试,手工补充少量重要信息,以及控制任务。
Kanban
Toyota 的 Kanban (看板)方法,最早来源于战后某国的制造业,尤其是 Toyota 在 1940–1950 年代建立的生产管理体系。
“Kanban(看板 / かんばん)”这个词本身里原意是:
后来被引申为“用于传递信息的卡片或标识”。为什么 “kanban” 很像汉语拼音,其实是因为它本来就是日语中的汉字词 “看板” 的日语发音(かんばん / kanban),而日语中大量词汇本来就来自汉字。
Kanban 应用示例
这次,我们先看应用示例,后面再研究原理。这样好有个感性理解。
Planner 的目标
在 hermes 中,输出以下提示语:
1
2
3
4
5
6
7
8
9
10
11
|
用 kanban 方法,生成 agent 任务,并写入依赖关系:
- 任务1: 历史调查
- 调查 Mr. Bean 电视节目的历史和风格,以 markdown 格式写入 `mr-bean-history.md` 文件
- 任务2: 主角演员现状调查
- 主角演员现状调查,以 markdown 格式写入 `mr-bean-status.md` 文件
- 任务3: 2026 年的世界大事调查
- 2026 年的世界大事调查,以 markdown 格式写入 `mr-bean-2026-events.md` 文件
- 总任务:设计一个 2026 年版本的 Mr. Bean 电视节目故事脚本。以 markdown 格式写入 `mr-bean-2026-story.md` 文件。这个任务依赖 `任务1`,`任务2`,`任务3`。
所有任务 assign 给 `default` profile
|
输出:
✅ Kanban 任务创建完成
已成功创建 4 个任务,其中任务 1、2、3 相互独立可并行执行,任务 4(总任务)依赖前三者:
📋 任务列表
ID 状态 依赖 说明
────────── ─────── ─────── ────────────────────────────
t_129bb524 ✅ Ready 无 任务1: Mr. Bean 节目历史和风格调查
t_339dcadc ✅ Ready 无 任务2: 主角演员现状调查
t_f55ad7f6 ✅ Ready 无 任务3: 2026年世界大事调查
t_b1a7f48d 🔒 Todo 任务1,2,3 总任务: 2026年Mr. Bean电视节目故事脚本设计
🔄 任务依赖图
任务1 (ready) ─┐
任务2 (ready) ─┼→ 总任务 (todo)
任务3 (ready) ─┘
• 任务 1、2、3 可并行执行
• 总任务将在前置三个任务全部完成后自动启动
查看任务
可以在浏览器中查看 Kanban:

最后输出的剧本
mr-bean-2026-story.md :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# Mr. Bean in 2026 — 电视节目故事脚本
> **标题:** Mr. Bean: Smart Beans(聪明的豆子)
> **时长:** 约 30 分钟(单集)
> **风格定位:** 经典肢体喜剧 + 2026 时代元素。考虑到 Rowan Atkinson 已 71 岁,大幅减少高强度物理动作(追逐、摔跤、高处场景),以"智慧型笨拙"为主——精心设计的静止尴尬面、小范围肢体错位、面部微表情和与环境/智能设备的互动。
---
## 故事大纲
Mr. Bean 住进了一栋全新升级的**全智能公寓**(房东太太翻新后的 Arbour Road 12 号)。他必须在这栋充斥着 AI 助手、自动门、声控灯光和机器人管家的房子里度过一天——同时还要出门参加 2026 年 FIFA 世界杯预选赛(英格兰对巴西的资格赛)。整集以 Bean 与"过度聪明"的现代科技之间的灾难性碰撞为主线,三条线交错推进:
- **A 线(家中):** Bean 与智能家居的战争
- **B 线(路上):** Bean 的 Mini 与自动驾驶/油价危机的冒险
- **C 线(赛场外):** Bean 在 FIFA 世界杯体验区的闹剧
**设计原则:** 全程极少对白(Mr. Bean 几乎不说话,仅发出经典嘟囔声)。所有笑点来自他孩子气的好奇心、对科技的天真误解、以及自作聪明的解决方案。
---
## 片头
**经典动画开场(更新版):**
一颗发光的豆荚从太空中坠落——背景是 NASA Artemis II 的登月飞行轨道(呼应 2026 年 4 月的载人登月任务)。豆荚穿过云层,砸在一栋智能公寓的太阳能面板上。Bean 从豆荚里弹出来,手里抱着一只戴着 VR 眼镜的 Teddy,降落在 Flat 2 阳台上。
片头音乐依然是 Howard Goodall 改编的主题曲,但合唱由 AI 生成的教堂唱诗班完成(致敬"AI 唱诗班"的时代梗),歌词不变:*Ecce homo qui est faba*。
---
## 场景一:Bean 的智能公寓(约 8 分钟)
### 设定
Bean 早晨醒来。他的公寓已经被房东太太升级成了"全智能家居"——墙壁上到处是触摸屏,天花板上有手势感应灯,厨房站着一个扫地机器人造型的小型管家机器人。
### 情节展开
#### 1.1 起床大战(2 分钟)
Bean 的复古闹钟(他最喜欢的机械闹钟)被房东换成了一个圆润的 AI 语音助手,叫"BEE-BOP"(Bean's Environment & Entertainment Brain-Operated Platform——房东太太随口编的名字,Bean 不知道含义)。
...
|
例子总结
可以看出,如果我直接一个 prompt: 生成一个契合年度热点话题又现代科技化的 Mr.Bean 节目剧本 Agent 给出的答案,可能完全不是这样的。更可能不会并发地执行调研。页整个过程,可以在 Kanban 的浏览器或 hermers kanban watch 中看到任务状态和日志。在我执行时,甚至有任务因网络问题,重试多次后状态变为 block 了,需要我手工解决问题,然后手工修改 block 为 ready 。
Kanban 原理
先看看数据模型:

Open with Draw.io
Task 的状态:

Open with Draw.io
架构和流程:

Open with Draw.io
Kanban task execution protocol
每个 worker 的 system prompt 都加入了以下关于 kanban 的说明:
from agent.prompt_builder import KANBAN_GUIDANCE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# Kanban task execution protocol
You have been assigned ONE task from the shared board at `~/.hermes/kanban.db`. Your task id is in `$HERMES_KANBAN_TASK`; your workspace is `$HERMES_KANBAN_WORKSPACE`. The `kanban_*` tools in your schema are your primary coordination surface — they write directly to the shared SQLite DB and work regardless of terminal backend (local/docker/modal/ssh).
## Lifecycle
1. **Orient.** Call `kanban_show()` first (no args — it defaults to your task). The response includes title, body, parent-task handoffs (summary + metadata), any prior attempts on this task if you're a retry, the full comment thread, and a pre-formatted `worker_context` you can treat as ground truth.
2. **Work inside the workspace.** `cd $HERMES_KANBAN_WORKSPACE` before any file operations. The workspace is yours for this run. Don't modify files outside it unless the task explicitly asks.
3. **Heartbeat on long operations.** Call `kanban_heartbeat(note=...)` every few minutes during long subprocesses (training, encoding, crawling). Skip heartbeats for short tasks.
4. **Block on genuine ambiguity.** If you need a human decision you cannot infer (missing credentials, UX choice, paywalled source, peer output you need first), call `kanban_block(reason="...")` and stop. Don't guess. The user will unblock with context and the dispatcher will respawn you.
5. **Complete with structured handoff.** Call `kanban_complete(summary=..., metadata=...)`. `summary` is 1–3 human-readable sentences naming concrete artifacts. `metadata` is machine-readable facts (`{changed_files: [...], tests_run: N, decisions: [...]}`). Downstream workers read both via their own `kanban_show`. Never put secrets / tokens / raw PII in either field — run rows are durable forever. Exception: if your output is a code change that needs human review before counting as merged/done (most coding tasks), drop the structured metadata (changed_files / tests_run / diff_path) into a `kanban_comment` first, then end with `kanban_block(reason="review-required: <one-line summary>")` so a reviewer can approve+unblock or request changes. Reviewing-then-completing is more honest than auto-completing work that still needs eyes on it.
6. **If follow-up work appears, create it; don't do it.** Use `kanban_create(title=..., assignee=<right-profile>, parents=[your-task-id])` to spawn a child task for the appropriate specialist profile instead of scope-creeping into the next thing.
## Orchestrator mode
If your task is itself a decomposition task (e.g. a planner profile given a high-level goal), use `kanban_create` to fan out into child tasks — one per specialist, each with an explicit `assignee` and `parents=[...]` to express dependencies. Then `kanban_complete` your own task with a summary of the decomposition. Do NOT execute the work yourself; your job is routing, not implementation.
## Do NOT
- Do not shell out to `hermes kanban <verb>` for board operations. Use the `kanban_*` tools — they work across all terminal backends.
- Do not complete a task you didn't actually finish. Block it.
- Do not assign follow-up work to yourself. Assign it to the right specialist profile.
- Do not call `delegate_task` as a board substitute. `delegate_task` is for short reasoning subtasks inside your own run; board tasks are for cross-agent handoffs that outlive one API loop.
|
结语
Kanban 类型的多 Agent 协作方法,可以用于很多 use case, 调研内容的生成、软件开发。最大的好处是应用广泛的 kanban 人类的学习成本低,已经有很多有效的方法学、管理学可以应用上。
Last but not least, 我在找工作,如果有合适的请联系我,我的经历:https://blog.mygraphql.com/zh/
参考