OnAgentStart Agent 启动时启动事件处理器
(ctx context.Context, agentID string)
| 156 | |
| 157 | // OnAgentStart Agent 启动时启动事件处理器 |
| 158 | func (m *LogicMemoryMiddleware) OnAgentStart(ctx context.Context, agentID string) error { |
| 159 | // 启动异步事件处理 goroutine |
| 160 | if m.config.AsyncCapture && m.config.EnableCapture && m.eventBuffer != nil { |
| 161 | m.wg.Add(1) |
| 162 | go m.processEventsAsync() |
| 163 | lmLog.Info(context.Background(), "started async event processor", map[string]any{"agent_id": agentID}) |
| 164 | } |
| 165 | return nil |
| 166 | } |
| 167 | |
| 168 | // OnAgentStop Agent 停止时停止事件处理器 |
| 169 | func (m *LogicMemoryMiddleware) OnAgentStop(ctx context.Context, agentID string) error { |