Skip to content
All posts
Engineering

Making every run replayable

How we record inputs, tool calls and decisions so any run can be replayed byte-for-byte months later.

NP

Nadia Petrov

Platform Engineer · Sep 12, 2026 · 4 min read

An audit trail that only says what happened is half an answer. Reviewers want to know what the agent knew at the time, and whether it would make the same call again.

That second question is the hard one. Models change, tools return different data on a different day, and people forget why they clicked approve. If you can't put the agent back in the exact situation it was in, you can't really answer it. So we built every run to be replayable, months later, down to the byte.

Record the boundary, not the internals

The first instinct is to log everything: every intermediate thought, every variable, every retry. We tried that. It produced enormous recordings that were still not enough to replay a run, because the interesting state lived outside the agent.

So we flipped it. We capture everything that crosses the agent's boundary, and nothing else. Internal state is derived from those inputs, so storing it would only give us a second copy that could disagree with the first.

The three things a run records: the trigger, every tool and model call, and every approvalEverything that crosses the boundary goes into the recording

In practice the boundary has three kinds of traffic:

  1. The trigger. The ticket, webhook or scheduled payload that started the run, stored exactly as it arrived.
  2. Tools and the model. Every request the agent makes and every response it gets back, with the model version and parameters.
  3. People. Every approval, rejection and edit, with who made it, when, and the exact payload they were shown.

What a recorded call looks like

Each entry in a recording is small and boring on purpose. Responses are content-addressed, so the entry only holds a hash:

type RecordedCall = {
  seq: number // position in the run, starting at 0
  tool: string // "orders.lookup", "payments.refund", "model.complete"
  request: unknown // the exact arguments, after secret redaction
  responseHash: string // sha256 of the response body
  startedAt: string
  durationMs: number
}

If two runs look up the same order on the same day, the response is stored once and both recordings point at it. That one decision cut our storage by roughly 70% on support workloads, where agents re-read the same customer records constantly.

What we deliberately leave out

  • Intermediate reasoning that never left the agent. It can be regenerated, and the original is rarely what reviewers want anyway.
  • Timing jitter. We record start times and durations, but replay doesn't try to reproduce slowness.
  • Secrets. Credentials and tokens are redacted before anything is written, so a recording is safe to share with an auditor.

Replay is just a different tool layer

The agent doesn't know it's being replayed. During a replay we swap the tool layer for one that reads from the recording instead of the network, and run the agent exactly as before:

function replayTools(recording: RecordedCall[]): ToolLayer {
  let next = 0
  return async (tool, request) => {
    const expected = recording[next++]
    if (expected?.tool !== tool || !sameRequest(expected.request, request)) {
      throw new Divergence({
        at: next - 1,
        expected,
        actual: { tool, request },
      })
    }
    return readResponse(expected.responseHash)
  }
}

If the agent asks for something the original run never asked for, replay stops and shows you the divergence. That divergence is usually the most interesting line in the report: it is the exact point where a new model, a changed brief or an updated rule would have taken the agent somewhere else.

Three ways teams use it

UseWhat you replayWhat you look for
AuditOne run, months laterThat the decision matches the record
Upgrade testingLast week's runs on a new modelEvery run that diverges, and where
Rule changesLast month's runs with the new ruleWhich approvals would have changed

Upgrade testing turned out to be the most popular by far. Before we switch a workspace to a new model, we replay its last thousand runs against it and send the owner a list of every divergence. Most are harmless rewordings. The handful that aren't are exactly the ones a person should read.

What we'd do differently

We would have content-addressed responses from day one. Migrating a year of recordings to the new format took longer than building the format itself. If you're building something similar, start with the boundary, hash what comes back, and treat replay as a first-class way to run your agent rather than a debugging tool you add later.

NP

Written by

Nadia Petrov

Platform Engineer at Loopline

Give your team its afternoons back.

Pick a template, connect two tools and have your first agent waiting for approval in about ten minutes.