Policy Engine & Decision Gate
How the policy engine (NSR) governs agentic action execution inside the Temporal orchestration engine, with the control plane as the authoring and sync layer.The decision gate is rolled out per brand in stages, so whether it is authoritative for a given
brand depends on that brandβs configuration. Do not assume a mutating action is gated β check
the brandβs rollout stage before relying on it.
The three planes
The system separates who decides policy, who reasons about it, and who executes into three planes with clean contracts between them.Policy lifecycle
- Author β a human writes policy in natural language;
prompt-to-rulecompiles it into NSR rules. Structured limits β max auto-refund, blocked actions β live inAutomationConfig.policy_controlsand the unifiedGuardrailPolicy. - Sync β
sync-org-rulesandbootstrap-guardrailspush the orgβs rules into NSRβs per-org knowledge base. The engine never holds the rule store; it references the org KB that NSR hydrates server-side. - Enforce β at runtime the workflow asks NSR to authorize each mutating action.
- Learn β
record_decision_outcomefeeds executed and reverted outcomes back into NSRβs forward chain so rules sharpen over time.
Two NSR touchpoints
NSR is consulted twice, for different jobs. Keeping them separate is the core design decision.
The reasoning call shapes what the agent says and proposes. The decision gate governs
whether a mutating action is allowed to run.
Where it sits in the workflow
evaluate_action_policies is a pure function applying the structured action_rules β blocked,
require_review, and max_auto_amount. The decision gate runs alongside it; where enabled, its verdict is the source of truth.
The verified decision gate
Read-only actions skip the gate entirely. For each mutating proposed action:Two safety properties
These are baked intogate_outcome and unit-tested:
- Grounded-only approvals β an
Approvedverdict only executes when its proof status isgrounded. A confident-but-ungrounded approval escalates instead. - Fail-closed β
Refusedand the transport-failure fallback always escalate. An unreachable policy engine never yields execution.
Fail-closed means an NSR outage degrades into human review, not into unauthorized automation.
Capacity-plan the review queue accordingly.
Why host the gate in Temporal
Putting the gate in a durable workflow rather than a synchronous API guard buys three properties:- Deterministic, auditable replay β the verdict and proof chain that authorized an action live permanently in the workflowβs event history. Replays reuse it, so the audit trail is the execution itself rather than a separate log that can drift.
- Durable human review β
Refusedis a first-class state, not an error. The workflow parks on a signal and waits hours or days for a human verdict. A synchronous guard cannot do this. - Safe rollout β new gate logic is
patched()-gated, so in-flight workflows replay deterministically on the old path while new executions take the new one.
Key types
Related
- Verified Decisions API β the
/v1/decisionscontract - ResponseAutomationV2
- Control plane