Remove 从池中移除 Agent (不删除存储)
(agentID string)
| 138 | |
| 139 | // Remove 从池中移除 Agent (不删除存储) |
| 140 | func (p *Pool) Remove(agentID string) error { |
| 141 | p.mu.Lock() |
| 142 | defer p.mu.Unlock() |
| 143 | |
| 144 | ag, exists := p.agents[agentID] |
| 145 | if !exists { |
| 146 | return fmt.Errorf("agent not found: %s", agentID) |
| 147 | } |
| 148 | |
| 149 | // 关闭 Agent |
| 150 | if err := ag.Close(); err != nil { |
| 151 | return fmt.Errorf("close agent: %w", err) |
| 152 | } |
| 153 | |
| 154 | // 从池中移除 |
| 155 | delete(p.agents, agentID) |
| 156 | return nil |
| 157 | } |
| 158 | |
| 159 | // Delete 删除 Agent (包括存储) |
| 160 | func (p *Pool) Delete(ctx context.Context, agentID string) error { |