Skip to content
TrustMeshVyantraa

Guides

Trust policies

Rules, conditions, precedence, versions, activation and testing.

Rule format

json
{ "id": "refund-approval", "description": "Refunds from $500 to $5,000 need approval",
  "effect": "require_approval",
  "agents": [], "tools": ["refunds"], "actions": ["process"],
  "when": [ { "field": "resource.amount_usd", "op": "gte", "value": 500 },
            { "field": "resource.amount_usd", "op": "lte", "value": 5000 } ],
  "approval": { "approver_role": "security_analyst", "expiry_minutes": 30, "separation_of_duties": false } }

A rule matches when every selector (empty = any) and every condition holds.

Policy input

PathContents
agent.*id, name, environment, risk_level, owner, framework
tool.*name, sensitivity, provider
actionrequested action
resource.*request parameters (secret-looking keys redacted)
context.*business_hours, hour, weekday, recipient_external, recipient_domain, input_provenance, risk_score, risk_level, signals

Operators

eq, neq, gt, gte, lt, lte, in, not_in, contains (array membership or substring), exists, not_exists. A condition on a missing field is false, except not_exists. Numeric comparisons only compare numbers; booleans never equal numbers.

Effects and precedence

quarantine › deny › require_approval › allow › default deny. When several approval rules match, the strictest approver role, the shortest expiry and separation of duties (if any rule asks) apply. Quarantine marks the agent quarantined.

Versions and activation

  • Creating a policy creates version 1. POST /v1/policies/{id}/versions adds an immutable version with a content hash and change note.
  • POST /v1/policies/{id}/activate {"version": n} makes a version active; activating an older version is a rollback. /deactivate stops evaluation. Both need an Administrator or Owner and are audited.
  • Each version is compiled to Rego (see the policy's Rego tab).

Testing

POST /v1/policies/test evaluates a hypothetical request against the active policies, one version, or unsaved draft rules, including a risk score and signals you choose. Nothing is recorded. If OPA is configured, the result is cross-checked against OPA.

Open Policy Agent

Set POLICY_EVALUATOR=opa and OPA_URL to evaluate the generated Rego in OPA. If OPA is unreachable or rejects a module, the request is denied with POLICY_UNAVAILABLE. Parity between the built-in evaluator and OPA 1.22 is covered by an automated test over randomized inputs.