diff --git a/pkg/tools/delegate.go b/pkg/tools/delegate.go index 8831ffeb3..dcde27718 100644 --- a/pkg/tools/delegate.go +++ b/pkg/tools/delegate.go @@ -4,6 +4,8 @@ import ( "context" "fmt" "strings" + + "github.com/sipeed/picoclaw/pkg/routing" ) // DelegateTool delegates a task to a specific named agent and waits for @@ -61,10 +63,11 @@ func (t *DelegateTool) Parameters() map[string]any { } func (t *DelegateTool) Execute(ctx context.Context, args map[string]any) *ToolResult { - agentID, _ := args["agent_id"].(string) - if strings.TrimSpace(agentID) == "" { + rawAgentID, _ := args["agent_id"].(string) + if strings.TrimSpace(rawAgentID) == "" { return ErrorResult("agent_id is required and must be a non-empty string") } + agentID := routing.NormalizeAgentID(rawAgentID) task, _ := args["task"].(string) if strings.TrimSpace(task) == "" {