# `Ash.Reactor.AshStep`
[🔗](https://github.com/ash-project/ash/blob/v3.27.8/lib/ash/reactor/steps/ash_step.ex#L5)

A reactor step which runs a step-module or an anonymous function, and enqueues any returned
notifications before returning.

The following return values are supported: `{:ok, result}`, `{:ok, result, notifications}`,
`{:ok, result, notifications, new_steps}`

Example:

```elixir
ash_step :maybe_update_post do
  run fn %{post: post, new_amount_of_likes: new_amount_of_likes}, ctx ->
    opts = Ash.Context.to_opts(ctx, return_notifications?: true)
    if post.amount_of_likes != new_amount_of_likes do
      Post.update(post, %{amount_of_likes: new_amount_of_likes}, opts)
    else
      {:ok, post}
    end
end
```
## Options

* `run` - a one or two arity function or MFA which will be called as the run
  function of the step.
* `compensate` - a one to three arity function or MFA which will be called as
  the compensate function of the step.  Optional.
* `undo` - a one to three arity function or MFA which will be called as the
  undo function of this step.  Optional.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
