- Application policy (recommended). Configure enforcement mode, thresholds, dimension
weights, compliance frameworks, and safe-regeneration fallback once per
application in the dashboard. It’s enforced automatically for every
evaluation made with that application’s keys — no per-request logic in your code. Inspect the
live policy with
GET /config; every evaluation reports the outcome aspolicy_outcome. - SDK policy (local). Set a
policy=onRAILSessionorRAILMiddlewareand let the SDK enforce it in your process. Useful for local-only logic, or enforcement you don’t want to manage centrally.
Application policy:
GET /config | SDK policy: Python: Policy Engine | Sessions: RAILSessionEvaluation vs policy
Application policy
Every evaluation is checked against your application’s configured policy and reports the outcome. The policy itself is three things:enforcement—log_only(record outcomes only),block(reject content below threshold), orregenerate(attempt a safe rewrite via/safe-regenerate, then apply a configured fallback if that doesn’t pass either).- Thresholds — an
overallThresholdfor the combined score, plus optionaldimensionThresholdsso an individual dimension (e.g.safety) can fail the policy even when the overall score passes. - Enforcement mode — a policy can be
active(able to block/regenerate responses) or inmonitormode (outcomes are recorded and returned but responses are never altered). Monitor mode is how you validate a new threshold against real traffic before turning it on.
GET /config for the full policy shape and how to read the
current enforcement mode, and policy_outcome for what each
evaluation response reports.
SDK policy (local)
The Python SDK’s local equivalent is a five-valuePolicy enum — LOG_ONLY, BLOCK,
REGENERATE, CUSTOM (call your own callback), and DPDP_ENFORCE (run a DPDP scan before the
threshold check). You attach it to RAILSession (multi-turn
conversations) or RAILMiddleware (wrapping a single generation
call), and the SDK enforces it in your process — independent of, and in addition to, any
application policy configured in the dashboard.
RAILSession applies the same policy= per turn, and exposes running conversation stats
(session.average_score, session.lowest_score, session.scores_summary()) so you can react
to drift across a whole conversation rather than just one turn — see
Python: Sessions.
See Python: Policy Engine for the full Policy reference,
RAILBlockedError handling, and how to drive PolicyEngine standalone.