← All booksBook X

Governance & Observability

The patterns that let humans trust the agent over time.

38 patterns in this book. · Updated

↓ download as png

When to reach for each

01. Agent Resumption Persist agent execution state so a long-running run survives restarts, deploys, or user disconnects. Best for: Agent runs are long enough that restarts, deploys, or disconnects would lose meaningful work. Tradeoff: Checkpoint storage cost. Watch for: Runs complete in seconds and can simply be retried from scratch.

02. Eval Harness Run a held-out dataset against agent versions to detect regressions and measure improvement. Best for: A change that 'feels better' is regressing quality silently in your system. Tradeoff: Dataset bias means high scores can hide real-world failures. Watch for: No expected outputs exist (open-ended creative tasks) and scoring would be subjective.

03. Decision Log Persist the agent's reasoning trace alongside its actions so post-hoc review can explain why. Best for: Action-only logs leave you unable to explain why the agent did something. Tradeoff: Storage and privacy implications. Watch for: Reasoning logs would be retained without any review process consulting them.

04. LLM-as-Judge Use an LLM to score open-ended outputs against rubric criteria when no exact-match metric applies. Best for: Open-ended outputs need automated regression detection without a reference answer. Tradeoff: Judge biases skew scores in subtle ways. Watch for: An exact-match or reference metric already grades the task.

05. Replay / Time-Travel Re-run a past agent trace from any step with modified inputs/prompts/tools to debug or branch. Best for: Agent runs are non-deterministic and incidents need reproducible debugging. Tradeoff: Trace storage overhead. Watch for: Trace storage cost outweighs the value of replay (low-stakes ephemeral runs).

All patterns in this book

Agent Resumption

×38

Persist agent execution state so a long-running run survives restarts, deploys, or user disconnects.

Eval Harness

×17

Run a held-out dataset against agent versions to detect regressions and measure improvement.

Decision Log

×14

Persist the agent's reasoning trace alongside its actions so post-hoc review can explain why.

LLM-as-Judge

×10

Use an LLM to score open-ended outputs against rubric criteria when no exact-match metric applies.

Replay / Time-Travel

×7

Re-run a past agent trace from any step with modified inputs/prompts/tools to debug or branch.

Provenance Ledger

×6

Log every agent decision and state change with enough metadata to explain or reverse it later.

Agent-as-a-Judge

×6

Evaluate an agent's full trajectory (steps, tool calls, intermediate states) by another agent rather than scoring only the final output.

Lineage Tracking

×5

Track which prompt version, model version, and data sources produced each agent output.

Shadow Canary

×4

Run a candidate agent version in shadow alongside the champion, comparing outputs without affecting users.

Dual Evaluation (Offline + Online)

×4

Run two parallel evaluation tracks — offline benchmark gates before deploy AND online production-traffic monitoring after — so drift is caught even when pre-deploy benchmarks pass.

Cost Observability

×3

Surface per-request, per-user, and per-feature cost and token consumption to operators in near-real-time.

Eval as Contract

×3

Treat the eval suite as the contract the agent must satisfy; releases ship only if evals pass.

Prompt Versioning

×3

Treat prompts as immutable, hashed, semver'd artefacts in a registry; deploy and roll back like code.

Agent Middleware Chain

×3

Wrap every model call, tool call, and memory access in a composable pre/execute/post interceptor pipeline so cross-cutting concerns attach without touching agent or orchestrator code.

Durable Workflow Snapshot

×3

Capture workflow execution state as a snapshot in a pluggable storage provider so a paused run can resume across deployments, process restarts, and host crashes.

Re-Contact-Subtracted Resolution Gate

×3

Gate a support agent on a re-contact-subtracted resolution rate so an interaction that merely ends the session is never reported as a resolved one.

Sandbox Escape Monitoring

×3

Treat sandbox boundary violations as telemetry; alert on syscalls, network egress, or filesystem writes outside expected scope.

Journaled LLM Call

×2

Record the output of every non-deterministic step on first execution and replay that recorded value during crash-recovery instead of re-invoking the model.

Production Failure Triage Loop

×2

Sort every production agent failure into a small fixed taxonomy and bind each class to a set remediation path, so fixes are dispatched mechanically and the monitor-to-fix loop stays fast enough to ga…

Sampled Prompt Trace Eval

×2

Capture full prompt/response/metadata traces from production into a monitoring dataset, but only run LLM-judge evaluation on a random sample so monitoring cost stays bounded as traffic grows.

Scorer Live Monitoring

×2

Score agent outputs asynchronously in production with non-blocking scorers that observe, alert, and log but do not regenerate the output.

Agent Evaluator

×1

A dedicated agent or harness whose sole job is running tests against another agent's outputs to evaluate performance; distinct from eval-harness (offline batch) and llm-as-judge (per-output).

Agent Factory

×1

Manufacture agent instances from a versioned template that renders model, tools, and prompt atomically, with registry-backed identities, so a fleet stays consistent and one template change propagates…

Bayesian Bandit Experimentation

×1

Replace fixed-split A/B tests between agent variants with a bandit that dynamically reallocates traffic toward better-performing variants based on observed reward, bounding regret from bad variants.

Decision Token

×1

Mint a self-contained record at the moment a consequential action executes, bundling the rule that fired, the exact data read, the conclusion reached, and the authorizing identity.

Intermediate Artifact Evaluation

×1

Evaluate intermediate artifacts (plans, tool-call traces, guardrail reactions) not only final outputs; isolates failure to a specific pipeline node.

Managed Agent Runtime

×1

Offer the agent loop itself as a managed cloud primitive so a caller supplies a model, system prompt, and tools and the platform runs the orchestration in an isolated, session-scoped runtime.

Own Your Prompts (12-Factor Agents)

×1

Every prompt in a production agent is versioned, tested, and owned by the team in the application repo — never inherited as a framework default.

Scaffold Ablation on Model Upgrade

×1

On each model upgrade, treat every harness component as an encoded assumption about a model weakness and ablate the components the new model no longer needs, gated by evals.

Deontic Token Delegation

×1

Reify obligations, permissions, and prohibitions as transferable deontic tokens that agents pass along the delegation chain with provenance, so duty and accountability transfer with the work, not onl…

Multi-Principal Welfare Aggregation

×1

When an agent serves multiple humans with conflicting preferences, declare the aggregation rule explicitly rather than letting it be implicit in the prompt or fine-tune.

Agentic Golden Path

Constrain an agent to the platform's curated golden path of living, machine-readable standards and check for drift as it works, so its output is compliant by construction rather than corrected later.

Compliance-Certified Launch Gate

Require an external regulator to certify the generative service against a published content-safety standard before it may serve the public, forcing the standard's controls into the build as a re-cert…

Postmortem Pattern Mining

Mine a corpus of thousands of written postmortems through a staged model pipeline that summarises, classifies, analyses, and aggregates so that recurring incident causes surface as one short report.

Rigor Relocation

Relocate verification rigor from the model loop to surrounding scaffolding (evals, judges, decision logs, policy gates) so failures are caught by the wrapper rather than the agent.

Silent Pilot-to-Production Promotion

Anti-pattern: let a well-performing pilot quietly expand in scope until it is a de facto production decision system, while keeping the 'pilot' label so it never trips the go-live governance gate.

Attention-Manipulation Explainability

Surface which input tokens caused a given output by perturbing attention across all transformer layers and measuring the resulting change in output probability, producing a per-token relevance map al…

Determinism-Tiered Replay Gate

Classify an agent into a reproducibility tier by re-running identical inputs, require the strictest decision-determinism tier for regulated decisions, and gate deployment and validation-sample size o…