Skip to content

Commit 3fbec7c

Browse files
committed
fix: align s16-s19 teaching tool consistency
1 parent c2c53c2 commit 3fbec7c

27 files changed

Lines changed: 77 additions & 78 deletions

s16_team_protocols/README.en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Both scenarios share the same structure: one side sends a request, the other rep
2525

2626
![Team Protocols Overview](images/team-protocols-overview.svg)
2727

28-
Teaching code carries forward S15's capabilities (MessageBus, spawn_teammate, inbox injection, background execution, cron scheduling). To stay focused on the protocol mechanism, it omits full error recovery, memory, and skill systems. Added: **ProtocolState** (request state tracking), **dispatch_message** (routes incoming messages by type to handlers), **match_response** (correlates response to request via request_id, with type validation).
28+
Teaching code continues the agent capability arc from earlier chapters and adds structured protocols on top of S15's team communication. To stay focused on the protocol mechanism, it omits full error recovery, memory, and skill systems. Added: **ProtocolState** (request state tracking), **dispatch_message** (routes incoming messages by type to handlers), **match_response** (correlates response to request via request_id, with type validation).
2929

3030
Two protocols, one mechanism:
3131

@@ -192,7 +192,7 @@ Shutdown handshake complete: request → confirm → shutdown. Every step tracke
192192
| New message types | message, result | + shutdown_request/response, plan_approval_request/response |
193193
| Teammate lifecycle | Max 10 rounds | Idle loop (waits for inbox messages) |
194194
| Lead inbox | check_inbox and main loop read separately | Unified consume_lead_inbox |
195-
| Lead tools | 14 (s15) | + request_shutdown, request_plan, review_plan (17) |
195+
| Lead tools | 14 (s15) | 14 (core tool set plus request_shutdown, request_plan, review_plan) |
196196
| Teammate tools | 4 (s15) | + submit_plan (5) |
197197

198198
---

s16_team_protocols/README.ja.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ s15 のチームメイトは仕事ができるが、連携は緩い:Lead が
2525

2626
![Team Protocols Overview](images/team-protocols-overview.svg)
2727

28-
教学版は S15 の能力(MessageBus、spawn_teammate、inbox 注入、バックグラウンド実行、cron スケジューリング)を踏襲。プロトコル機構に集中するため、完全なエラーリカバリ、メモリ、スキルシステムは省略。追加:**ProtocolState**(リクエスト状態追跡)、**dispatch_message**(メッセージタイプ別ルーティング)、**match_response**(request_id でリクエストとレスポンスを関連付け、型検証付き)。
28+
教学版は前章までの Agent 能力の流れを受け継ぎ、S15 のチーム通信の上に構造化プロトコルを追加する。プロトコル機構に集中するため、完全なエラーリカバリ、メモリ、スキルシステムは省略。追加:**ProtocolState**(リクエスト状態追跡)、**dispatch_message**(メッセージタイプ別ルーティング)、**match_response**(request_id でリクエストとレスポンスを関連付け、型検証付き)。
2929

3030
2 つのプロトコル、1 つの仕組み:
3131

@@ -192,7 +192,7 @@ LLM が非 tool_use を返す
192192
| 新規メッセージ型 | message, result | + shutdown_request/response, plan_approval_request/response |
193193
| チームメイトライフサイクル | 最大 10 ラウンド | idle loop(inbox メッセージを待機) |
194194
| Lead inbox | check_inbox とメインループが別々に読み取り | 統一 consume_lead_inbox |
195-
| Lead ツール | 14 (s15) | + request_shutdown, request_plan, review_plan (17) |
195+
| Lead ツール | 14 (s15) | 14(コアツールセットに request_shutdownrequest_planreview_plan を追加) |
196196
| チームメイトツール | 4 (s15) | + submit_plan (5) |
197197

198198
---

s16_team_protocols/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ s15 的队友能干活了,但协调是松散的:Lead 发消息,队友回
2525

2626
![Team Protocols Overview](images/team-protocols-overview.svg)
2727

28-
教学代码沿用 S15 的能力(MessageBus、spawn_teammate、inbox 注入、后台执行、cron 调度)。为了聚焦协议机制,省略了完整错误恢复、记忆和技能系统。新增三样:**ProtocolState**(请求状态追踪)、**dispatch_message**(按消息类型路由到处理器)、**match_response**(通过 request_id 关联回复与请求,含类型校验)。
28+
教学代码承接前面章节的 Agent 能力脉络,在 S15 团队通信基础上加入结构化协议。为了聚焦协议机制,省略了完整错误恢复、记忆和技能系统。新增三样:**ProtocolState**(请求状态追踪)、**dispatch_message**(按消息类型路由到处理器)、**match_response**(通过 request_id 关联回复与请求,含类型校验)。
2929

3030
两种协议,一套机制:
3131

@@ -194,7 +194,7 @@ LLM 返回非 tool_use
194194
| 新消息类型 | message, result | + shutdown_request/response, plan_approval_request/response |
195195
| 队友生命周期 | 最多 10 轮 | idle loop(等待 inbox 消息) |
196196
| Lead inbox | check_inbox 和主循环分别读 | 统一 consume_lead_inbox |
197-
| Lead 工具 | 14 (s15) | + request_shutdown, request_plan, review_plan (17) |
197+
| Lead 工具 | 14 (s15) | 14(核心工具集加入 request_shutdown, request_plan, review_plan |
198198
| 队友工具 | 4 (s15) | + submit_plan (5) |
199199

200200
---

s16_team_protocols/images/team-protocols-overview.en.svg

Lines changed: 5 additions & 5 deletions
Loading

s16_team_protocols/images/team-protocols-overview.ja.svg

Lines changed: 4 additions & 4 deletions
Loading

s16_team_protocols/images/team-protocols-overview.svg

Lines changed: 5 additions & 5 deletions
Loading

s17_autonomous_agents/README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Two teammates claim and work in parallel. Lead only creates tasks and spawns tea
201201
| Lead inbox | Prints only, not in context | consume_lead_inbox injects into history |
202202
| New functions || idle_poll, scan_unclaimed_tasks, consume_lead_inbox |
203203
| Identity persistence | System prompt only | Auto re-inject after compression |
204-
| Lead tools | 13 | 14 (+ get_task) |
204+
| Lead tools | 14 (s16) | 14 (unchanged) |
205205
| Teammate tools | 5 | 8 (+ list_tasks, claim_task, complete_task) |
206206
| Teammate exit | Exit after task done | Exit only after 60s idle timeout |
207207

s17_autonomous_agents/README.ja.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ if len(messages) <= 3:
201201
| Lead inbox | 印刷のみ、コンテキストに入らない | consume_lead_inbox で history に注入 |
202202
| 新規関数 || idle_poll, scan_unclaimed_tasks, consume_lead_inbox |
203203
| 身份保持 | system prompt のみ | 圧縮後に自動再注入 |
204-
| Lead ツール | 13 | 14(+ get_task|
204+
| Lead ツール | 14 (s16) | 14(変更なし|
205205
| チームメイトツール | 5 | 8(+ list_tasks, claim_task, complete_task) |
206206
| チームメイト終了条件 | タスク完了後即終了 | 60s アイドルタイムアウト後のみ終了 |
207207

s17_autonomous_agents/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ if len(messages) <= 3:
201201
| Lead inbox | 只打印,不进上下文 | consume_lead_inbox 统一注入 history |
202202
| 新函数 || idle_poll, scan_unclaimed_tasks, consume_lead_inbox |
203203
| 身份保持 | 仅 system prompt | 压缩后自动重注入 |
204-
| Lead 工具 | 13 | 14(+ get_task|
204+
| Lead 工具 | 14 (s16) | 14(不变|
205205
| 队友工具 | 5 | 8(+ list_tasks, claim_task, complete_task) |
206206
| 队友退出条件 | 完成任务即退出 | 60s 无新任务才退出 |
207207

s17_autonomous_agents/code.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ def claim_task(task_id: str, owner: str = "agent") -> str:
115115
if deps: parts.append(f"blocked by: {deps}")
116116
if missing: parts.append(f"missing deps: {missing}")
117117
return "Cannot start — " + ", ".join(parts)
118-
return f"Blocked by: {deps}"
119118
task.owner = owner
120119
task.status = "in_progress"
121120
save_task(task)
@@ -145,7 +144,7 @@ def complete_task(task_id: str) -> str:
145144
"tools": "Available tools: bash, read_file, write_file, "
146145
"create_task, list_tasks, get_task, claim_task, complete_task, "
147146
"spawn_teammate, send_message, check_inbox, "
148-
"request_shutdown, submit_plan, review_plan.",
147+
"request_shutdown, request_plan, review_plan.",
149148
"workspace": f"Working directory: {WORKDIR}",
150149
"memory": "Relevant memories are injected below when available.",
151150
}
@@ -555,9 +554,9 @@ def run_request_shutdown(teammate: str) -> str:
555554
return f"Shutdown request sent to {teammate} (req: {req_id})"
556555

557556

558-
def run_submit_plan(teammate: str, plan: str) -> str:
557+
def run_request_plan(teammate: str, task: str) -> str:
559558
"""Lead asks a teammate to submit a plan."""
560-
BUS.send("lead", teammate, f"Please submit a plan for: {plan}",
559+
BUS.send("lead", teammate, f"Please submit a plan for: {task}",
561560
"message")
562561
return f"Asked {teammate} to submit a plan"
563562

@@ -709,12 +708,12 @@ def run_check_inbox() -> str:
709708
"input_schema": {"type": "object",
710709
"properties": {"teammate": {"type": "string"}},
711710
"required": ["teammate"]}},
712-
{"name": "submit_plan",
711+
{"name": "request_plan",
713712
"description": "Ask a teammate to submit a plan for review.",
714713
"input_schema": {"type": "object",
715714
"properties": {"teammate": {"type": "string"},
716-
"plan": {"type": "string"}},
717-
"required": ["teammate", "plan"]}},
715+
"task": {"type": "string"}},
716+
"required": ["teammate", "task"]}},
718717
{"name": "review_plan",
719718
"description": "Approve or reject a submitted plan.",
720719
"input_schema": {"type": "object",
@@ -733,7 +732,7 @@ def run_check_inbox() -> str:
733732
"spawn_teammate": run_spawn_teammate,
734733
"send_message": run_send_message, "check_inbox": run_check_inbox,
735734
"request_shutdown": run_request_shutdown,
736-
"submit_plan": run_submit_plan, "review_plan": run_review_plan,
735+
"request_plan": run_request_plan, "review_plan": run_review_plan,
737736
}
738737

739738

0 commit comments

Comments
 (0)