# `Jido.Agent.StateOp`
[🔗](https://github.com/agentjido/jido/blob/v2.3.0/lib/jido/agent/state_op.ex#L1)

State 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 state
- `ReplaceState` - Replace state wholesale (no merge)
- `DeleteKeys` - Remove top-level keys from state
- `SetPath` - Set value at a nested path
- `DeletePath` - 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.

# `t`

```elixir
@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.

# `delete_keys`

```elixir
@spec delete_keys([atom()]) :: Jido.Agent.StateOp.DeleteKeys.t()
```

Creates a DeleteKeys state operation.

# `delete_path`

```elixir
@spec delete_path([atom()]) :: Jido.Agent.StateOp.DeletePath.t()
```

Creates a DeletePath state operation.

# `replace_state`

```elixir
@spec replace_state(map()) :: Jido.Agent.StateOp.ReplaceState.t()
```

Creates a ReplaceState state operation.

# `set_path`

```elixir
@spec set_path([atom()], term()) :: Jido.Agent.StateOp.SetPath.t()
```

Creates a SetPath state operation.

# `set_state`

```elixir
@spec set_state(map()) :: Jido.Agent.StateOp.SetState.t()
```

Creates a SetState state operation.
