Nous.Eval.Scorers.GuardVerdict (nous v0.21.1)

Copy Markdown View Source

Checks what a guard decided during the sample, from the guard verdict events in the trace (see Nous.Eval.Trace.guard_verdicts/2).

{Nous.Eval.Scorers.GuardVerdict, guard: :decision_guard, surface: :tool_call, expected: :deny}
{Nous.Eval.Scorers.GuardVerdict, guard: :input_guard, expected: :blocked}
{Nous.Eval.Scorers.GuardVerdict, guard: :loop_guard, expected: :none}

The score is named "guard_verdict.<guard>", or "guard_verdict.<guard>.<surface>" with a surface.

Options

  • :guard - :decision_guard, :input_guard, :loop_guard, or :hook (a decision hook other than DecisionGuard) (required)
  • :expected - required; per guard:
    • :decision_guard / :hook: :allow | :escalate | :deny (the verdict, before escalation is resolved)

    • :input_guard: :safe | :suspicious | :blocked (the severity)

    • :loop_guard: :advisory (at least one advisory) or :none
  • :surface - only verdicts on this DecisionGuard surface (:user_input | :tool_call | :tool_result | :model_output) or, for :hook, this hook event
  • :match - :all (every verdict is the expected one) or :any (at least one is). Default: :all for the benign values :allow / :safe, :any otherwise
  • :scope - :root (default), :tree or {:sub_agent, template}

When the guard produced no verdict in scope, the scorer skips with "guard_not_evaluated" (a required scorer that skips is a scorer error, so a guard that never ran cannot pass a gate). On a truncated trace a result later verdicts could change is a :missing_trace error.