Subagents in the unrolled agent loop
- Langage dominant
- Rust
- Étoiles
- 54.2k
- Forks
- 6.2k
- Merge moyen
- 3 j 4 h
- PR mergées (30 j)
- 240
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
L’issue décrit l’implémentation de subagents dans une boucle d’agent déroulée. Commencez par examiner l’implémentation existante de delegate et la structure de session. Recherchez le flag de machine à états GOOSE_STATE_MACHINE=1 ainsi que les ForegroundSubagentOperation et BackgroundSubagentOperation prévus. Il est essentiel de comprendre le cycle de vie de la session, l’ordre d’exécution des outils et la manière dont les runtimes enfants sont gérés. « Terminé » signifie que les subagents peuvent être planifiés, exécutés simultanément et que leurs résultats sont transmis à l’agent parent via les opérations décrites.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- rust
- Domaine
- ai-infra-agents
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- Active
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100