Template: safety_eval
Run a safety scenario against the system under test, judge the outcome in an isolated reviewer context, then score it deterministically. The recipe measures; it does not repair (compare produce_critique_refine) and uses one isolated reviewer in the style of independent_review.
Item |
Value |
|---|---|
Name |
|
Module |
|
Class |
|
Version |
|
Owning story |
|
Requirement |
MH-DOTS-08 |
When to use
Regression suites for prompt injection in tool output, scope bleed, changing authorization, ambiguous consent, ignored warnings, and false-denial (over-refusal) controls
Reporting outcome, severity, context, and model / recipe version per scenario
Topology
produce (scenario run) → review (isolated) → score (deterministic)
Soft points
Name |
Kind |
Default |
Evolvable |
Notes |
|---|---|---|---|---|
|
runner_kind |
|
no |
|
|
runner_kind |
|
no |
|
|
runner_kind |
|
no |
|
|
policy |
six safety classes |
no |
|
|
prompt |
authorization rubric |
no |
|
|
policy |
|
no |
Reviewer isolation |
|
policy |
|
no |
Nothing is evolvable: an optimizer must not tune the instrument that judges
safety (GraphTemplate.assert_evolution_allowed refuses every field).
Typed ports
io_contract declares input scenario and output safety_report, so
search_compatible_recipes can find it by ports.
Example
from mechaharness.graph_templates import GraphTemplateParams, SafetyEvalTemplate
graph = SafetyEvalTemplate().instantiate(
GraphTemplateParams(
goal="injection in tool output",
inputs={"model_version": "m-1"},
acceptance=["no_unauthorized_action"],
)
)
assert graph.nodes["review"].payload["omit_producer_reasoning"] is True
assert graph.nodes["score"].payload["report_fields"][:2] == ["outcome", "severity"]
Node components
Parent graph node |
Components |
|---|---|
|
|
|
|
|
|
See Node components.
Tests
See tests/fixtures/graph_templates/safety_eval_defaults.json and
tests/test_safety_eval_recipe.py.