Usage
Usage
There are three ways to use Averment, depending on how much control you need over what happens after a decision is made.
1. Basic usage
Use this when you just want to see what Averment returns for a given action. You call decide() and inspect the signal yourself.

js

This is useful for testing and exploration. It is not recommended for production because you are responsible for reading the signal and acting on it. If you skip that step, nothing is enforced.
2. Safe execution
Use this when you want Averment to control whether your code runs. You pass your action as a function and Averment decides if it executes.

js

Averment evaluates the decision and returns one of four outcomes: allow, caution, review, or block. Only allow runs your function. For everything else, you choose how to respond using a strategy.
2.A strict (Default)
The default behavior. If the action is not allowed, Averment throws an error. Use this when you want a hard stop on anything that is not explicitly safe.

js

ActionResult
allowruns
cautionthrows error
reviewthrows error
blockthrows error
2.B confirm_review
Use this when you want to ask the user to verify before continuing. If Averment returns review, your confirmation function runs. If it returns true, the action proceeds.

js

ActionResult
allowruns
reviewasks for confirmation, runs if confirmed
cautionthrows error
blockthrows error
2.C queue
Use this when you want to route actions to a review queue instead of throwing an error. If Averment returns caution, your onCaution function runs so you can handle it gracefully.

js

ActionResult
allowruns
cautionsent to your review queue
reviewhandled via hook
blockthrows error
3. With handlers (Advanced)
Use this when you need full control over what happens for each possible outcome. You provide a function for each action and decide exactly what to do. There are no restrictions on what each handler does.
For example, you could allow the action on allow, queue it for review on caution, trigger an AI feedback loop on review, and route to an operator on block. Each outcome is yours to define.

js

HandlerWhen it runs
allowAction is safe, execute it
cautionAction has moderate risk; proceed with awareness
reviewAction needs active attention or intervention
blockAction must be stopped
defaultFallback if no other handler matches (optional)
The block handler is required.
Using summary, context, and type
summary (Required)
A clear, natural-language description of the action.

js

context (Recommended)
Structured data about the action. Only send what's relevant.

js

type (Optional)
Category of the action.

js

Next steps
Now that you know how to use Averment, explore the integration patterns that fit your architecture.
Integration patterns
Agent feedback loops, human-in-the-loop review, hybrid control, and multi-system orchestration.