Jido.Agent.StateOp (Jido v2.0.0-rc.1)
View SourceState operations that strategies handle to update agent state.
These are not directives - they never leave the strategy layer. They are separated from directives to maintain a clean boundary:
- State operations → modify agent state within the strategy
- Directives → external effects for the runtime to execute
Available State Operations
SetState- Deep merge attributes into stateReplaceState- Replace state wholesale (no merge)DeleteKeys- Remove top-level keys from stateSetPath- Set value at a nested pathDeletePath- Delete value at a nested path
Usage
Actions can return state operations alongside directives:
alias Jido.Agent.{Directive, StateOp}
{:ok, result, [
%StateOp.SetState{attrs: %{status: :processing}},
%Directive.Emit{signal: my_signal}
]}The strategy applies state operations to the agent and passes through directives to the runtime.
Summary
Functions
Creates a DeleteKeys state operation.
Creates a DeletePath state operation.
Creates a ReplaceState state operation.
Creates a SetPath state operation.
Creates a SetState state operation.
Types
@type t() :: Jido.Agent.StateOp.SetState.t() | Jido.Agent.StateOp.ReplaceState.t() | Jido.Agent.StateOp.DeleteKeys.t() | Jido.Agent.StateOp.SetPath.t() | Jido.Agent.StateOp.DeletePath.t()
Any state operation struct.
Functions
@spec delete_keys([atom()]) :: Jido.Agent.StateOp.DeleteKeys.t()
Creates a DeleteKeys state operation.
@spec delete_path([atom()]) :: Jido.Agent.StateOp.DeletePath.t()
Creates a DeletePath state operation.
@spec replace_state(map()) :: Jido.Agent.StateOp.ReplaceState.t()
Creates a ReplaceState state operation.
@spec set_path([atom()], term()) :: Jido.Agent.StateOp.SetPath.t()
Creates a SetPath state operation.
@spec set_state(map()) :: Jido.Agent.StateOp.SetState.t()
Creates a SetState state operation.