Subagents in the unrolled agent loop
- 主要言語
- Rust
- スター
- 54.2k
- フォーク
- 6.2k
- 平均マージ
- 3日 4時間
- マージ済み PR(30日)
- 240
説明
Summon remains a platform tool that schedules subagents, while other callers may schedule them through the same interface. Scheduling creates a child session containing its provider, model, extensions, recipe, working directory, parent session, and execution mode. Execution mode is a new persisted session field; everything else is already stored on the session. The delegate call answers immediately with the child session ID, so the parent tool request is never left pending and later results are correlated by session ID.
Every child receives the existing final-output tool. A recipe may define its schema; otherwise the tool uses a default object schema with one required summary string. A successful final-output call is the persisted signal that the child has finished, and its arguments are the result returned to the parent. Results are always read from the child conversation rather than live runtime state, so completed children behave the same whether their runtime still exists or not.
ForegroundSubagentOperation discovers foreground children from their sessions. It runs after tool execution, allowing sibling tool calls to keep their current priority, but before the machine would otherwise end the parent turn. It reconstructs unfinished child pipelines and steps them concurrently, applying each completed step to its child session. When a child produces its final output, the operation appends an agent-visible, user-hidden message containing the child session ID and result, then lets the parent react. An operation note on that message records delivery. If the parent yields, the remaining children stay at their last persisted boundaries and are reconstructed when it resumes.
Both subagent operations receive a shared registry of live child runtimes keyed by session ID. The registry keeps expensive runtime resources, such as loaded extensions, but contains no conversation, configuration, or result state. ForegroundSubagentOperation rebuilds child pipelines around these runtimes. A cold start constructs a runtime only when none exists, such as after a process restart. A runtime is removed when the child produces its final output or is cancelled.
BackgroundSubagentOperation also receives a manager supplied by the caller. The manager keeps the running task, cancellation token, and completion signal for each background child, allowing it to continue after the parent yields or its pipeline is dropped. The operation starts scheduled children and reconnects to existing tasks, while Summon exposes their status, result, and cancellation through its tools. A successful final-output call means completed, a recorded failure means failed, and a live manager entry means running. An incomplete foreground child without a runtime is reconstructed; an incomplete background child without a task after restart is recorded as failed.
Until the legacy loop is retired, delegate keeps its current blocking implementation outside the state machine. Under GOOSE_STATE_MACHINE=1, it schedules the child and lets the two subagent operations manage execution and delivery.
コントリビューションガイド
調査の方向性
この issue では、展開されたエージェントループにおける subagents の実装について説明しています。まず、既存の delegate 実装と session 構造を調べます。状態機械フラグ GOOSE_STATE_MACHINE=1 と、予定されている ForegroundSubagentOperation および BackgroundSubagentOperation を探します。session のライフサイクル、ツール実行の順序、子 runtime の管理方法を理解することが重要です。「完了」とは、subagents をスケジュールして並行実行でき、説明されている operations を介してその結果を親 agent に届けられることを意味します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust
- 領域
- ai-infra-agents
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100