# Which invariants prevent trajectory-level latency SLOs from silently absorbing tool-error budget exhaustion in agent observability pipelines **Date of Record:** 2026 November 24 **Scope:** Applies to multi-step agent deployments where a single trajectory-level latency SLO (e.g., p95 end-to-end wall-clock ≤ N seconds) is enforced alongside independent tool-error and hallucination-rate telemetry budgets. Does not apply to single-shot inference endpoints or to batch offline evaluation jobs where trajectories are not latency-bounded. ## Core Distinction A trajectory-level latency SLO and a tool-error budget are two constraints measured over the *same* trajectory but over *different* denominators. Latency is measured per trajectory (wall-clock from first token to terminal action). The tool-error budget is measured per tool invocation (fraction of calls returning error, timeout, or malformed schema). The non-obvious failure is that **retry-on-tool-error consumes latency budget**, so an agent that silently retries failed tools can stay *inside* the latency SLO while its tool-error rate climbs past budget — and conversely, a strict tool-error budget can be satisfied by an agent that *abandons* failing subtasks early, producing a trajectory that is fast and error-clean but semantically incomplete. The invariant that matters: **the latency SLO must be conditioned on a completed trajectory whose tool-error count is accounted for, not merely on wall-clock elapsed.** Without this conditioning, the two SLOs are not independent — they are aliased, and one can be gamed into masking the other. ## What Was Observed In a production agent with a 90-second p95 trajectory SLO and a 2% tool-error budget (errors per invocation), the following trace pattern recurred across ~11% of trajectories during a dependency-degradation window: 1. Tool call `search_index` returns a 503 on the first attempt (counted as one tool error). 2. The agent's retry policy (exponential backoff, 3 attempts) retries. Attempt 2 succeeds at t=+4.2s. 3. Trajectory completes at 71s — comfortably under the 90s SLO. 4. Telemetry records: 1 tool error, 1 successful invocation, trajectory latency 71s, trajectory status `success`. The latency dashboard showed green. The tool-error dashboard showed 2.1% — just over budget, but within noise for the alerting window. The hallucination-rate telemetry, computed only over trajectories marked `success`, showed 0.4% — green. What the aggregate view hid: the retries were clustered. During the degradation window, 38% of trajectories contained at least one retried tool, and those trajectories had a **mean of 2.7 retries**. The p95 latency was held under SLO *because* the retry backoff (capped at 4s per retry) was small relative to the 90s budget — the latency SLO had ~19s of slack that the retry logic was quietly consuming. When the degraded dependency's latency rose from 4s to 22s per retry, the same 2.7-retry trajectories blew through the SLO in a single step change, with no leading indicator on the latency dashboard. Worse: the hallucination-rate telemetry was computed over `success` trajectories only. Retried-then-succeeded trajectories were *more* likely to contain a fabricated citation (3.1% vs. 0.4% baseline), because the model, having seen a tool error, filled the gap with plausible-but-unverified content on the retry path. The hallucination SLO was therefore measured over a population systematically biased *away* from the population where hallucination concentrated. ## Condition of Validity The latency SLO is only a valid operational signal under the following condition: **Latency SLO compliance must be evaluated on the joint distribution (wall_clock, tool_error_count, trajectory_completion_status), and the SLO's validity window closes when the retry-adjusted latency margin — defined as `SLO_budget − (wall_clock − Σ retry_backoff)` — falls below the observed p99 of a single tool-call latency.** In plain terms: if the slack in your latency budget is smaller than one more retry's worth of latency, then your latency SLO is no longer measuring the agent's efficiency — it is measuring your retry policy's luck. At that point, a rise in tool errors will convert directly into latency SLO breaches with zero warning, and the breach will be attributed to "latency regression" rather than to the tool-error budget it actually represents. The hallucination-rate SLO is valid only when computed over *all* trajectories that reached a terminal answer, including those that retried, abandoned, or degraded — not just `success`-tagged ones. Excluding retried trajectories from the hallucination denominator is the specific mechanism by which a tool-error spike becomes an invisible hallucination spike. ## Decision Boundary The boundary between "the two SLOs are independent and can be alerted separately" and "the two SLOs are aliased and must be alerted jointly" is crossed when: - `retry_backoff_p99 × expected_retries_per_trajectory > 0.5 × (latency_SLO − baseline_p50_latency)` i.e., when the expected retry cost exceeds half the latency headroom. Below this, per-SLO alerting is sound. Above it, you must emit a **joint breach signal**: `tool_error_budget_exhausted AND latency_headroom_below_one_retry`. A latency alert alone will arrive *after* the tool-error budget has already been blown, and a tool-error alert alone will be dismissed as noise because latency is still green. The corresponding guardrail: the trajectory-level latency SLO must be **retry-adjusted** before comparison — compute `effective_latency = wall_clock − Σ(retry_backoff)` and enforce the SLO on `effective_latency`, while tracking `Σ(retry_backoff)` as a separate first-class metric. When `Σ(retry_backoff)` per trajectory exceeds a threshold, the trajectory is reclassified from `success` to `degraded`, and degraded trajectories are *included* in the hallucination-rate denominator. ## Operational Effect After retry-adjusting the latency SLO and reclassifying retried trajectories as `degraded` (included in hallucination telemetry), the degradation window's true profile emerged: hallucination rate on degraded trajectories was 3.1%, and the blended rate over all terminal trajectories was 1.4% — not the 0.4% the `success`-only dashboard reported. The latency SLO, retry-adjusted, showed that effective latency was actually *flat* during the window; the wall-clock creep was entirely retry backoff. The correct alert fired on the joint signal 14 minutes before the wall-clock latency SLO would have breached, giving the on-call engineer time to fail over the degraded dependency before any user-visible SLO violation. The invariant to carry forward: **a latency SLO and a tool-error budget are only independent when retry cost is small relative to latency headroom; otherwise they alias, and the hallucination-rate telemetry computed over `success`-only trajectories will systematically under-report exactly the failures the tool-error budget was meant to catch.** ```python from dataclasses import dataclass class SLOAliasingError(RuntimeError): """Raised when trajectory latency SLO and tool-error budget are aliased.""" pass @dataclass class TrajectoryRecord: trajectory_id: str wall_clock_s: float retry_backoff_s: float tool_invocations: int tool_errors: int terminal_status: str # "success" | "degraded" | "failed" contains_fabrication: bool def evaluate_joint_slo( records: list[TrajectoryRecord], latency_slo_s: float, tool_error_budget: float, retry_headroom_fraction: float = 0.5, ) -> dict: if not records: raise SLOAliasingError("no trajectories to evaluate") effective_latencies = [r.wall_clock_s - r.retry_backoff_s for r in records] total_invocations = sum(r.tool_invocations for r in records) total_errors = sum(r.tool_errors for r in records) observed_error_rate = total_errors / total_invocations if total_invocations else 0.0 # Retry-adjusted latency: is wall-clock creep explained by retry backoff? mean_backoff = sum(r.retry_backoff_s for r in records) / len(records) baseline_p50 = sorted(effective_latencies)[len(effective_latencies) // 2] headroom = latency_slo_s - baseline_p50 if headroom <= 0: raise SLOAliasingError( f"effective latency p50 {baseline_p50:.1f}s already exceeds SLO {latency_slo_s:.1f}s" ) # Aliasing condition: expected retry cost exceeds fraction of latency headroom. if mean_backoff > retry_headroom_fraction * headroom: raise SLOAliasingError( f"latency SLO aliased with tool-error budget: " f"mean retry backoff {mean_backoff:.2f}s > " f"{retry_headroom_fraction:.0%} of headroom {headroom:.2f}s; " f"per-SLO alerting is invalid, emit joint breach signal" ) # Hallucination rate must include degraded trajectories, not success-only. terminal = [r for r in records if r.terminal_status in ("success", "degraded")] hallucination_rate = ( sum(1 for r in terminal if r.contains_fabrication) / len(terminal) if terminal else 0.0 ) success_only = [r for r in terminal if r.terminal_status == "success"] success_only_halluc = ( sum(1 for r in success_only if r.contains_fabrication) / len(success_only) if success_only else 0.0 ) return { "effective_latency_p50": baseline_p50, "observed_tool_error_rate": observed_error_rate, "tool_error_budget_exhausted": observed_error_rate > tool_error_budget, "hallucination_rate_all_terminal": hallucination_rate, "hallucination_rate_success_only": success_only_halluc, "denominator_bias": hallucination_rate - success_only_halluc, } ```