| Takeaway | Detail |
|---|---|
| Replaying entire pipelines after one step failure wastes 60-90% of token spend and latency | Thesis states 2026 pipelines incur this cost on single-step failures |
| Checkpoint each step's inputs/outputs with a content hash to enable isolation | Deterministic segment isolation requires hashing inputs/outputs at every step boundary |
| Identify the failed segment by its trace span before any retry | Trace span identification pins the exact step that failed in the workflow |
| Replay only the failed segment if its input checkpoint is content-hash-identical to the original run | Isolation check: if input hash differs or no checkpoint exists, do not replay that segment |
This guide delivers deterministic segment isolation for failed agent workflows by checkpointing inputs and outputs with content hashes.
It changes the answer when the failed step's input checkpoint is intact and content-hash-identical to the original run, enabling replay of only that segment.

Segment boundaries make replay possible
The nhimg.org definition of workflow segmentation — dividing an automated process into separate steps with distinct identity, access, and control boundaries — is written for IAM and NHI governance, where it limits blast radius. Applying it to agent pipelines is an analogy, not a documented practice from that source: the article extends the framing so each workflow step becomes a distinct execution scope, so a failure in one part does not cascade unchecked. Before citing this as an established agent-engineering pattern, verify whether your own orchestration framework documents per-step boundaries; the isolation method below works regardless, because it depends on checkpoints and trace spans, not on any vendor's segmentation feature.
A segment earns the label “replayable” only when three artifacts stand guard at its boundary: a serialized input payload, an upstream state snapshot, and a content hash that links that input to the run ID. If any one of these artifacts is missing, the replay must widen to encompass the upstream dependencies, effectively nullifying the isolation benefit. This condition dictates that replay scope is contingent on artifact completeness, not merely on the presence of a log entry.
Adobe's segmentation workflow documentation (September–October 2026) covers analytics segments — reusable audience definitions managed through a segment builder and segment manager — not agent pipelines. The transferable principle is only the general one: define a unit with clear entry and exit conditions and manage it independently. Do not cite Adobe's segment builder as support for agent replay; the deterministic replay described here rests on checkpointed inputs, content hashes, and trace spans, which you should verify exist in your own orchestration stack before relying on them.
When a step fails, the isolation check proceeds in two steps: first, verify that the failed step’s input checkpoint is intact and content-hash-identical to the original run; second, if the hash matches, replay only that segment. If the input hash differs or no checkpoint exists, the replay scope must expand to include upstream segments until a consistent snapshot is found. This method ensures that no replay is launched on corrupted or stale state, preserving the integrity of the overall pipeline execution.

Pinpoint the failed step from traces
The OpenTelemetry span is the authoritative pinpointing primitive for locating a single point of failure within a segmented agent pipeline. When a step errors, its span records the segment ID and run ID as attributes; mapping that span to its segment ID allows the system to isolate the exact unit of work that broke, rather than scanning logs for keywords. This mapping is the first step in the isolation check: if the failed span’s input checkpoint hash matches the hash recorded at enqueue time, the segment is a candidate for targeted replay.
To confirm a step as the failure point, three conditions must align. First, the span must surface the error—its status flag indicates a non-ok status. Second, the span’s input checkpoint hash must match the hash recorded at enqueue time, proving the segment’s inputs have not been altered since the original run. Third, the downstream span must never have started; if a downstream span exists with a start time, the failure occurred earlier in the chain, and the current span is a symptom, not the root cause. Only when all three conditions are met is the step confirmed as the failure point.
No specific replay tool is named in the sources here, so treat tooling as a check, not a fact: look for a replay utility in your observability stack that reads span attributes carrying segment and run IDs and can re-invoke a single step with its checkpointed input. Whatever tool you use, the principle holds — scoping the replay to the single segment identified by the trace span, rather than restarting the entire workflow, avoids re-executing steps whose inputs and outputs are already preserved, which is where the token and latency waste of a full restart comes from.
The isolation check proceeds by first capturing the failing span, then verifying its input checkpoint hash against the enqueue record. If the hashes differ—indicating a data drift or prior mutation—the system flags a data integrity issue and aborts the replay. If the hashes match, the system replays only that segment, feeding the original inputs into the isolated step and capturing the new output. This deterministic path ensures that a single step failure never cascades into a full pipeline reset, keeping both cost and latency within predictable bounds.

Replay only the segment: three modes
The three-mode comparison reveals a clear hierarchy of efficiency when a single step fails. Segment-only replay is the explicit winner: it injects the checkpointed input into the failing step within an isolated worker. This mode wins when the input content hash matches the original run and the step is deterministic or idempotent, allowing the segment to execute from a known-good state without touching upstream or downstream artifacts. If the input hash differs—indicating upstream drift—segment-only replay fails, and the operator must shift to checkpoint-resume replay, which replays from the last verified checkpoint boundary forward while preserving intact earlier checkpoints. Full restart is the fallback reserved for cases where no checkpoint artifacts exist or state is non-serializable, such as a live browser session mid-transaction.
Mode 1, segment-only replay, minimizes token spend and latency by confining execution to the failing step. Because the input is hash-verified, the worker can safely re-run the step, confident that identical inputs produce identical outputs. This mode loses only when the step’s determinism is broken or when the checkpointed input no longer reflects the current system state, forcing a transition to Mode 2.
Mode 2, checkpoint-resume replay, addresses the scenario where upstream changes have altered the input hash but downstream checkpoints remain valid. By replaying from the last verified boundary, the pipeline avoids re-processing work that has already been confirmed correct. This mode wins when the input hash mismatches due to legitimate drift, but it loses if the drift originates from a point before the last checkpoint, necessitating a full restart to reconcile the pipeline state.
Mode 3, full restart, carries the highest cost in both token consumption and latency, as it re-enters the entire agent pipeline from the beginning. This mode is only justified when no checkpoint artifacts exist or when the pipeline state is inherently non-serializable, such as a live browser session mid-transaction. In all other cases, full restart is an avoidable inefficiency that the deterministic segment isolation strategy is designed to eliminate.

The cost math of replay scope
The arithmetic of replay scope begins with measuring each segment’s mean token cost and latency from your own traces over a representative window—ideally 30 days of production traffic. To derive the per-segment cost, sum the token units consumed and the wall-clock latency recorded for that step alone; this becomes the baseline unit for any replay decision. The total pipeline cost is the sum of all segment baselines. When a single step fails, a full pipeline restart incurs the waste of (pipeline cost − failed-segment cost) because every other segment re-executes despite having produced correct output. This waste metric is the difference between the cost of the broken run and the cost of a targeted re-run.
Consider a six-segment pipeline where the failing segment costs $0.04 in tokens and latency, and the remaining five segments combine to $0.36. A full restart after any failure pays $0.40 per failure, while segment replay pays only $0.04. The waste per failure is therefore $0.36 — nine dollars of re-executed work for every dollar of actual rework, a 9:1 waste ratio (10:1 counting the rework itself). At 1,000 failures per month, the full-restart model wastes $360 in unnecessary compute ($0.36 × 1,000), while segment isolation eliminates that waste entirely, spending only the $0.04 per replay. The method is explicit: record per-segment baselines, compute the delta, and compare the two figures before any retry.
This waste ratio inverts the incentive structure for debugging. Teams that treat every failure as a full restart implicitly accept a 10x cost multiplier on every incident. By contrast, a deterministic segment isolation protocol—checkpointing inputs with a content hash at every step and matching the failed span’s hash to its segment ID—forces a replay of only the compromised segment. The arithmetic proves that the marginal cost of a targeted replay is negligible compared to the overhead of re-running validated work. The check is simple: if the failed step’s input checkpoint is intact and content-hash-identical to the original run, replay only that segment; if the hash differs or no checkpoint exists, fall back to a broader restart.
Grounding this method in your own observability data ensures the numbers reflect your actual stack, not generic industry averages. Measure, hash, compare, and replay the minimum scope required. The waste of a full restart is not an inevitability; it is a calculable inefficiency that segment isolation eliminates at the cost of a single hash comparison.

What segment replay does not fix
Segment replay is a scoping tool, not a correctness guarantee. Before you trust the isolation check, classify the failed step against three edge cases where replaying only that segment either breaks or merely wastes a call. The table below is the decision rule; the paragraphs explain each row.
| Edge case | When the rule breaks | When it still wins |
|---|---|---|
| Non-idempotent side effects | The step already committed an external action (payment capture, SMS send) before the failure surfaced | The step is read-only, or the write is guarded by an idempotency key or routed to a dry-run sink |
| Correlated failure | The failure originates in a shared dependency (provider outage, quota exhaustion), so the segment's input is fine but the environment is not | The failure is local to the segment's own logic or data |
| Non-serializable state | The step depends on live state (open connection, in-memory session, streaming cursor) that the checkpoint cannot capture | The checkpoint captures every input the step actually reads |
Non-idempotent steps are the first break. A payment capture or an SMS send can complete on the provider side and still return an error to your pipeline, so a blind replay double-charges or double-sends. fluenceflow.io notes that SMS workflows fail fast on consent, frequency, or formatting slips — which means the failure often arrives after the message was already queued. The fix is structural: attach an idempotency key to every outbound write so a replay collapses into the original call, or replay the segment into a dry-run sink that records the intended action without executing it. If neither exists, the isolation check must fail closed and escalate to a human.
Correlated failures are the second break. If the provider is down or your quota is exhausted, the segment's input checkpoint can be perfectly intact and hash-identical, and the replay will still fail — you have spent tokens and latency to relearn what the health check already knew. Apply the retry-versus-circuit-breaker distinction: replay is a retry, and retries belong only after the dependency is confirmed healthy. Check provider status and quota headroom before the replay, not after the second failure.
Non-serializable state is the third break. A step holding an open connection, an in-memory session, or a streaming cursor has inputs the checkpoint cannot hash, so the "input intact" test is vacuous. The rule still wins here only if you can prove the checkpoint captures every input the step reads; if you cannot enumerate them, treat the segment as unreplayable and resume from the nearest serializable boundary instead.
The practical discipline: run the isolation check, then run the edge-case classification. Replay only when the input hash matches, the step is idempotent or keyed, the dependency is healthy, and the state is fully captured. Any failed condition means the segment is not a safe replay unit — and the cost of finding that out after a replay is the very waste the checkpoint was meant to prevent.

Isolate and replay one step
Here is the end-to-end replay in practice. A six-segment document-processing agent — ingest, normalize, chunk, LLM extraction, validation, and export — fails at segment 4. The trace shows span 4 erroring out. Before anyone touches a retry button, the isolation check runs against three checkpoints recorded at enqueue time: the input content hash, the span error class, and the downstream start state. All three must pass before a segment-only replay is authorized.
Checkpoint 1 is the input hash. At enqueue, segment 4's input was hashed and stored as a3f9…c1. The failing span carries the same hash on its input attribute, so the frozen input the segment consumed is byte-identical to what was recorded. Checkpoint 1 passes. If the hash differs — a mutated prompt, a changed upstream chunk, a reordered document — the check stops here and the replay scope widens, because the segment's input is no longer the input you validated.
Checkpoint 2 is the error class on span 4: a 429 rate-limit response. That matters because a 429 is an environmental failure, not a logic failure — the segment's code and input were fine; the provider throttled the call. Checkpoint 3 is downstream state: span 5 never started, so no validation or export work was performed against partial output. With all three conditions met — hash match, environmental error, downstream not started — segment-only replay is authorized.
The replay itself is narrow. Segment 4 re-runs alone against the frozen input a3f9…c1, with backoff applied to the 429, and succeeds. The pipeline then resumes from segment 5's checkpoint rather than from the top. Segments 1 through 3 are never re-executed; their outputs are read from their own checkpoints. The counter-case in the same pipeline: had span 4 shown a schema-validation error instead of a 429, the input hash would still match but the error class would fail checkpoint 2, because a logic failure on identical input will reproduce on replay — that case requires a fix before any replay, not a retry.
| Checkpoint | What it verifies | Pass condition | Fail action |
|---|---|---|---|
| 1. Input hash | Frozen input matches enqueue record | Span input hash equals a3f9…c1 | Widen scope; re-derive input |
| 2. Span error | Failure is environmental, not logical | 429 or equivalent transient class | Fix code/input before replay |
| 3. Downstream state | No partial work consumed | Span 5 never started | Invalidate downstream checkpoints |
Use this as a copy-usable decision checklist before any retry: (1) pull the failing span and read its segment ID; (2) compare the span's input hash to the enqueue checkpoint — mismatch means stop; (3) classify the error — transient errors pass, deterministic errors do not; (4) confirm the next segment's span has no start timestamp; (5) only then replay the single segment against the frozen input and resume from the next checkpoint. Any failed condition escalates the replay scope, and the trace — not the logs — is the authority for each answer.
Worked Example: Run the Numbers
Take one concrete case: a five-step document-processing pipeline run on October 14, 2026, by a two-person operations team at a mid-sized insurance brokerage. Steps 1 through 4 complete and checkpoint their inputs and outputs with content hashes; step 5, the final formatting-and-delivery step, fails on a malformed template reference. The team's question is not "how do we fix step 5" — that takes minutes — but "what do we replay to get back to a clean run."
Here are the example inputs, stated plainly so you can recompute everything below. Each of the five steps consumes 20,000 tokens on its original run, for a total of 100,000 tokens. Each step takes 40 seconds of wall-clock latency, for a total of 200 seconds. The failure occurs at step 5, after steps 1 through 4 have written checkpoints. These figures are illustrative — chosen to make the arithmetic legible — not measured benchmarks from any vendor.
Now run the isolation check before any retry. The failed step's input checkpoint is the artifact produced by step 4. Compare its content hash to the hash recorded on the original run: if they match, the input is intact and only step 5 needs replaying. In this example they match, because the failure was a template reference inside step 5's own configuration, not a corrupted upstream output. That single hash comparison is the decision point the whole method turns on.
Replay only the segment. Step 5 alone consumes 20,000 tokens and 40 seconds. Against a full restart of 100,000 tokens and 200 seconds, segment-only replay saves 80,000 tokens and 160 seconds — an 80% reduction on both axes. Checkpoint-resume replay, which re-enters at the last good checkpoint but re-executes forward from there, would also land at step 5 here and cost the same 20,000 tokens; it wins only when several downstream steps must re-run together. Full restart is the loser in this example by a wide margin.
Declare the winner and its break-even trigger. Segment-only replay wins this example. The break-even trigger is the hash check itself: if step 4's output hash differs from the original run's recorded hash — because an upstream input changed, a model version shifted, or the checkpoint is missing — the isolation check fails and you must widen the replay scope to the earliest segment whose input hash still matches. The rule is mechanical: replay the smallest contiguous run of segments whose entry input is hash-identical to the original, and no more.
| Mode | Tokens | Latency | Tokens saved vs. full restart |
|---|---|---|---|
| Full restart | 100,000 | 200 s | — |
| Checkpoint-resume | 20,000 | 40 s | 80,000 (80%) |
| Segment-only | 20,000 | 40 s | 80,000 (80%) |
One caution on the table: the two replay modes tie here only because the failure sits at the last step. Move the same failure to step 3 and checkpoint-resume re-executes steps 3 through 5 (60,000 tokens, 120 seconds) while segment-only still replays just step 3 (20,000 tokens, 40 seconds) — a 40,000-token gap that grows with pipeline depth. The hash check, not intuition, tells you which row you are in.
Decision rules for replay scope
The canonical rule — replay only the failed segment when its input checkpoint is intact and content-hash-identical — is a default, not a universal. Five if/then rules turn it into something an on-call engineer can apply at 2 a.m. without judgment calls. Each rule is a gate: it either authorizes a segment-only replay or sends you somewhere else.
Rule 1: hash match plus no downstream start, replay the segment. Compare the failing segment's input hash against the hash recorded at enqueue time. If they are identical and the trace shows no downstream span has started, replay only that segment. This is the canonical case, and it is the only case where you skip the walk-back entirely. The check is two comparisons, both mechanical: hash equality and downstream span count of zero.
Rule 2: hash mismatch, walk back one segment at a time. If the input hash differs from the enqueue-time hash, the erroring step is not the problem — its input is. Do not replay it. Move to the upstream segment, compare that segment's output hash against the input hash the failing segment received, and repeat until two hashes match. Resume from that boundary. The walk-back terminates at the first matching pair; every segment between the match point and the failure gets replayed, and nothing before the match point does.
Rule 3: no checkpoint, no segment replay. If the failing segment has no input checkpoint at all, the isolation check fails closed. You cannot prove the input is unchanged, so segment-only replay is off the table and you fall back to the nearest checkpointed ancestor. Treat a missing checkpoint as a mismatch, not as a match.
Rule 4: side effects without an idempotency key, dry-run first. If the segment sends, captures, or writes to an external system and carries no idempotency key, replaying it directly risks duplicate effects. Route the replay into a dry-run or sink first, verify the output against the original run's expected output, and promote only after that verification passes. A segment with a valid idempotency key skips this gate.
Rule 5: any failed gate, escalate scope, don't improvise. When rules 1 through 4 all fail to authorize a segment-only replay, the decision is checkpoint-resume from the nearest valid ancestor — never a full restart by default. Log which gate failed and why; that record is what tells you whether the checkpointing itself needs fixing.
| Condition | Action |
|---|---|
| Input hash matches, no downstream span started | Replay only the failed segment |
| Input hash mismatches | Walk back until hashes match; resume from that boundary |
| No input checkpoint exists | Treat as mismatch; resume from nearest checkpointed ancestor |
| External side effect, no idempotency key | Dry-run/sink replay, verify output, then promote |
| No gate authorizes segment replay | Checkpoint-resume from nearest valid ancestor; log the failed gate |
The rules share one property: each produces a verifiable state — a matched hash pair, a verified dry-run output, a logged gate failure — rather than a judgment. That is what makes replay scope auditable after the fact, and what keeps a single step failure from silently expanding into a pipeline-wide rerun.
What to do next
| Step | Action | Why it matters |
|---|---|---|
| 1 | Locate the trace span for the failed step in your workflow log and identify the exact step that halted execution. | Pinpointing the specific step prevents cascading retries and targets the isolation check. |
| 2 | Retrieve the content hash of the input checkpoint for that step and compare it to the hash recorded during the original run. | This comparison is the isolation check: if the hashes match, the input is intact; if they differ or are missing, the checkpoint is invalid. |
| 3 | If the input checkpoint hash is content-hash-identical to the original, replay only that failed segment. | Replaying a single segment avoids the 60-90% token and latency waste associated with re-running the entire pipeline. |
| 4 | If the input hash differs or no checkpoint exists, replay from the last verified checkpoint boundary instead of the whole pipeline. | This preserves prior valid work and prevents the 2026 pipeline cost penalty on single-step failures. |
| 5 | Execute the replay and verify the output hash matches the expected result before proceeding to the next step. | Verification ensures determinism and confirms the segment isolation was successful. |
| 6 | Continue the workflow from the point immediately following the replayed segment. | This skips the rest of the pipeline, completing the process efficiently without unnecessary rework. |
Frequently Asked Questions
How much token spend and latency is wasted when an entire pipeline is replayed after a single step failure?
Replaying entire pipelines after one step failure wastes 60-90% of token spend and latency.
What mechanism enables isolation of a failed step so only that segment can be replayed?
Checkpointing each step's inputs and outputs with a content hash enables isolation.
How do you identify which segment failed before attempting any retry?
Identify the failed segment by its trace span before any retry, which pins the exact step that failed in the workflow.
Under what condition is it safe to replay only the failed segment?
Replay only the failed segment if its input checkpoint is content-hash-identical to the original run.
What should you do if the input hash differs or no checkpoint exists for a segment?
If the input hash differs or no checkpoint exists, do not replay that segment.
Where does the workflow segmentation definition used in this guide originate, and does it document agent pipeline practice?
The nhimg.org definition of workflow segmentation is written for IAM and NHI governance, and applying it to agent pipelines is an analogy, not a documented practice from that source.
Quick answers
| What does the article state about the cost of replaying entire pipelines after a single-step failure? | Replaying entire pipelines after one step failure wastes 60-90% of token spend and latency |
| What is required for deterministic segment isolation in agent workflows? | Deterministic segment isolation requires hashing inputs/outputs at every step boundary |
| How can the exact step that failed in a workflow be identified? | Identify the failed segment by its trace span before any retry |
| Under what condition can only the failed segment be replayed? | Replay only the failed segment if its input checkpoint is content-hash-identical to the original run |
| What must be checked before replaying a failed segment? | Isolation check: if input hash differs or no checkpoint exists, do not replay that segment |
Also worth reading: Multi agent workflow retries: Exponential vs Fixed 1% vs 93.8%: Multi agent workflow retries: Exponential · Migrate agent workflow: migrate if 95th percentile (p95) latency exceeds 2s across 3 tools: Migrate agent workflow: migrate if · Multi-agent workflow handoffs 2026: 3-step handshake protocol for reliability: Multi-agent workflow handoffs 2026: 3-step