mixle.task.replay module¶
Replayable execution traces – record each step an executor took (tool, args, seed, result) as a plain JSON-able object, and re-run it later to prove the run was deterministic.
A step is only trustworthy to replay if every source of randomness it used is named and captured –
that is the whole point of recording seed per step rather than trusting global RNG state. replay
re-invokes each step’s registered tool with the same args and seed and returns a new
ExecutionTrace; diff is the per-step comparison (bit-identical or not), never a
silent pass.
- class TraceStep(tool, args=<factory>, seed=None, result=None)[source]
Bases:
objectOne recorded step: the tool name, the args it ran with, the seed (if any), and its result.
- class ExecutionTrace(request, steps=<factory>)[source]
Bases:
objectAn ordered list of
TraceStep– JSON-serializable, so it can be stored (e.g. as amixle.substrate"trace"item) and replayed in a fresh process.- to_json()[source]
Serialize the full execution trace to JSON-compatible data.
- classmethod from_json(d)[source]
Reconstruct an execution trace from JSON-compatible data.
- record_step(tools, tool, args, *, seed=None)[source]
Run
tools[tool]once withargs(andseed, if the tool accepts one), recording the result.
- replay(trace, tools)[source]
Re-execute every step of
traceagainsttoolswith the exact same args and seed.
- diff(a, b)[source]
Indices + tool names where
aandbdisagree (JSON-serialized result comparison).