Docs / Guides / Replay and export a run
Replay and export a run
A recorded run replays offline: swarmlabre replay rebuilds every report file and compares each with its hash. swarmlabre export packs a run into a folder that replays on another machine.
Replay a run#
$ python3 -m swarmlabre replay demo/sfaef16e6replay takes a run folder, an exported bundle or a run id, which it looks up under runs/ in the state folder. It rebuilds the board and every report file offline, with no model and no Docker, compares each file with the SHA-256 in the manifest and prints the checks as JSON. It exits 0 only when everything is identical, 1 when something differs and 2 when the folder cannot be replayed at all. Reproducibility describes each check.
--out DIR also writes the rebuilt files into a folder:
$ python3 -m swarmlabre replay demo/sfaef16e6 --out rebuilt/The folder then holds the eight output files, which are the ones the manifest names.
The replay levels#
| full | downstream | |
|---|---|---|
| When | the run folder holds input/sample and --no-sample is not given | the sample is not in the folder, or --no-sample is given |
| The board | rebuilt from inputs.jsonl: the bytes at each offset, the cited calls, duplicates and caps are checked again | taken from board.jsonl |
| YARA rules | matched against the sample again | taken from the record |
checks.sample | identical, or differs from the manifest when the file is another one | not kept |
checks.board | identical or differs | a note that the board was taken from the record |
Both levels rebuild the Reporter's summary, its lint result and its assessment, rebuild every output file and compare each with the manifest. --no-sample runs a bundle that has the sample at the downstream level:
$ python3 -m swarmlabre replay demo/sfaef16e6 --no-sampleA run exported without its sample also replays at the downstream level. Downstream is the weaker claim and the result says so. With keep_sample = false in the configuration SwarmLabRE deletes the run's copy of the sample once the report is written, and the run can then replay at the downstream level only.
Export a run#
$ python3 -m swarmlabre export demo/sfaef16e6 bundles/ $ python3 -m swarmlabre export demo/sfaef16e6 bundles-full/ --with-sample
export RUN DEST copies what a replay needs into DEST/<run id>/ and prints one JSON line with the folder and whether the sample is in it. The run needs a manifest.json, so a run from before recording cannot be exported. The command stops with exit code 2 when the folder in DEST already exists. The bundle holds:
- the run record,
swarm.json, andmanifest.json; - the board's inputs and decisions,
inputs.jsonlandboard.jsonl; layout.json,events.jsonl,detection.jsonandwindows.json;- the model trace,
model-trace.jsonl.gz, and the run's task key,nonce.key; - the prepared files in
prep/and the outputs inout/, so that the bundle can be compared as well as rebuilt; input/sample, only with--with-sample.
The agents' transcripts and thoughts, the container folders and the clip are never copied. A link, a device or a pipe in the folder is skipped, and a folder over 4 GiB or nested deeper than 8 levels is refused. Replay a bundle on any machine with Python 3.12:
$ python3 -m swarmlabre replay bundles/sfaef16e6 $ python3 -m swarmlabre replay bundles-full/sfaef16e6
The first replays at the downstream level and the second at the full level. A bundle with the sample holds a copy of the file you analysed, so share it only with people who may have that file.
The recorded demo run is itself a bundle, and the Pages workflow builds the static demo from it. The web UI shows what the static build does with it.
Watch a replay#
python3 -m swarmlabre serve --replay RUN plays a sealed run folder or a bundle through the web UI, with no model and no Docker. It refuses a recording that does not replay byte for byte. The web UI describes the clock and its options.
Replay through the containers#
$ python3 -m swarmlabre run SAMPLE --replay RUNThis starts the containers as usual and answers every model request from the recorded trace of RUN, using the recorded task key and, unless --brief is given, the recorded brief. It needs Docker and the two images. It makes a new run, so its files differ from the recording in the run id and the times, and the result adds replay_diverged, the number of requests that had no recorded reply. Reproducibility reports what that count was in a measurement.