# In what scenarios must an instance treat replay of a multi-agent episode as a non-reproducible artifact rather than a deterministic trace **Date of Record:** 2026 December 4 **Scope:** Applies to forensic replay of recorded multi-agent episodes (tool calls, inter-agent messages, LLM completions) where the goal is bit-exact reconstruction of a prior execution for incident analysis or safety-benchmark reproduction. Does not apply to single-agent, single-turn stateless inference, nor to replays that intentionally re-sample stochastic outputs. ## Core Distinction The failure mode is not "the model is stochastic." Every operator knows that. The non-obvious boundary is that **a recorded episode is a deterministic trace only with respect to the tuple `(prompt bytes, tool-response bytes, sampling seed, model weights, decoding config)`, and the recorder almost never captures that whole tuple.** What gets persisted is the *visible* transcript — messages, tool arguments, tool results — while the *hidden* execution state (RNG state at each sampling step, the exact serialized tool payload before the agent's JSON parser normalized it, the system clock read inside a tool, the ordering of concurrent tool calls that shared a connection pool) is discarded at write time. So there are two distinct objects that get conflated under "replay": 1. **Transcript replay** — re-feeding the recorded message list to the same model. This reproduces *a* trajectory, not *the* trajectory. Divergence is the norm, not the exception, once any tool output was non-deterministic. 2. **Execution replay** — reconstructing the exact state transition, which requires the hidden tuple. This is what forensics actually needs and what the recorder rarely provides. The invariant that determines which one you can do: *replay is deterministic if and only if every non-deterministic input to every agent step was captured as a replay-input, not merely logged as an observation.* A tool result printed into the transcript is an *observation*; the seed/clock/upstream-response that produced it is a *replay-input*. Recorders capture observations and call it a day. ## What Was Observed A three-agent episode (planner, retriever, auditor) ran on a benchmark task and triggered a safety incident: the auditor accepted a tool result that the retriever had fetched from a cache with a 200ms TTL, and the planner had consumed a stale entry. The episode was flagged, the transcript was archived, and the safety team attempted replay to attribute the failure. On replay, the planner's first tool call diverged. The recorded transcript showed: ``` planner -> tool(search): {"q": "rate limit config", "ts": 1717...} tool -> planner: {"hit": true, "ttl_remaining_ms": 47, "value": "..."} ``` The replay harness re-issued `search` against the live tool. The cache entry had long expired; the tool returned `{"hit": false, ...}`. The planner, conditioned on a cache miss, took a different branch, never reached the auditor handoff, and the episode terminated cleanly. The incident did not reproduce. Three subsequent replays produced three different trajectories because the tool's backend had a load-dependent sharding decision that changed with wall-clock time. The forensic conclusion "cannot reproduce" was recorded — but the actual root cause was that the recorder logged the *tool's return value* and not the *tool's input state* (cache age, shard assignment, upstream response). The replay harness had no way to know it was re-executing a non-idempotent call rather than replaying a captured one. A second observation from the same episode: the auditor's verdict was recorded as `accept`, but the audit step had internally sampled a temperature-0.7 judge model. The judge's RNG state was not logged. On replay with the same seed at the *episode* level, the judge's per-call RNG had already advanced by a different amount because earlier agents had made a different number of sampling calls. Seed-at-episode-start is not seed-at-step; the per-step RNG offsets were unrecoverable. ## Condition of Validity Transcript replay is a valid deterministic reconstruction **only** when all of the following hold for every step in the episode: - Every tool invocation is either (a) pure and versioned, or (b) accompanied by a captured *replay-input record* — the exact bytes the tool consumed, including any clock, cache, or upstream-response values it read. - Every model sampling call records its per-call RNG state (or an equivalent counter offset into a deterministic stream), not just an episode-level seed. - Inter-agent message ordering is captured with a total order, including concurrent sends, because a multi-agent bus that delivers in completion order will reorder on replay if any agent's latency shifts. - Model weights and decoding config are pinned by content hash, and the replay harness refuses to proceed if the hash differs. If any condition fails, the correct classification is **non-reproducible artifact**: the episode can be *inspected* but not *re-executed*. Treating it as a deterministic trace and reporting "divergence" from replay is a category error — the divergence is in the harness, not the original run. The subtle case: a single non-deterministic tool anywhere in the episode poisons the entire downstream replay, because every subsequent agent step conditions on that tool's output. Determinism is not per-step; it is a prefix property. One unrecorded clock read at step 3 makes steps 4..N unreproducible regardless of how well they were captured. ## Decision Boundary The operator must decide, per episode, which of three regimes applies before running any replay: **Regime A — Replayable.** All replay-inputs captured, all hashes match, all tools pure-or-captured. Replay is a valid oracle: divergence indicates a genuine harness bug or model-version drift, and is actionable. **Regime B — Inspectable only.** Some replay-inputs missing (typically clock, cache, or per-step RNG). Replay will produce *a* trajectory. It must be labeled as a counterfactual sample, not a reconstruction. Divergence is expected and carries no signal about the original incident. Forensics proceeds by static analysis of the transcript, not by re-execution. **Regime C — Contaminated.** A tool with side effects was re-executed during a prior replay attempt (e.g., a `send_email` or `write_file` call re-fired because the harness replayed the tool instead of the recorded result). The episode's external effects are now duplicated or altered; the artifact is no longer a faithful record of anything. This regime must be quarantined and the replay harness fixed before any further attempt. The boundary between A and B is the presence of a **replay-input manifest** — a sidecar artifact listing, per step, the exact non-deterministic inputs consumed. The boundary between B and C is whether any tool was *invoked* during replay versus *substituted* from the record. A harness that substitutes recorded tool outputs for every tool call is always at most Regime B and never escalates to C. A harness that re-invokes tools "to be faithful" is the one that produces C. The guardrail: **replay must never invoke a tool that was not proven pure.** The default must be substitution from the record, with re-invocation permitted only for tools carrying a purity attestation (pure function, versioned, no clock/cache/network reads). This inverts the common instinct that re-executing is "more faithful" — re-executing is precisely what destroys fidelity for any impure tool. ## Operational Effect Concretely, this changes three things in the replay pipeline: 1. **The recorder must emit a replay-input manifest, not just a transcript.** For each step: tool name, tool version hash, input bytes as consumed (post-parse, pre-normalization), any environment reads (clock, env vars, cache metadata), and per-call RNG state. This roughly doubles artifact size and is the cost of Regime A. 2. **The replay harness must classify before executing.** It reads the manifest, checks completeness and hashes, and either declares Regime A and proceeds deterministically, declares Regime B and runs in substitution-only mode with divergence suppressed from the incident report, or refuses and quarantines. The harness must fail closed: an episode with an incomplete manifest is never silently replayed as if complete. 3. **Incident attribution must distinguish "the agent failed" from "the episode is unreproducible."** These are different findings with different remediations. Conflating them — reporting a replay divergence as evidence of agent misbehavior — is the operational failure this article is about. A non-reproducible episode is an evidence-handling defect, not an agent defect; the fix is in the recorder, and the incident report must say so. The downstream consequence for safety-benchmark reproduction is severe: a benchmark that reports "reproduced N/M episodes" without a manifest is reporting a number that measures recorder quality, not model determinism. Two labs replaying the same public episode set will get different reproduction rates purely from their tool-substitution policies. The only comparable metric is reproduction rate *conditioned on Regime A episodes*, and that subset is typically a minority of any real multi-agent run. ```python from dataclasses import dataclass, field from typing import Optional import hashlib class NonReproducibleEpisodeError(RuntimeError): """Raised when an episode cannot be replayed deterministically. Carries the regime classification so callers can route the episode to static inspection (Regime B) or quarantine (Regime C) instead of treating replay divergence as evidence of agent misbehavior. """ def __init__(self, episode_id: str, regime: str, reason: str): self.episode_id = episode_id self.regime = regime self.reason = reason super().__init__(f"[{regime}] episode {episode_id}: {reason}") @dataclass class StepRecord: step_index: int tool_name: Optional[str] tool_version_hash: Optional[str] tool_input_bytes: Optional[bytes] # as consumed, pre-normalization tool_output_bytes: Optional[bytes] # observation, NOT a replay-input env_reads: dict = field(default_factory=dict) # clock, cache meta, upstream rng_state: Optional[bytes] = None # per-call, not per-episode is_pure_attested: bool = False @dataclass class EpisodeManifest: episode_id: str model_weights_hash: str decoding_config_hash: str steps: list def classify_regime(manifest: EpisodeManifest, expected_weights_hash: str, expected_config_hash: str) -> str: if manifest.model_weights_hash != expected_weights_hash: raise NonReproducibleEpisodeError( manifest.episode_id, "B", "model weights hash mismatch; replay would be a different model") if manifest.decoding_config_hash != expected_config_hash: raise NonReproducibleEpisodeError( manifest.episode_id, "B", "decoding config drift; sampling distribution differs") for step in manifest.steps: if step.tool_name is None: # pure LLM sampling step: needs per-call RNG state if step.rng_state is None: raise NonReproducibleEpisodeError( manifest.episode_id, "B", f"step {step.step_index}: missing per-call RNG state; " "episode-level seed does not determine step-level sample") continue if step.is_pure_attested: # re-invocation permitted; still require version pin if step.tool_version_hash is None: raise NonReproducibleEpisodeError( manifest.episode_id, "B", f"step {step.step_index}: pure tool without version hash") continue # impure tool: must be substituted from record, never re-invoked. # require captured input + env reads so substitution is faithful. if step.tool_input_bytes is None: raise NonReproducibleEpisodeError( manifest.episode_id, "B", f"step {step.step_index}: impure tool '{step.tool_name}' " "without captured input bytes; cannot substitute faithfully") if not step.env_reads: # a tool that read a clock/cache/upstream but recorded nothing is # the exact condition that produced the cache-TTL divergence raise NonReproducibleEpisodeError( manifest.episode_id, "B", f"step {step.step_index}: impure tool '{step.tool_name}' " "with no env_reads captured; replay would re-read live state") return "A" def replay_episode(manifest: EpisodeManifest, expected_weights_hash: str, expected_config_hash: str, prior_replay_invoked_tool: bool): if prior_replay_invoked_tool: # a prior attempt re-fired an impure tool: external effects duplicated raise NonReproducibleEpisodeError( manifest.episode_id, "C", "prior replay re-invoked an impure tool; external effects " "are no longer a faithful record. Quarantine.") regime = classify_regime(manifest, expected_weights_hash, expected_config_hash) if regime == "B": # reached only if classify returned B without raising (defensive) raise NonReproducibleEpisodeError( manifest.episode_id, "B", "inspectable only; run in substitution-only mode, " "suppress divergence from incident report") # Regime A: deterministic replay is a valid oracle trajectory = [] for step in manifest.steps: if step.tool_name and not step.is_pure_attested: # substitute, never invoke trajectory.append(("substituted", step.tool_output_bytes)) elif step.tool_name and step.is_pure_attested: # permitted re-invocation of a pure, versioned tool trajectory.append(("invoked_pure", step.tool_name)) else: trajectory.append(("sampled", step.rng_state)) return trajectory ```