LESSON 159 / 215·2 min readAdvanced

Failure handling, evaluation, and operational review

Must knowConcept lesson
01 Understand02 Recall03 Prepare

Words made simple

A few useful meanings before you read the explanation.

Evaluation
Checking results against examples and clear criteria to find whether the system works well and where it fails.
Retrieval
Finding and fetching information that is useful for the current question.
Deterministic
Following steps or rules defined by code. The model does not decide which step should run next in a deterministic workflow.
More words from this lesson
State
The data describing where a workflow is now, what it already knows, and what still needs to happen.
Persistence
Saving information so it remains available after a request ends or a process restarts.
Durable
Able to retain progress and recover across interruptions. Durable workflows require appropriate storage and retry behavior.
Authorization
Checking what that identity is allowed to read or do. Being logged in does not grant access to every record.
Observability
Being able to understand system behavior through records such as logs, measurements and traces.

Overview

  • A production reference design specifies failed and uncertain outcomes as carefully as successful ones.
  • Evaluation checks behavior before release; observability detects failures in actual runs.
  • Human escalation is an explicit supported outcome.

Why this matters

A friendly response can hide missing evidence, wrong identity, or an uncertain write.

An everyday example

A clerk distinguishes “not permitted,” “missing information,” and “system unavailable.”

A technical example

Tool timeout after submit produces pending_reconciliation, not “claim failed” or “claim created” without proof.

How it works

  1. Classify failure
  2. Choose safe response
  3. Persist task/operation state
  4. Retry/reconcile/escalate
  5. Verify outcome
  6. Record audit/trace.

Architecture and flow

Failure → deterministic classification → retry / correction / reconciliation / staff → durable result.

The insurance assistant example

Search failure never becomes a confident coverage answer; stale approval never becomes a valid submission.

When to use it

Every route, worker stage, approval, and external effect.

When to avoid it

Do not retry denials, hallucinate missing sources, or silently swallow failed notifications.

Interview answer

“I make no-evidence, denial, transient failure, stale approval, and unknown commit separate states, and test each end to end.”

Benefits, trade-offs, and production considerations

  • Monitor authorization denials, unsupported answers, retrieval freshness, queue age, approval age, duplicate suppression, unknown commits, and cost per successful task.
  • Redact prompts/traces and retain immutable business audit records under the appropriate policy.
Test scenarioExpected outcome
Customer requests another customer's claimDenied; no data or existence leak under defined policy
Policy changed since last conversationFresh applicable version retrieved; old cache invalidated
Uploaded invoice contains injected instructionsNo unauthorized tools/actions; source treated as data
Required clause absentAbstain and offer permitted escalation
Date ambiguous or OCR amount unclearAsk/review affected field; avoid invented certainty
Draft changed after approvalPrior approval invalid; review new exact version
Submit duplicated after timeoutOne canonical claim; existing or reconciled receipt
Model unavailableTemplate/search/staff path as applicable; business status remains truthful
Email send times outReconcile message key/provider reference; avoid duplicate disclosure
Worker deploys during approval waitAuthorized run resumes with compatible state/version

Deployment path: containerize Node and optional Python workers; use a managed database and queue/workflow deployment appropriate to the client's cloud; store secrets through service identity/secret management; provision a staging corpus and fixtures; run security and outcome evals; release to limited traffic; monitor; keep prompt/model/graph version rollback available. Do not create cloud resources merely to match this example.


PAUSE & RECALL

Can you explain it without the notes?

Failure handling, evaluation, and operational review

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

A production reference design specifies failed and uncertain outcomes as carefully as successful ones. Evaluation checks behavior before release; observability detects failures in actual runs. Human escalation is an explicit supported outcome.

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Project 1 — Basic LLM chatbot

Adapted from 13_AI.MD · “Failure handling, evaluation, and operational review”. Examples are study fragments; framework behavior can depend on your version.