> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Assert Replay Order • AI Agent SDK

> assert_replay_order: Determinism guardrail: fail loud if replay diverges from the journal.

# assert\_replay\_order

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**RunJournal**](../classes/RunJournal) class in the [**journal**](../modules/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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def assert_replay_order(run_id: str, expected: List[Any]) -> None
```

## Parameters

<ParamField query="run_id" type="str" required={true}>
  The run being replayed.
</ParamField>

<ParamField query="expected" type="List[Any]" required={true}>
  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).
</ParamField>

## Uses

* `events`
* `RuntimeError`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/runtime/journal.py#L384">
  `praisonaiagents/runtime/journal.py` at line 384
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Replay Feature" icon="rotate-left" href="/docs/features/replay" />
</CardGroup>
