Documentation
¶
Overview ¶
Package agent provides agent pool management with rate limiting and concurrency control for scalable AI agent operations.
Index ¶
- type Agent
- type Event
- type Message
- type Pool
- func (p *Pool) Acquire(ctx context.Context) (*iteragent.Agent, error)
- func (p *Pool) Close()
- func (p *Pool) Release(agent *iteragent.Agent)
- func (p *Pool) Spawn(ctx context.Context, task string, handler func(*iteragent.Agent) error) error
- func (p *Pool) SpawnAll(ctx context.Context, tasks []string, ...) []error
- type Provider
- type RateLimiter
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool manages a pool of agents with rate limiting and concurrency control. Safe for spawning 100+ concurrent agents with controlled API rate.
func NewPool ¶
func NewPool(provider iteragent.Provider, tools []iteragent.Tool, logger *slog.Logger, maxAgents, rps int) *Pool
NewPool creates an agent pool with rate limiting. maxAgents: maximum concurrent agents (e.g., 10) rps: API requests per second limit (e.g., 5)
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter controls API call frequency using token bucket algorithm.
func NewRateLimiter ¶
func NewRateLimiter(rps int) *RateLimiter
NewRateLimiter creates a rate limiter with the given requests per second. If rps is 0 or negative, the limiter is unbuffered (all Wait calls return immediately).
func (*RateLimiter) Stop ¶
func (rl *RateLimiter) Stop()
Stop stops the rate limiter goroutine. Safe to call multiple times.