feat(agent): add TargetAgentID to SubTurnConfig for cross-agent delegation

When TargetAgentID is set, spawnSubTurn resolves the target AgentInstance
from the registry and uses it as the base for the child turn. This gives
the child turn the target's workspace, model, tools, and system prompt
instead of inheriting from the caller.

Model validation is relaxed: empty Model is accepted when TargetAgentID
provides the model implicitly via the resolved agent instance.

Ref: #2148
This commit is contained in:
xiaoen
2026-04-15 21:27:13 +08:00
parent 2e149f44dd
commit c47f5fd2c4
2 changed files with 25 additions and 9 deletions
+1
View File
@@ -30,6 +30,7 @@ type SubTurnConfig struct {
ActualSystemPrompt string
InitialMessages []providers.Message
InitialTokenBudget *atomic.Int64 // Shared token budget for team members; nil if no budget
TargetAgentID string // If set, run as this agent (its workspace, model, tools)
}
type SubagentTask struct {