Runs lifecycle hooks for executed actions.
Hooks are intentionally post-execution. They are useful for audit records, delivery acknowledgements, integration events, or cleanup that should happen after the user-facing action result exists.
Summary
Functions
Runs hooks configured for an executed action lifecycle event.
Types
@type hook() :: %{ action: Spectre.Action.ref(), on: hook_event() | atom(), run: {module(), atom()} | function(), opts: keyword() }
@type hook_event() :: :delivered
Functions
@spec run( module(), hook_event() | atom(), Spectre.Result.t(), Spectre.Context.t() | map(), keyword() ) :: :ok | {:error, [term()]}
Runs hooks configured for an executed action lifecycle event.
:ok = Spectre.ActionHooks.run(MyAgent, :delivered, result, ctx)Both agent-level hooks and hooks attached to a completed action effect are considered. Errors are accumulated so one failing hook does not hide another.