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

Method Close

pkg/agent/agent.go:1209–1225  ·  view source on GitHub ↗

Close 关闭Agent

()

Source from the content-addressed store, hash-verified

1207
1208// Close 关闭Agent
1209func (a *Agent) Close() error {
1210 close(a.stopCh)
1211
1212 // 通知 Middleware Agent 停止 (Phase 6C)
1213 if a.middlewareStack != nil {
1214 ctx := context.Background()
1215 if err := a.middlewareStack.OnAgentStop(ctx, a.id); err != nil {
1216 agentLog.Warn(ctx, "middleware OnAgentStop error", map[string]any{"error": err})
1217 }
1218 }
1219
1220 if err := a.sandbox.Dispose(); err != nil {
1221 return err
1222 }
1223
1224 return a.provider.Close()
1225}
1226
1227// buildToolContext 构造工具执行上下文, 注入必要的服务。
1228// 当前会注入:

Callers

nothing calls this directly

Calls 4

OnAgentStopMethod · 0.65
WarnMethod · 0.65
DisposeMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected