Record and replay for Python

The run is over. The execution isn't gone.

Record a Python workflow as it runs. When an agent takes an unexpected action, or a customer questions a result, replay the recorded execution and inspect the values and code paths behind it.

Private previewStart with one supported Python workflow

Execution evidenceIllustrative example

A customer questions a checkout total.

Which rate did this order actually use?

item 11.0842
item 21.0842
184720background refresh: rate → 1.0388
item 31.0388
item 41.0388

What the engineer establishesThe rate changed between two items. This order used two exchange rates.

Illustration of the investigation. A real product recording will replace this view before launch.

One investigation · illustrative example

One order. Two exchange rates.

The checkout completed. A customer questions the total. Rerunning the calculation now gives the expected result. The question is what happened in the original run.

The evidence already available

The trace identifies the request and the code that ran. In this example, it does not contain the rate used by each line item.

POST /checkout · 200 OK · 483 ms

The question left open

Did every line item use the same rate, or did a background refresh change it partway through the order?

pricing.pyillustrated replay view
112def price_order(lines, currency):
113 converted = [convert(l.amount, currency)
114 for l in lines]
115 return sum(converted)
116
117def convert(amount, currency):
118 return amount * fx_cache.get(currency)

The rate is read for each item.

Execution history2 threads
184718thread Aitem 1 · rate 1.0842
184719thread Aitem 2 · rate 1.0842
184720thread Bcache refreshed · 1.0388
The rate changes here.
184721thread Aitem 3 · rate 1.0388
184722thread Aitem 4 · rate 1.0388
184723thread Atotal summed
One order, two rates.
Illustrative source and execution history. Event numbers describe ordering, not elapsed time.

The finding

The refresh happened between the second and third items.

The first two items used 1.0842; the last two used 1.0388. The source suggests this could happen. Inspecting the recorded execution establishes where it happened in this order.

Why a fresh rerun misses the evidenceCompare the three execution histories
Original run
thread Aitems 1–2items 3–4sum
thread Brefresh
two rates
unexpected total
Ordinary rerun
thread Aitems 1–2items 3–4sum
thread Brefresh
one rate
expected total
Recorded replay
thread Aitems 1–2items 3–4sum
thread Brefresh
two rates
original evidence

A fresh run can receive different external results and execute in a different order. Replay uses the recorded results and ordering, so the Python state behind the original outcome can be inspected.

The questions behind the investigation

An unexpected result deserves an explanation.

Agents and automation

An agent took an unexpected action.

The model and tool responses may be in your trace. You still need to establish the Python state, transformation, retry or branch that turned them into an action.

Which decision path did this workflow actually take?

Historical calculations

A price, bill or decision is challenged.

The calculation finished successfully. Its inputs or external data may have changed since. Investigate the recorded calculation and the intermediate values that produced this result.

Why did this particular run produce that value?

CI and SDK support

A failure is hard to reconstruct.

A CI test passes on rerun, or a customer's Python integration fails in a way the support report cannot explain. An agreed recording gives the investigation an original execution to work from.

What happened in the run that failed?

See the failed-test replay walkthrough →

How it works

Record while it runs. Investigate afterwards.

Retrace records supported interactions with the outside world and the ordering needed to replay the Python execution. During replay, your code runs against those recorded results.

While your application runs

Your chosen workload

Record supported external calls, returned values, exceptions and execution ordering.

The recording

The external interactions and ordering needed to reconstruct the supported execution.

When an outcome needs investigating

Replay

Re-execute the Python code using the recorded results and ordering.

Investigate

Step through the replay and inspect the Python values and code paths behind the result.

The recording needs to exist when the question arrives.

A workflow can look successful and only be questioned later. For a pilot, we agree what to record, which completed runs to retain, and how long they need to remain available. The relevant code and execution environment must remain available too.

When a question remains

Inspect what you didn't know to log.

Traces, logs, workflow histories and saved inputs can explain many incidents. Sometimes an important question remains: which value was used at a particular point, which branch ran, or what changed between two operations?

For a supported recorded Python execution, replay lets you investigate application state after the run has finished. You can choose much of what to inspect when you know the question.

Evidence for AI-assisted investigation

Concrete runtime values and code paths can also ground an AI-assisted investigation. We discuss supported evidence access and data handling as part of a pilot.

Private preview

Start with one Python worker or workflow.

We assess a specific investigation and a manageable workload together. The first step is to establish whether replay can recover evidence that would be useful to your team.

Runtime and dependencies
We check your Python version, platform, libraries and concurrency against the current preview build.
Recording and retention
We agree the recording boundary and the completed runs that need to remain available, including outcomes that appeared successful.
Deployment and data
We agree where recording and replay run, where the data is retained, and who may inspect it.
A useful first investigation
We choose a concrete question and a way to assess whether the recorded execution supplies the missing evidence.
What a replay can and cannot show

Retrace reconstructs supported Python execution state. It does not recover an execution that was never recorded, the internal computation of a model, opaque native or GPU state, or the internal state of a remote service. Original wall-clock latency and kernel scheduling are not reconstructed by Python replay. Deliberately removed data cannot be assumed recoverable.

For an AI application, the recorded response is what the application received. Replay investigates how the Python code behaved given that response.

Talk to the founders

What was difficult to establish?

Tell us about an investigation your team found difficult: an unexpected agent action, a disputed result, or a Python failure that was hard to explain.

We'll discuss what happened, what your existing tools recovered, and what evidence was missing.

A 25-minute conversation

Bring a recent example. If there is a fit, we'll agree one Python worker or workflow to record and investigate together.

A past incident helps us choose what to record next. Replay needs a recording made while the relevant execution was running.

Submitting opens a draft in your email app. Please send the draft to reach the Retrace team. For recordings, see pilot data handling.

Building a better way to understand software execution.

Retrace is built in London by Henry Yates and Nathan Matthews. We are working with engineering teams to understand where original execution evidence can make an investigation more useful.

FoundersHenry Yates and Nathan Matthews
AdvisorYury Selivanov
Backed byPreston-Werner Ventures