CommandHook that enforces spending policy on payment operations.
Integrates with the agent harness hook chain to check budget before allowing payment-related commands. Requires a Ledger and SpendingPolicy to be configured in the hook context.
Setup
defmodule MyAgent do
use Raxol.Agent
def command_hooks do
Raxol.Payments.SpendingHook.set_config(%{
ledger: :my_ledger,
policy: SpendingPolicy.dev()
})
[Raxol.Payments.SpendingHook]
end
end
Summary
Functions
Get the active config from the process dictionary.
Store spending hook config in the process dictionary.
Types
@type config() :: %{ :ledger => GenServer.server(), :policy => Raxol.Payments.SpendingPolicy.t(), optional(:on_confirm) => Raxol.Payments.PolicyGate.confirm_fn() }