ExAgent. Session
(ExAgent v2.0.1)
View Source
Single-writer coordination of application state and a participant roster.
TurnPolicy uses struct state and controls scheduling/admission. Session enforces membership and lifecycle. A turn computes one complete coordination transition, then checkpoints it once. Change functions should calculate state, not perform external effects expecting transactional rollback.
With Store, successful mutation replies follow save confirmation. Checkpoint
errors preserve the new state in memory and block further mutations until
checkpoint/1 saves it; the change function is never retried. Restore loads
validated conversation data, not processes or arbitrary executable continuations.
JSON changes atom keys to strings and does not redact secret content.
Summary
Functions
Retry only the unconfirmed save, without invoking a change function.
Returns a specification to start this module under a supervisor.
Complete a bound terminal run once per lifetime/run using pure host state calculation.
Query a participant's explicitly bound atomic continuation; no agent execution.
Override the actor while preserving the policy scheduling cursor.
Acknowledge a bound local diagnostic explicitly, without running a callback or advancing the turn.
Start a Session with shared_state, policy, participants, session_id, pubsub,
metadata, optional trusted application namespace and Store. Namespace must
match any Store.scoped/2 descriptor. Live participant refs are supplied by
the app within the intended namespace; persisted data never resolves processes.
Store errors/incompatible snapshots fail startup rather than starting empty.
Additional participants after restore must be added explicitly with join/2.
shared_state_codec: MyCodec optionally encodes and restores application
structs through ExAgent.Session.StateCodec, after snapshot validation.
Functions
Retry only the unconfirmed save, without invoking a change function.
Returns a specification to start this module under a supervisor.
See Supervisor.
Complete a bound terminal run once per lifetime/run using pure host state calculation.
Query a participant's explicitly bound atomic continuation; no agent execution.
Override the actor while preserving the policy scheduling cursor.
Acknowledge a bound local diagnostic explicitly, without running a callback or advancing the turn.
Start a Session with shared_state, policy, participants, session_id, pubsub,
metadata, optional trusted application namespace and Store. Namespace must
match any Store.scoped/2 descriptor. Live participant refs are supplied by
the app within the intended namespace; persisted data never resolves processes.
Store errors/incompatible snapshots fail startup rather than starting empty.
Additional participants after restore must be added explicitly with join/2.
shared_state_codec: MyCodec optionally encodes and restores application
structs through ExAgent.Session.StateCodec, after snapshot validation.