% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/policy_controls.R
\name{policy_controls}
\alias{policy_controls}
\title{Configure policy-level control actions}
\usage{
policy_controls(
  on_prompt_block = "block",
  on_context_block = "drop",
  on_output_block = "block",
  refusal_message = "I can't safely complete that request.",
  escalation_message = "Human review requested by llmshieldr policy."
)
}
\arguments{
\item{on_prompt_block}{One of \code{"block"}, \code{"refuse"}, or \code{"escalate"}.}

\item{on_context_block}{One of \code{"drop"}, \code{"keep_redacted"}, \code{"block"},
\code{"refuse"}, or \code{"escalate"}.}

\item{on_output_block}{One of \code{"block"}, \code{"refuse"}, or \code{"escalate"}.}

\item{refusal_message}{Message returned as \code{result$output} when a control
maps a block to \code{refuse}.}

\item{escalation_message}{Optional human-readable reason stored in policy
metadata when a control maps a block to \code{escalate}.}
}
\value{
A list of policy controls.
}
\description{
\code{policy_controls()} defines how \code{\link[=secure_chat]{secure_chat()}} should respond after a
scanner has already resolved a prompt, context row, or output as blocked.
Scanner reports still use the core actions \code{allow}, \code{redact}, and \code{block};
controls decide whether the orchestration layer should drop context, return
a refusal message, or mark a run for human review.
}
\details{
Control fields:
\itemize{
\item \code{on_prompt_block}: applied when the user prompt is blocked before the chat
call.
\item \code{on_context_block}: applied when one or more retrieved context rows are
blocked. \code{"drop"} excludes blocked rows and continues. \code{"keep_redacted"}
includes their redacted text. \code{"block"}, \code{"refuse"}, and \code{"escalate"} stop
before the chat call.
\item \code{on_output_block}: applied when model output is blocked after the chat
call.
}

\code{refuse} returns \code{refusal_message} as the result output. \code{escalate} returns
no output and records the final action as \code{"escalate"} for downstream
routing.
}
\examples{
guardrails <- policy(
  "enterprise_default",
  overrides = list(
    controls = policy_controls(
      on_prompt_block = "refuse",
      on_context_block = "drop"
    )
  )
)
}
