refactor(agent): simplify delegate registration gate

Remove the IsToolEnabled("delegate") check — there is no "delegate"
entry in ToolsConfig, so the check was always true. The only real
gate is len(agents) > 1, which is the intended behavior: delegate
is auto-registered in multi-agent setups.

Ref: #2148
This commit is contained in:
xiaoen
2026-04-15 22:24:47 +08:00
parent 6db17b8211
commit 6ee66123f2
+4 -3
View File
@@ -442,9 +442,10 @@ func registerSharedTools(
}
// Register delegate tool for multi-agent setups.
// Delegation uses the SubTurn mechanism directly (not SubagentManager),
// so it does not depend on the subagent tool being enabled.
if cfg.Tools.IsToolEnabled("delegate") && len(registry.ListAgentIDs()) > 1 {
// Auto-enabled when multiple agents exist. Delegation uses the SubTurn
// mechanism directly (not SubagentManager) and is independent of the
// subagent tool.
if len(registry.ListAgentIDs()) > 1 {
delegateTool := tools.NewDelegateTool()
delegateTool.SetSpawner(NewSubTurnSpawner(al))
currentAgentID := agentID