Expand description
Session pool — pre-warmed persistent processes with idle reuse.
- at most
max_sessionssessions are checked out at once (semaphore) - every session uses
PoolConfig::options(hooks, MCP servers, model, …) acquire_with(Checkout { model, effort, permission_mode })hands out a session with its own model, effort or permission mode;Nonekeeps the pool’s value- a returned session is reset before it is handed out again:
/clearempties the conversation, and model, effort and permission mode are set for the next checkout, so a task may change them for itself (set_model,set_effort,set_permission_mode) without affecting the next one - dead sessions are dropped and replaced by a fresh spawn
- a session returned while its turn is still running is not reused;
it ends once its last handle is dropped (until then it runs outside
the
max_sessionscount)
Structs§
- Checkout
- Settings for one checkout.
Nonekeeps the value fromPoolConfig::options. - Pool
Config - Configuration of a
SessionPool. - Pooled
Session - A session borrowed from the pool. Returns to the pool on Drop. Keep
clones of
session(e.g. inside anAgent) no longer than thePooledSession: after Drop another task may get the same session. - Session
Pool - A pool of pre-warmed Claude sessions. Cheap to clone.