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

Method OnAgentStop

pkg/middleware/subagent.go:167–178  ·  view source on GitHub ↗

OnAgentStop 清理子代理

(ctx context.Context, agentID string)

Source from the content-addressed store, hash-verified

165
166// OnAgentStop 清理子代理
167func (m *SubAgentMiddleware) OnAgentStop(ctx context.Context, agentID string) error {
168 m.mu.Lock()
169 defer m.mu.Unlock()
170
171 for name, agent := range m.agents {
172 if err := agent.Close(); err != nil {
173 saLog.Error(context.Background(), "failed to close subagent", map[string]any{"name": name, "error": err.Error()})
174 }
175 }
176
177 return nil
178}
179
180// GetSubAgent 获取子代理
181func (m *SubAgentMiddleware) GetSubAgent(name string) (SubAgent, error) {

Callers 1

Calls 2

CloseMethod · 0.65
ErrorMethod · 0.65

Tested by 1