NewPool 创建 Agent 池
(opts *PoolOptions)
| 27 | |
| 28 | // NewPool 创建 Agent 池 |
| 29 | func NewPool(opts *PoolOptions) *Pool { |
| 30 | maxAgents := opts.MaxAgents |
| 31 | if maxAgents == 0 { |
| 32 | maxAgents = 50 |
| 33 | } |
| 34 | |
| 35 | return &Pool{ |
| 36 | agents: make(map[string]*agent.Agent), |
| 37 | deps: opts.Dependencies, |
| 38 | maxAgents: maxAgents, |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | // Create 创建新 Agent 并加入池 |
| 43 | func (p *Pool) Create(ctx context.Context, config *types.AgentConfig) (*agent.Agent, error) { |
no outgoing calls