GenAgentEnsemble.Strategies.Pool (gen_agent_ensemble v0.2.0)

Copy Markdown View Source

Fixed-size worker pool strategy.

N identical workers are started on init. Each tell/ask lands on the next free worker; when all are busy, prompts queue FIFO and dispatch as workers free up. Workers are reused across turns (their GenAgent processes stay alive).

Options

  • :worker_count (required) -- integer, number of workers to start.
  • :worker_template (required) -- {name_prefix, module, opts}. Workers are named "#{prefix}-1", ..., "#{prefix}-N".

Failure semantics

  • A worker's turn error fails the token it was running, and the worker returns to the free pool (it may recover on the next prompt).
  • If a worker's process dies, it is removed from the pool. If that worker had an in-flight token it is failed as {:worker_down, reason}. If the pool size reaches zero, the session halts.