> ## 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.

# Run Journal • AI Agent SDK

> RunJournal: Append-only, restart-safe run-state journal backed by SQLite.

# RunJournal

> Defined in the [**journal**](../modules/journal) module.

<Badge color="blue">AI Agent</Badge>

Append-only, restart-safe run-state journal backed by SQLite.

Thread-safe: a single re-entrant lock guards a shared connection opened with
`check_same_thread=False`, mirroring :class:`~praisonaiagents.runs.
sqlite_ledger.SQLiteRunLedger`.

## Constructor

<ParamField query="db_path" type="Optional[str]" required={false}>
  No description available.
</ParamField>

## Methods

<CardGroup cols={2}>
  <Card title="open_run()" icon="function" href="../functions/RunJournal-open_run">
    Register `run_id` as `running` (idempotent).
  </Card>

  <Card title="set_checkpoint()" icon="function" href="../functions/RunJournal-set_checkpoint">
    Bind the latest files checkpoint to `run_id` for resume.
  </Card>

  <Card title="close_run()" icon="function" href="../functions/RunJournal-close_run">
    Mark `run_id` terminal so it is no longer resumed on restart.
  </Card>

  <Card title="run_meta()" icon="function" href="../functions/RunJournal-run_meta">
    Return the :class:`RunMeta` for `run_id` or `None` if unknown.
  </Card>

  <Card title="interrupted_runs()" icon="function" href="../functions/RunJournal-interrupted_runs">
    Return ids of runs still `running` — resume candidates on restart.
  </Card>

  <Card title="append()" icon="function" href="../functions/RunJournal-append">
    Append `ev` to the journal (idempotent on `run_id/seq/kind`).
  </Card>

  <Card title="events()" icon="function" href="../functions/RunJournal-events">
    Return all journal events for `run_id` ordered by `(seq, kind)`.
  </Card>

  <Card title="replay_index()" icon="function" href="../functions/RunJournal-replay_index">
    Return a `(seq, kind): payload` lookup for memoised replay.
  </Card>

  <Card title="last_iteration()" icon="function" href="../functions/RunJournal-last_iteration">
    Return the highest journalled iteration index, or `None`.
  </Card>

  <Card title="assert_replay_order()" icon="function" href="../functions/RunJournal-assert_replay_order">
    Determinism guardrail: fail loud if replay diverges from the journal.
  </Card>

  <Card title="close()" icon="function" href="../functions/RunJournal-close">
    Close the underlying database connection.
  </Card>
</CardGroup>

## Source

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