Skip to main content
Version: Target · roadmap

Guards

A guard is a policy evaluated before an action is reserved — or read (see Policies: everything is a policy). Guards form an ordered list, declared on the skill and, in addition, on a playbook task. A task can add guards; it never removes any.

guarddoesexample
formvalues the person gives (data, not a policy). A field marked identifies: true also identifies the room (declared identifier){address: {type: text, required: true}, phone: {type: phone, identifies: true}}
checkthe tenant validatescheck: checkFormationEligibility
updatea datum set after the previous guards (same)update: {price: quoteFormation}
requirea condition that must hold{require: "$item.fields.amount <= $params.max_amount"}
permissionwho can take this action{permission: {profiles: [manager, rh]}}
policya reusable policy: rule (a condition, a budget) or smart{policy: fraude}, {policy: remboursements-du-jour}
approvala person approves, with one click, before the reservation{approval: {role: support-manager}, when: "$item.fields.amount > 50"}

step_open — the playbook's order — is not declared: the playbook applies it on its own.

Each guard can carry when: (when it applies), and the attributes of any policy: name, effect, mode, reason.

The evaluation order​

Set by the platform. Within a phase, the order you declared.

phasecontentwhy at this rank
1identity, profiles, permission, sub-identityfast, deterministic
2the playbook's order (step_open)same
3the provenance of arguments (set_by), form, requiresame
4budgets (rule, with a counter), smart policiesmore costly, but does not touch the tenant's tools
5checkcalls the tenant: never for an action already refused
6updatethe final datum (the price)
7approvallast: the person approves the final action, with its price
8reserved

A read goes through phases 1 to 4.

Three answers​

The decision point always answers one of the three:

  • allowed — the action is reserved (or read);
  • refused, with a reason readable by the person and by the agent ("choose the dishes first");
  • a human must decide — the action goes pending, in the inbox of the role concerned.

Each answer is written to the log, with the rules evaluated.

A smart policy can only tighten​

A smart policy can ask for a human. It can never turn a refusal into an approval. A business refusal is never decided by the model alone: only the security classes (injection, recipient out of scope) can refuse directly. See Policies.