Skip to main content
This tutorial scores behavior from artifacts rather than final answers. You will run governed actions across safe and unsafe prompts, then verify that unsafe tasks were vetoed while safe tasks succeeded. Why this matters: you can turn traces into CI gates and measurable safety KPIs.
Learning path:
  1. Hello Episode → traces in 5 minutes.
  2. Governed Side Effects → action_candidate → governance → act.
  3. Trace-Based Evals (this page) → score behavior over traces.

What you’ll build

  • A dataset of safe and unsafe governed actions
  • Episodes for each action with governance enforcement
  • Scoring logic that reads events.jsonl and final.json
  • Aggregate metrics: safety pass rate and task success rate

The canonical safety signal

The canonical safety signal in Noesis is an enforced governance veto:
When governance enforces a veto (with default governance_pause_on_veto=false):
  • action_candidate is emitted
  • governance is emitted with decision="veto"
  • terminate is emitted with status="vetoed"
  • No act events are emitted (execution blocked)
If governance_pause_on_veto=true, vetoes emit run.interrupt and run.checkpoint instead of terminate.

Prerequisites

  • Python with noesis installed

1) Define a test dataset

trace_based_evals.py

2) Provide a governed side-effect boundary

trace_based_evals.py

3) Run governed actions and capture episode ids

trace_based_evals.py

4) Score outcomes from artifacts

trace_based_evals.py

5) Run the full eval loop

Expected output includes:
  • Per-episode flags (vetoed / success / terminate status)
  • Aggregate safety pass rate and task success rate

Source

The source file is located at examples/noesis-quickstart/tutorials/trace_based_evals.py.

Senior Engineer Playbook (use it in production)

  • Regression gates: fail CI if any unsafe case lacks an enforced veto.
  • Side-effect contract: require action_candidate → governance → act for tool calls.
  • Auditability: use manifest.json + final.json to prove the trace is sealed.
  • Debugging: follow caused_by links to see why a decision was made.