Jido.Identity.Agent
(Jido v2.0.0-rc.4)
View Source
Helper for managing Identity in agent state.
Identity is stored at the reserved key :__identity__ in agent.state.
Summary
Functions
Ensure agent has an identity (initialize if missing)
Get identity from agent state
Check if agent has an identity
Returns the reserved key for identity storage
Put identity into agent state
Return a public snapshot of the agent's identity
Update identity using a function
Functions
@spec ensure( Jido.Agent.t(), keyword() ) :: Jido.Agent.t()
Ensure agent has an identity (initialize if missing)
@spec get(Jido.Agent.t(), Jido.Identity.t() | nil) :: Jido.Identity.t() | nil
Get identity from agent state
@spec has_identity?(Jido.Agent.t()) :: boolean()
Check if agent has an identity
@spec key() :: atom()
Returns the reserved key for identity storage
@spec put(Jido.Agent.t(), Jido.Identity.t()) :: Jido.Agent.t()
Put identity into agent state
@spec snapshot(Jido.Agent.t()) :: map() | nil
Return a public snapshot of the agent's identity
@spec update(Jido.Agent.t(), (Jido.Identity.t() | nil -> Jido.Identity.t())) :: Jido.Agent.t()
Update identity using a function