PTENES
MODULE 1.3

📈 Evals and observability

Create datasets, metrics, traces, and gates that can explain discovery, selection, execution, and outcome.

6

Topics

3h

Load

Expert

Level

Quality

Type

0 of 60%
1

Define observable success

What is it: Each task specifies its initial state, expected result, prohibited effects, and tolerances.

Why learn this: Without an oracle, response fluency becomes a misleading substitute for actual completion.

Versioned dataset starting state Tracked runs observable decision Release gate verifiable result

Before modeling

Write down the person's request, the current state, and the evidence that will prove completion.

Starting error

Starting with a function name or a button produces a tool without a clear human goal.

Anticipate before opening the code

What information changes the decision? What effect needs to appear in the interface? Answer before implementing.

expected: { enrollmentStatus: "draft" }
forbidden: { chargeCreated: true }
Going deeper: evidence worth keeping

Record the input, previous state, decision made, result, and visible change to the page.

Also include a simulated failure and the observed behavior without WebMCP support.

Key Concepts

01

initial state

02

expected effect

03

forbidden effect

04

oracle

2

Build a representative dataset

What is it: Cases cover frequency, risk, ambiguity, failures, and real-world language variation.

Why learn this: An average dominated by easy cases hides critical regressions.

QuestionStrong contractWeak contract
When should you use it?The description names the intent and context.“Does things” or “manages.”
What does it receive?Only the data needed.Generic, unlimited object.
What does it return?Verifiable state and next action.Text without a protocol.
How does it fail?Code, reason, and recovery.Opaque exception.

Do

  • ✓ Use specific verbs.
  • ✓ Define the inputs.
  • ✓ State the evidence.

Avoid

  • ✗ Mix intents.
  • ✗ Accept any object.
  • ✗ Hide effects.
dataset = stratify(cases, ["happy", "ambiguous", "failure", "adversarial"]);
Going deeper: evidence worth keeping

Record the input, previous state, decision made, result, and visible change to the page.

Also include a simulated failure and the observed behavior without WebMCP support.

Key Concepts

01

strata

02

risk weighting

03

paraphrase

04

edge case

3

Evaluate each pipeline stage

What is it: Discovery, selection, arguments, policy, execution, and response each have their own metrics.

Why learn this: The breakdown pinpoints the regression and guides the fix.

1

Observe

Capture state, input, and context before taking action.

2

Decide

Validate preconditions and choose the allowed transition.

3

Run

Apply the shared rule and honor cancellations.

4

Prove

Update the interface and return a structured result.

Checkpoint

If step 2 fails, the tool doesn’t try to “make it work”: it returns an explicit recovery path.

metrics = { discoveryRecall, correctTool, validArgs, policyCompliance, taskSuccess };
Going deeper: evidence worth keeping

Record the input, previous state, decision made, result, and visible change to the page.

Also include a simulated failure and the observed behavior without WebMCP support.

Key Concepts

01

retrieval recall

02

tool accuracy

03

schema validity

04

task success

4

Instrument traces without leaking data

What is it: Spans correlate turns and calls with sanitized attributes, versions, and duration.

Why learn this: Useful observability preserves diagnostic value without storing unnecessary prompts or PII.

REFERENCE CODE

span.setAttributes({ toolName, catalogVersion, outcome, durationMs });
span.addEvent("policy.denied", { reasonCode });
Input

It is small, documented, and verifiable.

Execution

Reuses the application's actual rule.

Output

Lets you verify the effect and continue.

Read the code as a contract

Underline where input is validated, where the effect happens, where cancellation arrives, and where the UI is updated.

Going deeper: evidence worth keeping

Record the input, previous state, decision made, result, and visible change to the page.

Also include a simulated failure and the observed behavior without WebMCP support.

Key Concepts

01

OpenTelemetry

02

span

03

redaction

04

sampling

5

Detect regressions and drift

What is it: Versioned baselines let you compare models, prompts, catalogs, and browsers over time.

Why learn this: Changes that seem isolated can alter selection and success rates.

Simulated failure

Run the scenario with missing state, invalid input, or unavailable capacity.

Expected recovery

The response explains what failed, what remains safe, and what action can continue.

Minimum test matrix

✓ reproducible happy path

✓ actionable invalid input

✓ cancellation ends the work

✓ fallback preserves the user journey

✓ interface reflects the state

✓ backend retains authorization

gate.failIf(taskSuccess < baseline - 0.02 || unauthorizedEffects > 0);
Going deeper: evidence worth keeping

Record the input, previous state, decision made, result, and visible change to the page.

Also include a simulated failure and the observed behavior without WebMCP support.

Key Concepts

01

baseline

02

confidence interval

03

drift

04

canary

6

Turn evaluation into a release gate

What is it: Minimum risk-based criteria block publication, while noncritical alerts trigger follow-up.

Why learn this: Evals go from decorative reports to operational controls.

Synthesis exercise

  1. 1. Explain the problem without using the name of the technology.
  2. 2. Design the before and after states.
  3. 3. Implement the smallest working proof.
  4. 4. Trigger a failure and record the recovery.
  5. 5. Deliver code, evidence, and one known limitation.

Module challenge

Build an eval harness with happy-path, ambiguous, and adversarial cases, and publish a release decision dashboard.

Responsible Expert criterion

The implementation must work, explain its limitations, and preserve the human path when the experimental capability is unavailable.

release.requires([security.zeroUnauthorized, p95Latency.lt(3000), criticalTasks.gte(0.98)]);
Going deeper: evidence worth keeping

Record the input, previous state, decision made, result, and visible change to the page.

Also include a simulated failure and the observed behavior without WebMCP support.

Key Concepts

01

quality gate

02

risk tier

03

waiver

04

evidence

📦 Module delivery

Build an eval harness with happy-path, ambiguous, and adversarial cases, and publish a release decision dashboard.

Acceptance criteria

The implementation works with WebMCP support and preserves the manual path when the API is unavailable.

Evidence

Include code, the tested scenario, the observed result, and one known limitation.

Technical sources