Back to Newsletters

Anatomy of the Harness

If you cannot replay the agent, you cannot debug it

The wrong answer is only the beginning. The harder problem is proving what the agent saw, why it acted, and what changed after.

Newsletter cover: If you cannot replay the agent, you cannot debug it

Approx. reading time: 11 minutes · Subscribe to The Anatomy of Harness for more systems-level AI writing. Prefer the broader founder view? Read It's AI-right.

For me, a useful replay means being able to understand yesterday's run without asking today's systems to recreate it.
For me, a useful replay means being able to understand yesterday's run without asking today's systems to recreate it.

The failure was obvious. The cause was not.

When reviewing failed agent runs at Adya, I can usually spot the wrong answer quickly. The harder part is understanding what the system actually saw when it made the decision.

We would open a failed run and find the usual pieces: a prompt, some tool calls, maybe a retrieved document, and the final response. The obvious next step was to run it again and see if the failure happened twice.

Quite often, that made the diagnosis harder.

By the time we returned to the run, a source document might have changed. Search might return a different passage. An API might return newer data. The model itself might have been updated.

The new run could look perfectly reasonable and still tell us very little about the run that had actually failed.

I stopped thinking of replay as simply "run the workflow again."

The system we were debugging could produce different answers, depended on outside systems, and could also change things outside itself.

If the original run had already sent an email, updated a CRM record, issued a credit or changed production data, running it again could make the incident worse. We would not be replaying history. We would be creating another event.

I became less interested in forcing the agent to produce the same answer twice, and more interested in understanding why the first answer happened.

When we talk about replay, I think the first question should be: what exactly are we trying to reconstruct?

Replay is not rerun

People use the word replay to mean at least three different things.

Sometimes they mean opening a saved record and walking through what happened. Sometimes they mean rebuilding the workflow from an ordered history of events. And sometimes they simply mean calling the model and tools again to see whether the same thing happens.

The first two can help explain the past. The third is useful for testing, but I would be careful calling it a replay of the original incident. Too many things may have changed.

When I am debugging, I care less about reproducing the exact same words from the model than rebuilding the path that led to the action. What did the agent know at that moment? Which evidence did it use? What did the tool return? Which policy or human decision allowed it to continue?

If those pieces are preserved, you can usually understand the failure without asking a live model or API to recreate yesterday.
If those pieces are preserved, you can usually understand the failure without asking a live model or API to recreate yesterday.

The past moves

Microsoft Foundry now uses production traces to identify recurring agent behaviour, while OpenTelemetry has introduced standard ways to record model calls, tool execution, token usage and, when enabled, prompt and tool content.

That is useful progress. A stable record matters because almost everything around an agent run can change after the event: the model version, search results, source documents, policies, APIs and the external systems the agent touched.

That creates a difficult trade-off.

The information that is most useful during an incident is often exactly the information you least want sitting around forever in plain text. Prompts, retrieved documents, tool inputs and tool results can contain credentials, personal information or regulated data.

So I would not solve this by recording everything forever.

The real design question is what you always keep, what you remove or hide, what can be stored as a reference instead of a full copy, what can safely be sampled, and which high-impact actions should never disappear from the record.

A log can look complete and still be missing the one change that would have explained the incident.

Writes change the rules

Durable workflow systems have dealt with a version of this problem for years. Temporal, for example, keeps an ordered Event History and rebuilds workflow state from recorded events instead of repeating work that already happened outside the system.

I like that approach for agents because model calls, retrieval and tool execution all depend on systems that can change. During an incident review, I would rather use the result that was recorded at the time than ask the live system to produce it again.

For reads, this mostly protects you from changes in the underlying data. Writes are harder.

A replay should never send the payment twice, issue the credit twice or update the same production record twice.

That means the debugging design also needs a way to recognise that a write already happened, a receipt showing what changed, the version of the external record that changed, and, when necessary, a safe way to undo or offset the action.

Once an agent can change the outside world, replay stops being only an observability feature. It becomes part of the safety design.

What has to survive

1. Control state

What was the objective? Which version of the plan was running? Where was the workflow? Which model was being used? Which policy version applied at that moment?

2. Evidence state

Which documents were used? Which versions? Why were they selected? What went into the tools, and what came back? You probably do not want every sensitive document copied into your logs, but you do need enough information to find or verify the evidence later.

3. Permission state

Who acted? On whose behalf? What were they allowed to do? Which approval or policy decision allowed the next step? An agent can reach the correct answer through the wrong permission path. I would still treat that as an incident.

4. Changes outside the agent

What changed? Which version changed? Did the write actually succeed? Could the change be reversed? Without this piece, you may understand the reasoning and still be unable to explain what actually changed in production. Once you have this history, the loop becomes fairly straightforward: rebuild the run, find where reality moved away from what you expected, change the system, and test the change against the same recorded evidence.

Figure: from replay to resolution

Memory is for next time. Trace is for last time

This distinction matters when I think about memory inside RAS.

Memory exists to help the next decision. It should be selective, compact and relevant enough that the agent is not carrying its full history into every new task.

A trace has a different job. It exists to explain the previous decision, so it needs the order of events, where the evidence came from, and which changes mattered.

Trying to make one store do both jobs usually creates problems. Either future runs inherit far too much history, or the debugging record gets compressed until the useful detail disappears.

With Event Sourced Memory, we are working on a way to build the agent's current memory from previous events without making that compact memory the only record of those events.

Flow IDs help with the same problem across the wider agent workflow. A stable identifier that travels across agent interactions gives you one thread to follow instead of a pile of separate transcripts that someone has to piece together later.

The model gets the smaller amount of context it needs for the current task. Engineering, governance and incident teams keep the longer history they may need later.

What we're building in RAS

We are actively working on this in RAS. I do not want every agent run to become an enormous log. I do want enough of the decision path to survive that we can explain an important decision later without depending on live systems to remember the past for us.

If I had five minutes to show this, I would start with a failed run. I would pull up the exact version of the document the agent saw, the recorded tool result, the model version, the policy decision, who was acting and with what permission, and the write that followed.

Then I would change one part of the system and compare the new decision against the same recorded evidence. The email does not get sent again. The write does not happen again. Today's database does not get to stand in for yesterday's.

For a small team, that can make an incident review much easier to follow. For a large enterprise, I think the bigger value is being able to investigate behaviour across thousands of runs without requiring every live system to reproduce history on demand.

Event Sourced Memory and Flow IDs are two parts of how we are approaching that problem. We are still working through the right balance between useful detail, storage cost and sensitive data. I would rather make those choices deliberately than discover the missing piece during an incident.

COGSS

For this issue, I am focusing on two COGSS letters: Governance and Scale. Replay only becomes useful if it still works when workflows spread across multiple agents and the number of runs becomes large.

COGSS scorecard: Cost, Ownership, Governance, Scale and Sovereign

G - Governance. Can you rebuild an important action using the policy, evidence and identity information that existed when it happened?

S - Scale. Can you still do that across thousands of runs without keeping every piece of sensitive data forever or accidentally discarding the rare failure you eventually need to investigate?

What to do Monday

Pick one high-impact agent run from the last week and try to reconstruct it using only the records you kept. Do not call the model, tool or outside API again.

You should be able to recover the objective, the order of events, the model and version, the evidence used, the recorded tool inputs and outputs, any changes in permissions, approvals, changes made to outside systems, and the final state.

Every place where you have to ask a live system what happened is a gap in your replay. That gap may be acceptable. The important thing is that you chose it deliberately instead of discovering it during an incident.

In a design review, I would ask: what can we reconstruct without repeating an action in the outside world?
In a design review, I would ask: what can we reconstruct without repeating an action in the outside world?

The one-question audit

If a production agent made the wrong decision yesterday, could you explain the path today without asking the world to behave the same way twice? If not, you may still have good logs. I would not yet call the system replayable.

If you want to see how we are approaching this in RAS, book a demo with your own workflow. And if you prefer the broader founder view of AI, subscribe to It's AI-right.

Issue 10 is next: memory. What should an agent remember, what should it forget, and what gets expensive when those two decisions blur?

Sources

  1. Microsoft Foundry, What's new in Microsoft Foundry | September 2026, October 2026.
  2. OpenTelemetry, Inside the LLM Call: GenAI Observability with OpenTelemetry, May 14, 2026.
  3. Temporal, Workflow replay and Event History documentation, accessed November 2026.

Shayak