()
| 17 | ) |
| 18 | |
| 19 | func main() { |
| 20 | ctx := context.Background() |
| 21 | |
| 22 | // 1. 创建依赖 |
| 23 | deps := createDependencies() |
| 24 | |
| 25 | // 2. 创建代码助手 Agent(会自动注入代码引用规范) |
| 26 | fmt.Println("=== 创建代码助手 Agent ===") |
| 27 | codeAgent, err := agent.Create(ctx, &types.AgentConfig{ |
| 28 | TemplateID: "code-assistant", |
| 29 | Metadata: map[string]any{ |
| 30 | "agent_type": "code_assistant", |
| 31 | }, |
| 32 | Tools: []string{"Read", "Write"}, |
| 33 | }, deps) |
| 34 | if err != nil { |
| 35 | log.Fatalf("创建代码助手失败: %v", err) |
| 36 | } |
| 37 | |
| 38 | // 打印 System Prompt |
| 39 | fmt.Println("\n代码助手的 System Prompt:") |
| 40 | fmt.Println("---") |
| 41 | fmt.Println(getSystemPrompt(codeAgent)) |
| 42 | fmt.Println("---") |
| 43 | |
| 44 | // 3. 创建研究助手 Agent(不会注入代码引用规范) |
| 45 | fmt.Println("\n=== 创建研究助手 Agent ===") |
| 46 | researchAgent, err := agent.Create(ctx, &types.AgentConfig{ |
| 47 | TemplateID: "research-assistant", |
| 48 | Metadata: map[string]any{ |
| 49 | "agent_type": "researcher", |
| 50 | }, |
| 51 | Tools: []string{"Read"}, |
| 52 | }, deps) |
| 53 | if err != nil { |
| 54 | log.Fatalf("创建研究助手失败: %v", err) |
| 55 | } |
| 56 | |
| 57 | // 打印 System Prompt |
| 58 | fmt.Println("\n研究助手的 System Prompt:") |
| 59 | fmt.Println("---") |
| 60 | fmt.Println(getSystemPrompt(researchAgent)) |
| 61 | fmt.Println("---") |
| 62 | |
| 63 | // 4. 创建带 Todo 提醒的 Agent |
| 64 | fmt.Println("\n=== 创建带 Todo 提醒的 Agent ===") |
| 65 | todoAgent, err := agent.Create(ctx, &types.AgentConfig{ |
| 66 | TemplateID: "todo-assistant", |
| 67 | Tools: []string{"Read", "Write"}, |
| 68 | }, deps) |
| 69 | if err != nil { |
| 70 | log.Fatalf("创建 Todo 助手失败: %v", err) |
| 71 | } |
| 72 | |
| 73 | // 打印 System Prompt |
| 74 | fmt.Println("\nTodo 助手的 System Prompt:") |
| 75 | fmt.Println("---") |
| 76 | fmt.Println(getSystemPrompt(todoAgent)) |
nothing calls this directly
no test coverage detected