feat: implement supervisor agent with 3 sub-agents

This commit is contained in:
2026-05-05 11:34:19 +08:00
parent 18790f1bcd
commit a25de092b1
7 changed files with 185 additions and 1 deletions
+37
View File
@@ -0,0 +1,37 @@
package agent
import (
"context"
"eino-test/internal/rag"
"eino-test/internal/tools"
"github.com/cloudwego/eino/adk"
"github.com/cloudwego/eino/components/model"
"github.com/cloudwego/eino/components/tool"
"github.com/cloudwego/eino/compose"
)
func NewRetrievalAgent(ctx context.Context, chatModel model.ToolCallingChatModel, pipeline *rag.RAGPipeline) adk.Agent {
agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{
Name: "RetrievalAgent",
Description: "Searches the knowledge base to find relevant notes. Use for information retrieval and discovery.",
Instruction: `You are a knowledge retrieval expert. Your job is to find the most relevant notes from the user's knowledge base.
Use semantic_search for conceptual or fuzzy queries where the user describes something by meaning.
Use keyword_search when the user provides specific terms, titles, or exact keywords.
Always return the most relevant results with enough context for the user to understand what was found.`,
Model: chatModel,
ToolsConfig: adk.ToolsConfig{
ToolsNodeConfig: compose.ToolsNodeConfig{
Tools: []tool.BaseTool{
tools.NewSemanticSearchTool(pipeline),
tools.NewKeywordSearchTool(pipeline),
},
},
},
MaxIterations: 10,
})
return agent
}