Assert Replay Order • AI Agent SDK
assert_replay_order: Determinism guardrail: fail loud if replay diverges from the journal.
assert_replay_order
Method
</div>
This is a method of the RunJournal class in the journal module.
Determinism guardrail: fail loud if replay diverges from the journal.
During replay the loop must reproduce the recorded sequence of steps. Because the memoised :meth:replay_index lookup is keyed by `(seq, kind), this guard compares the full (seq, kind) sequence — not just the bare kinds — so a replay that reproduces the same shape at different seq` values (a divergent step order) still fails loud rather than silently reusing or skipping the wrong recorded step.
Signature
def assert_replay_order(run_id: str, expected: List[Any]) -> NoneParameters
strThe run being replayed.
List[Any]The steps the replay produced, as either `(seq, kind) tuples (preferred, position-aware) or bare kind` strings (compared against the recorded kinds for backward compatibility).
Uses
eventsRuntimeError
Source
View on GitHubpraisonaiagents/runtime/journal.py at line 402