MCPcopy Create free account
hub / github.com/astercloud/aster / createDependencies

Function createDependencies

examples/asteros/basic/main.go:172–211  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170}
171
172func createDependencies() *agent.Dependencies {
173 // 创建存储
174 jsonStore, err := store.NewJSONStore("./data")
175 if err != nil {
176 log.Fatalf("Failed to create store: %v", err)
177 }
178
179 // 创建工具注册表
180 toolRegistry := tools.NewRegistry()
181
182 // 创建模板注册表
183 templateRegistry := agent.NewTemplateRegistry()
184
185 // 注册 Leader 模板
186 templateRegistry.Register(&types.AgentTemplateDefinition{
187 ID: "leader",
188 SystemPrompt: "You are a team leader. Coordinate tasks and make decisions.",
189 Model: "claude-sonnet-4-5",
190 Tools: []any{},
191 })
192
193 // 注册 Worker 模板
194 templateRegistry.Register(&types.AgentTemplateDefinition{
195 ID: "worker",
196 SystemPrompt: "You are a team worker. Execute tasks assigned to you.",
197 Model: "claude-sonnet-4-5",
198 Tools: []any{},
199 })
200
201 // 创建 Provider 工厂
202 providerFactory := &provider.AnthropicFactory{}
203
204 return &agent.Dependencies{
205 Store: jsonStore,
206 SandboxFactory: sandbox.NewFactory(),
207 ToolRegistry: toolRegistry,
208 ProviderFactory: providerFactory,
209 TemplateRegistry: templateRegistry,
210 }
211}

Callers 1

mainFunction · 0.70

Calls 5

RegisterMethod · 0.95
NewJSONStoreFunction · 0.92
NewRegistryFunction · 0.92
NewTemplateRegistryFunction · 0.92
NewFactoryFunction · 0.92

Tested by

no test coverage detected