Jido.AgentServer.Lifecycle.Keyed (Jido v2.3.1)

Copy Markdown View Source

Lifecycle implementation for keyed/pooled agents.

Handles:

  • Attachment tracking (attach/detach/monitor owner processes)
  • Idle timer management (start/cancel/reset)
  • Hibernate on shutdown (calls Jido.Persist)

State

Adds a lifecycle sub-map to server state with:

  • attachments - MapSet of attached pids
  • attachment_monitors - Map of ref => pid
  • idle_timer - timer reference or nil
  • idle_timeout - timeout value in milliseconds
  • pool - pool name (for logging)
  • pool_key - pool key
  • storage - storage config for persistence

Events

  • {:attach, pid} - attach a process
  • {:detach, pid} - detach a process
  • :touch - reset idle timer
  • {:down, ref, pid} - handle monitor DOWN
  • :idle_timeout - handle idle timeout