The scenario
Your agent decides it wants to do something — run a database query, write a file, call an external API, export a record, spend tokens. Before it actually performs the action, you intercept it at the decision boundary and ask MeshQu: is this action allowed under our agent-governance policy? The policy checks things like:- The action declares a target environment and action type (no unscoped actions).
- The action’s risk score is within limits — high risk routes to human approval, critical risk is denied outright.
- The action does not export PII without an audit justification.
- External API calls and resource scopes are declared and within budget.
Mental model: MeshQu is the gate, not the guard. It tells your runtimeALLOW/REVIEW/DENY. Your runtime is what actually lets the tool call through, holds it for a human, or refuses it. A receipt is produced either way.
Decision boundary
The agent never reachesEXEC without passing through MeshQu evaluates. Your runtime owns EXEC, HOLD, and REFUSE.
Gate a low-risk action with evaluate
For the hot path — gating thousands of routine tool calls — use evaluate. It is stateless and stores nothing, so it is cheap to call on every action. Persist only the consequential ones with record (next section).
result.decision and a violations array explaining why — e.g. a missing environment field or a risk_score over the threshold. Feed the violation reason back to the agent so it can adjust or surface it to the operator.
Record a consequential action with record
For actions you must be able to prove later — a production write, a PII access, anything an auditor will ask about — use record. It evaluates and persists a signed receipt, and naming the agent in actor (with type: "automated") binds which agent requested the action into the receipt.
TypeScript
idempotency_key makes a retried gate call safe — if the agent retries the same action, you get the original receipt back (is_new: false) instead of a second authorization. See Idempotency.
Closing the loop on a held action
When aREVIEW action is approved or rejected by a human, record what happened with a decision outcome so the audit trail shows not just the verdict but the human resolution:
Operational notes
- Roll out a new agent rule safely — start it in
shadow_mode. The engine evaluates it and surfaces what it would have denied asALERT, but the verdict your runtime reads stays unaffected until you promote it. Essential when you cannot afford to wrongly block an agent mid-run. See Shadow Mode. - Fail-closed for production actions — if MeshQu is unreachable, a high-stakes agent action should default to refuse, not run. See the fail-open vs fail-closed guidance in Integration Patterns.
- Page on critical denials — subscribe a webhook filtered to
ai_action_gateatseverity_min: criticalto alert when an agent attempts a critical-risk or PII-export action.
Concept references
- Integration Patterns — the synchronous pre-execution gate, and fail-open vs fail-closed.
- Core Concepts — Evaluate vs Record — when to use the stateless gate vs the persisted one.
- Decision Assurance — what the receipt proves about a recorded agent authorization.
- Actor Attribution — binding the agent identity into the receipt.
- Shadow Mode · Webhooks.