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
| Action | Result |
|---|---|
| allow | runs |
| caution | throws error |
| review | throws error |
| block | throws error |
2.B
confirm_reviewUse 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
| Action | Result |
|---|---|
| allow | runs |
| review | asks for confirmation, runs if confirmed |
| caution | throws error |
| block | throws error |
2.C
queueUse 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
| Action | Result |
|---|---|
| allow | runs |
| caution | sent to your review queue |
| review | handled via hook |
| block | throws 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
| Handler | When it runs |
|---|---|
| allow | Action is safe, execute it |
| caution | Action has moderate risk; proceed with awareness |
| review | Action needs active attention or intervention |
| block | Action must be stopped |
| default | Fallback if no other handler matches (optional) |
The
block handler is required.Using
summary, context, and typesummary (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.