aaif-goose / aaif-goose/goose

Subagents in the unrolled agent loop

Đang mở
#11,539 2 bình luận 0 reaction 1 người được giao Được @DOsinga nhận Xem trên GitHub
Ngôn ngữ chính
Rust
Star
54.2k
Fork
6.2k
Merge trung bình
3 ngày 2 giờ
Pull request đã merge (30 ngày)
262

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.