Jido.AgentServer.Lifecycle behaviour (Jido v2.2.0)

View Source

Internal behavior for AgentServer lifecycle hooks.

Allows instance managers and other orchestrators to inject attachment tracking, idle timeouts, and storage-backed persistence without polluting the core runtime.

Summary

Types

event()

@type event() ::
  :attach | :detach | :touch | :idle_timeout | {:down, reference(), pid()}

state()

@type state() :: map()

Callbacks

handle_event(event, server_state)

(optional)
@callback handle_event(event :: term(), server_state :: map()) ::
  {:cont, map()} | {:stop, reason :: term(), map()}

init(opts, server_state)

(optional)
@callback init(opts :: keyword(), server_state :: map()) :: map()

persist_cron_specs(server_state, cron_specs)

(optional)
@callback persist_cron_specs(server_state :: map(), cron_specs :: map()) ::
  :ok | {:error, term()}

terminate(reason, server_state)

(optional)
@callback terminate(reason :: term(), server_state :: map()) :: :ok