Detecting Silent Agent Failures with Outcome Checks and Watchdogs
Detect silent agent failures with independent outcome checks, stage deadlines, observer-health monitoring, and explicit pending, violated, and unknown states.
On this page
An AI-assisted export can return a valid download URL while producing the wrong artifact. The model call may complete, the HTTP response may succeed, and the worker may mark its task finished. Users still need a file for the correct tenant, source snapshot, and requested dataset.
I would monitor that workflow through independently observed outcomes and explicit stage deadlines. The checks should distinguish a known contract violation from an unfinished run and from a monitoring system that cannot currently observe enough evidence.
The example here is hypothetical: an assistant helps a user configure a tabular export, while deterministic services select records, write an immutable artifact, and serve the download. It illustrates a runtime monitoring design, not a reported production incident.
Define a small outcome contract for each workflow
Start with the user-visible promise. For this export route, the backend can define an authorized source snapshot, an artifact identity, an expected row count, a committed content digest, and a visibility deadline. Derive those values from authenticated request context and deterministic services. A model-generated claim that the export succeeded cannot establish them.
Choose checks that match the route’s semantics. An export that intentionally filters rows has a different expected count from a full-table export. An empty result can be valid. A contract that rejects every zero-row artifact would create false failures.
Separate four categories of checks:
| Check | Example | Interpretation |
|---|---|---|
| Outcome invariant | Artifact belongs to the expected tenant and source snapshot | A mismatch is a concrete violation |
| Bounded liveness | A required stage finishes or changes state before its deadline | Breach requires investigation or recovery policy |
| Observation health | Run state and inspector results are fresh and available | Missing evidence prevents a healthy verdict |
| Statistical anomaly | A route’s duration or tool-use distribution shifts | A signal to investigate, not automatic proof of a wrong answer |
This complements offline agent trajectory evaluations. Offline cases test known paths. A runtime monitor applies a versioned contract to actual admitted work and records what it can establish about that run.
Observe the result through a separate path
Google’s SRE monitoring guidance distinguishes externally visible behavior from internal telemetry and separates symptoms from possible causes. An export monitor can apply that discipline by inspecting the artifact through the read path used by the product, while using worker state and traces to explain failures.
An independent inspector should resolve the expected immutable object version under the correct tenant, check its accessibility, and examine the relevant content. A successful storage metadata request alone cannot establish a CSV row count. The inspector may need to parse the object or validate a trustworthy manifest produced by a separate deterministic stage.
Bind observations to the run and artifact. Looking up “the latest export” without that binding could inspect another user’s job and produce a reassuring result for the wrong run. Ensure the download path actually serves the inspected immutable version; checking one version does not protect a URL that later serves a different mutable object.
OpenTelemetry’s tracing API defines span status in relation to the operation being instrumented. The application or instrumentation decides the operation’s validation boundary. A successful model-request span therefore supplies no automatic check of a downstream export’s contents. Record the outcome assessment explicitly rather than inferring it from that status.
Represent pending, unknown, and violated separately
A missing artifact during an allowed visibility interval is pending. The same authoritative absence after the deadline violates the contract. An inspector timeout is unknown: it does not prove that the artifact is absent.
The following TypeScript function makes those distinctions. Its contract comes from trusted backend records. Its readback comes from an authorized inspector after runtime payload validation. The digest is a SHA-256 value in a defined lowercase encoding.
type ExportContract = Readonly<{ runId: string; tenantId: string; artifactId: string; sourceVersion: string; expectedRows: number; expectedSha256: string; verifyByMs: number;}>;type Readback = | { kind: "unavailable" } | { kind: "missing" } | { kind: "found"; runId: string; tenantId: string; artifactId: string; sourceVersion: string; rows: number; sha256: string; };type Assessment = Readonly<{ status: "pending" | "satisfied" | "violated" | "unknown"; reason: string;}>;function assessExport( contract: ExportContract, readback: Readback, nowMs: number,): Assessment { const count = (n: number) => Number.isSafeInteger(n) && n >= 0; const digest = (s: string) => /^[a-f0-9]{64}$/.test(s); if (!count(nowMs) || !count(contract.verifyByMs) || !count(contract.expectedRows) || !digest(contract.expectedSha256)) { throw new RangeError("Invalid server contract"); } if (readback.kind === "unavailable") { return { status: "unknown", reason: "readback_unavailable" }; } if (readback.kind === "missing") { return nowMs < contract.verifyByMs ? { status: "pending", reason: "awaiting_visibility" } : { status: "violated", reason: "artifact_missing_after_deadline" }; } if (!count(readback.rows) || !digest(readback.sha256)) { return { status: "unknown", reason: "invalid_inspector_result" }; } if (readback.runId !== contract.runId || readback.tenantId !== contract.tenantId || readback.artifactId !== contract.artifactId || readback.sourceVersion !== contract.sourceVersion) { return { status: "violated", reason: "wrong_artifact_scope" }; } if (readback.rows !== contract.expectedRows || readback.sha256 !== contract.expectedSha256) { return { status: "violated", reason: "artifact_mismatch" }; } return { status: "satisfied", reason: "defined_checks_passed" };}The expected digest should come from a durable writer commit record; the inspector calculates the actual digest over the retrieved object. Their agreement checks that the inspected object matches the recorded output. It does not prove that the writer transformed every source cell correctly. That requires additional domain checks, independent reconciliation, or reviewed samples.
Likewise, an exact row count and matching source version establish only the defined checks. They do not verify arbitrary explanations generated by the assistant. Keep that limitation visible when naming dashboards: “outcome contract satisfied” is more precise than a universal task-correctness score.
Use the visibility deadline from the original contract throughout retries. Restarting the grace period whenever an inspector retries would let a permanently missing artifact remain pending forever. Record bounded retries and escalate an unknown result that persists beyond the product’s observation policy.
Give the observer its own health checks
A monitor that depends only on sampled model spans can lose the same run it is supposed to inspect. Discover expected work from a durable admission or run ledger, then reconcile that population with available observations. Preserve an unknown count when an admitted run cannot be assessed.
The observer needs a heartbeat, a measured scan position or freshness watermark, and visibility into backlog and failures. A heartbeat shows that a process can report activity. It does not establish that the process has read current run records or inspected the expected artifacts.
Prometheus provides absence functions for detecting missing series over an interval. Use such checks alongside an explicit inventory of expected observer partitions or services. A metric for one healthy partition cannot establish that every required partition is reporting.

*Flow: a versioned run contract and independently inspected artifact feed an outcome verifier, while the durable ledger and observer health feed a deadline watchdog. Policy routes their assessments to an appropriate response.*
The ledger and inspector have dependencies too. Separation reduces shared blind spots; it does not create perfect independence. Document which failures can affect both the workflow and the observer, and test those conditions deliberately.
Advance progress deadlines only on meaningful transitions
Workers can emit frequent logs while repeatedly making the same ineffective request. Set stage deadlines from durable state changes that represent progress: a source snapshot was accepted, a batch was committed, or an artifact entered verification. A timer refreshed by every log line measures activity instead.
The Python watchdog below checks whether the observer and ledger observation are fresh before interpreting a stage deadline. A terminal run still needs outcome handling; completed does not automatically mean that the export contract was satisfied.
from dataclasses import dataclass@dataclass(frozen=True)class RunObservation: state: str ledger_seen_ms: int | None observer_heartbeat_ms: int | None stage_deadline_ms: int | Nonedef watchdog( run: RunObservation, *, now_ms: int, observer_max_age_ms: int, ledger_max_age_ms: int,) -> str: def timestamp(value: object) -> bool: return type(value) is int and value >= 0 if (not timestamp(now_ms) or type(observer_max_age_ms) is not int or observer_max_age_ms <= 0 or type(ledger_max_age_ms) is not int or ledger_max_age_ms <= 0): raise ValueError("Invalid watchdog clock policy") def fresh(value: int | None, maximum_age: int) -> bool: return timestamp(value) and 0 <= now_ms - value <= maximum_age if not fresh(run.observer_heartbeat_ms, observer_max_age_ms): return "unknown_observer_health" if not fresh(run.ledger_seen_ms, ledger_max_age_ms): return "unknown_run_state" if run.state in {"completed", "cancelled", "failed"}: return "terminal_requires_outcome_handling" if run.state != "running": return "unknown_run_state" if not timestamp(run.stage_deadline_ms): return "unknown_stage_deadline" if now_ms >= run.stage_deadline_ms: return "stage_deadline_breached" return "within_stage_deadline"Here, ledger_seen_ms means the observer obtained a sufficiently current, authoritative run-state observation under the datastore’s consistency policy. It must not be set simply because a potentially stale replica answered a query. Check replication freshness or use the appropriate authoritative read when the decision requires it.
The stage deadline belongs to the durable workflow contract. A fresh heartbeat or repeated read leaves that deadline unchanged. Queue waiting, model execution, external approval, and artifact verification should have their own stage policies. An approved long wait should not look like a stuck computation.
A deadline breach is a signal about the latest trusted observation. Before cancellation or another consequential recovery, re-read authoritative state and check the run version and ownership. The run may have completed since the observer’s last read. Monitor lag, clock assumptions, and datastore consistency affect how quickly and confidently the system can react.
This extends progress and loop detection with an external observer. It can still detect an overdue run when the worker has stopped emitting telemetry entirely.
Keep anomaly detection advisory until validated
Some failures do not violate a simple invariant. An assistant may produce a shallow answer, skip a useful optional source, or take an unusual path that remains valid. Distribution changes in latency, tool count, retrieval coverage, or output shape can help find these cases.
Compare like populations: workflow version, task class, model configuration, and relevant risk tier. Legitimate cache reuse can reduce tool calls. A more efficient retrieval policy can shorten a run. Neither change should become a failure merely because it differs from earlier traffic.
Review anomaly samples against domain outcomes, estimate false positives, and measure detection delay before allowing an anomaly score to trigger automatic intervention. Keep clear labels for deterministic violations and heuristic suspicions. Model-based review can assist triage, but an uncalibrated judge should not become the sole authority for declaring business correctness.
Retain offline evaluations for behavior that production monitoring cannot establish directly. Runtime checks cover what the system can observe under a particular contract; they cannot establish every factual property of an open-ended answer.
Choose a response that matches the evidence
Separate observation from action policy. A monitor should emit a versioned assessment containing the run identity, contract version, reason, observation references, and assessment time. A policy service decides the operational response.
| Assessment | Possible response |
|---|---|
| Pending within the visibility deadline | Continue bounded observation and show the appropriate processing state |
| Known artifact scope or content mismatch | Hold release where still possible, preserve evidence, and route to an owner |
| Stage deadline breached | Re-read state, inspect ownership, and apply the stage’s recovery policy |
| Unknown because observation is unavailable | Report monitoring degradation and avoid claiming a verified outcome |
| Defined outcome checks satisfied | Record the specific checks that passed |
Cheap checks can run before a download is released. More expensive readback and reconciliation can run asynchronously, with an explicit limit on detection delay. Once an incorrect artifact has already been delivered, a later alert cannot retroactively prevent that delivery; the product needs a correction and incident process.
Do not automatically replay an entire workflow whenever an assessment is unknown. A remote write may already have succeeded. Use the idempotency and uncertain-outcome policy for recovery, and preserve approvals and authorization for consequential operations.
Retain confirmed violations until an explicit resolution is recorded. A later unknown observation must not silently clear a previously established violation.
Deduplicate incidents by a stable run, contract, and failure identity. Record later observations and resolution instead of creating a new page on every scan. Route confirmed symptoms, persistent unknowns, and advisory anomalies according to their consequences and actionable owners.
Measure coverage alongside detected failures
Start with admitted eligible runs as the population. Record which received an assessment and how those assessments split into pending, satisfied, violated, and unknown. Repeated scans of one run must not inflate the number of covered runs.
Useful measurements include time from contract breach to detection, observer lag, age of the oldest unassessed run, artifact-inspection failure rate, pending results beyond their allowed window, alert precision from reviewed cases, and time to resolution. Track late-discovered failures separately from failures caught before release.
Also measure monitoring overhead: object reads, bytes inspected, queue depth, compute use, and blocked-release latency. Full artifact parsing may be too expensive for every low-risk export. Choose coverage by workflow risk, and clearly distinguish sampled quality checks from mandatory deterministic checks. Uninspected runs should not be counted as verified successes.
Use bounded workflow and reason labels in metrics. Keep run IDs, artifact references, source details, and inspector evidence in access-controlled records. Restrict the inspector’s credentials and retention, enforce tenant scope, and prevent untrusted artifact text from changing the monitoring contract. See the telemetry data boundary for the export and storage controls.
Connect the resulting signals to agent reliability SLOs. Keep observer availability and business outcome quality distinct so an outage in the monitor cannot make the business failure rate appear to improve.
Inject failures into the whole observation path
Test known-good and known-bad cases with deterministic fixtures. The TypeScript checks should accept an intentionally empty export when the contract expects zero, distinguish temporary absence from absence after the deadline, and reject a valid-looking artifact from another run or tenant. Malformed inspector results should remain unknown.
The watchdog should detect stale observer health, stale run-state observations, missing stage deadlines, and a deadline that remains breached despite fresh heartbeats. A completed run should still be sent to its outcome checks.
Then exercise the actual deployment: stop a worker, block the inspector’s storage access, delay run-ledger replication, drop a required observation, and supply a wrong immutable artifact version. Confirm the resulting assessment, incident routing, and user-visible state. Test the observer failing while the application remains healthy as well as both failing together.
Version the contract, event schema, inspector, and response policy. Roll out new checks in observation mode, review their coverage and false positives, and enable stronger responses only when the evidence supports them. A monitor that generates frequent unhelpful alerts can consume the attention needed for a real failure.
Use confirmed incidents to create new regression cases. Preserve enough approved evidence for controlled failure attribution, including the contract and source snapshot that applied. Replaying a test should use fixtures and safe readbacks rather than repeating an uncertain production side effect.
Start with a small set of valuable outcome invariants, explicit deadlines, and a healthy observation path. Expand the monitor when a documented failure shows what additional evidence or check would have detected it.
Primary sources and topic provenance
- Google SRE: Monitoring Distributed Systems.
- OpenTelemetry: Tracing API and span status.
- Prometheus: Query functions and absence detection.
Topic discovery: Viral Ruparel’s Your Agent Fails Silently While Every Test Stays Green, published October 20, 2026 on the reference site. The export scenario, outcome contract, observer-health distinction, examples, and diagram here were developed independently.
KEEP READING
Related engineering notes
A Failover Route Is Not a Recovery Path: Proving Independence in AI Infrastructure
Two LLM providers can share the same failure domain. Build an evidence-backed recovery graph that checks cloud, networking, identity, control-plane and capacity dependencies before admitting fallback routes, then test correlated outages without weakening safety.
Read articleAn Eval Platform Sunset Can Erase Your Release Evidence: Build an Evidence-Escrow Migration Gate
When a hosted LLM evaluation platform retires, switching runners is not enough. Preserve the historical evidence, reconstruct grader semantics, validate scoring parity, and enforce a fail-closed release gate that survives the service shutdown.
Read articleWhen the Package Runs Before Your App: Quarantining AI Framework Releases
The 2026 agent-framework PyPI compromise exposed a blind spot in AI build pipelines: Python startup hooks execute before application imports. Design an artifact-quarantine gate, inspect wheels without installing them, separate credentials, and recover from suspected exposure.
Read article